LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 05-03-2006, 06:03 PM   #1
BigChuckP
LQ Newbie
 
Registered: Oct 2005
Posts: 9

Rep: Reputation: 0
Securing files: Different permissions for different groups


How could I set different permissions for different groups on a file. Say I want group A to have RW permissions on file X but only allow group B to read file X.
Also how could I get the permissions to expire on a set date?
Thank you for any help.
BigChuckP
 
Old 05-03-2006, 07:09 PM   #2
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
What is the filesystem that the file is located on?
If the filesystem supports access control lists, you can use the "setfacl" and "getfacl" commands to set and read access controls for different users and groups.

I don't know how you would have them expire other than running a script that uses the setfacl command to make the changes.

Please refer to the "man getfacl" and "man setfacl" manpages for the syntax.

This is assuming you aren't using a newer Redhat server with may be running SELinux. SELinux uses a different system for access control, which also includes processes in the access context.

Last edited by jschiwal; 05-03-2006 at 07:11 PM.
 
Old 05-04-2006, 02:13 PM   #3
BigChuckP
LQ Newbie
 
Registered: Oct 2005
Posts: 9

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by jschiwal
What is the filesystem that the file is located on?
If the filesystem supports access control lists, you can use the "setfacl" and "getfacl" commands to set and read access controls for different users and groups.

I don't know how you would have them expire other than running a script that uses the setfacl command to make the changes.

Please refer to the "man getfacl" and "man setfacl" manpages for the syntax.

This is assuming you aren't using a newer Redhat server with may be running SELinux. SELinux uses a different system for access control, which also includes processes in the access context.
Thanks jschiwal! I attempted to use setfacl to set the permissions of a file but I received a "Operation not supported" error, I've searched for fixes and I really didn't find any, any thoughts?
Thanks again... oh and I'm not using SELinux
 
Old 05-04-2006, 03:40 PM   #4
BigChuckP
LQ Newbie
 
Registered: Oct 2005
Posts: 9

Original Poster
Rep: Reputation: 0
Never mind I found a good website with a walk through on this.
 
Old 05-04-2006, 04:01 PM   #5
Crito
Senior Member
 
Registered: Nov 2003
Location: Knoxville, TN
Distribution: Kubuntu 9.04
Posts: 1,168

Rep: Reputation: 53
Seems to me could have been done with standard file permissions with less administrative overhead:

Create a group with a group password
add users to group
chown files to group
chmod so group has read and write and other/world only has read
teach users how to use the newgrp command

No ACLs required.
 
Old 05-04-2006, 08:57 PM   #6
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
He wants to allow more than one group access to the files. One group has read-write access. Other groups have only read access. Others have no access. You need to use an access control list for that. Using setfacl isn't hard once you've use is a bit.
 
Old 05-05-2006, 09:55 AM   #7
HGeneAnthony
Member
 
Registered: Mar 2003
Posts: 178

Rep: Reputation: 30
Reply

What distro are you using? If you want to use Posix ACLs you need to recompile the kernel with support for each filesystem which will use Posix ACLs. For example, you want to select it for ext3, reiserfs, etc. After this you need to install the acl package. This will get you setfacl and getfacl commands which are used for setting or retrieving Posix ACLs settings (This is not technically required for using Posix ACL, however you can't modify the extended ACLs without them). After this set the mount options remount,acl on every partition you wish to use Posix ACL. Once the partitions are mounted with the options everything works. Your kernel might already have Posix ACL support in it. I found out that Ubuntu comes with it, however it doesn't mount it with the options to use it nor was the acl package installed. Posix ACLs are easy to use and not difficult to install. Once you get the hang of it it's nothing and a huge plus (which I believe should be a standard by now). Once set up you can get the current acl of a file with:

getfacl /etc/fstab

This will tell you the ACL. You still have owner, group, others you can now however use specific users and groups. For example, to set a permission for the owner:

setfacl -m u::rwx /etc/fstab

This is the same way as setting the owner with standard Unix permissions. To set for a specific user write it like this:

setfacl -m u:geneanthony:rwx /etc/fstab

This is the same for groups. The M switch means modify. This will add or modify a permission for a specific user. If you used X it means remove a permission:

setfacl -x u:geneanthony /etc/fstab

To set more than one permission at a time:

setfacl -m u:geneanthony:rw,g::rwx,g:users:rx /etc/fstab

It's not hard once you get used to it. You can find some nice tutorials online.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
groups and permissions g_trueblood Slackware 2 10-07-2005 05:36 AM
File Permissions, X and Groups mikemrh9 Linux - Software 3 09-08-2005 10:10 PM
problems with setting permissions for groups of files liontamer13 Linux - Newbie 5 03-10-2005 01:16 AM
/dev permissions and groups in 2.6.9 kersten78 Slackware 2 10-24-2004 07:11 PM
users, groups, and permissions mcd Linux - Newbie 3 05-26-2004 10:06 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 12:57 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration