Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
05-03-2006, 06:03 PM
|
#1
|
LQ Newbie
Registered: Oct 2005
Posts: 9
Rep:
|
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
|
|
|
05-03-2006, 07:09 PM
|
#2
|
LQ Guru
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733
|
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.
|
|
|
05-04-2006, 02:13 PM
|
#3
|
LQ Newbie
Registered: Oct 2005
Posts: 9
Original Poster
Rep:
|
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
|
|
|
05-04-2006, 03:40 PM
|
#4
|
LQ Newbie
Registered: Oct 2005
Posts: 9
Original Poster
Rep:
|
Never mind I found a good website with a walk through on this.
|
|
|
05-04-2006, 04:01 PM
|
#5
|
Senior Member
Registered: Nov 2003
Location: Knoxville, TN
Distribution: Kubuntu 9.04
Posts: 1,168
Rep:
|
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.
|
|
|
05-04-2006, 08:57 PM
|
#6
|
LQ Guru
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733
|
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.
|
|
|
05-05-2006, 09:55 AM
|
#7
|
Member
Registered: Mar 2003
Posts: 178
Rep:
|
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.
|
|
|
All times are GMT -5. The time now is 12:57 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|