Need help setting the proper file permission for my purposes
Moderators: snarkout, Patrick, dann
Need help setting the proper file permission for my purposes
Okay, I think I'm confusing myself here. I need a bit of guidance.
I'm trying to create a music file folder that is accessible to everyone I assign to the group "listeners."
I got the group settings for everyone on the system okay, and made the folder /Music available to the group members. But, what I want to do is set a permission that makes any folders and files, created under /Music, by any of the group members, to be R+W to all other members.
Seems as though I'm getting stuck. Any folder made by a group member is made writable for only the originator, unless said originator manually sets permissions to be writable by the other group members. I want that step to be automatically set when the folder is created.
Anyone know what the darned chmod command is for that?
I thought this is what the "sticky" attribute was for.... but I can't seem to get the settings to work in the way I want.
I'm trying to create a music file folder that is accessible to everyone I assign to the group "listeners."
I got the group settings for everyone on the system okay, and made the folder /Music available to the group members. But, what I want to do is set a permission that makes any folders and files, created under /Music, by any of the group members, to be R+W to all other members.
Seems as though I'm getting stuck. Any folder made by a group member is made writable for only the originator, unless said originator manually sets permissions to be writable by the other group members. I want that step to be automatically set when the folder is created.
Anyone know what the darned chmod command is for that?
I thought this is what the "sticky" attribute was for.... but I can't seem to get the settings to work in the way I want.
You're running up against a limitation of the GNU/Linux permission set and umask. You can set the group sticky bit of the directory so that files created in your shared directory are set to be owned by the specific group instead of the users main group, but this does not resolve the typical umask setting of 0022 which sets permissions to newly created files to 644 (rw-r--r--). You could reset the default umask in login.defs to 0022, but I doubt you want to do this as it coudl result in security problems.
If you are using a fairly recent distribution you'll probably want to implement some ACL's. Here are a few links to get you started:
<a href="http://tinyurl.com/bd8o8">Fine-Tuning Linux Admin with ACL</a>
http://acl.bestbits.at/
<a href="http://tinyurl.com/eyqcb">Linux Magazine article on ACL's</a>
Unless someone else has any other info on standard file permissions that I am missing; I think ACL's are the way to go.
Of course there is an ugly hack where you could run a cron job to execute chmod -R g+w on the directory every five seconds or so.
If you are using a fairly recent distribution you'll probably want to implement some ACL's. Here are a few links to get you started:
<a href="http://tinyurl.com/bd8o8">Fine-Tuning Linux Admin with ACL</a>
http://acl.bestbits.at/
<a href="http://tinyurl.com/eyqcb">Linux Magazine article on ACL's</a>
Unless someone else has any other info on standard file permissions that I am missing; I think ACL's are the way to go.
Of course there is an ugly hack where you could run a cron job to execute chmod -R g+w on the directory every five seconds or so.
Thanks, Dann.
So, what you're saying is, for a change, I'm not missing or doing anything wrong.
That's a nice change.
It's not perfect, but I think we'll be able to get by with the settings as they are. Besides, usually when either I or my wife add a folder to the directory, it's for an entire CD we're ripping at the time. I just wondered if there was something I was missing (to get auto. RW permissions set).
Thanks for the added info. and links. Now I can write my How-To for my webpage.
So, what you're saying is, for a change, I'm not missing or doing anything wrong.
That's a nice change.
It's not perfect, but I think we'll be able to get by with the settings as they are. Besides, usually when either I or my wife add a folder to the directory, it's for an entire CD we're ripping at the time. I just wondered if there was something I was missing (to get auto. RW permissions set).
Thanks for the added info. and links. Now I can write my How-To for my webpage.
give the folder 2775 permissions
Sticky set to make all new files created inside the /Music folder the group owner the same as the group owner of the folder.
Example:
if folder x has 2775 set on and its david.david owner.grp then if user jack creates a file and his primary group is users, the file will be given permissions of him as owner BUT david as the group owner.
I cant take credit, a mate just suggested this method.
Sticky set to make all new files created inside the /Music folder the group owner the same as the group owner of the folder.
Example:
if folder x has 2775 set on and its david.david owner.grp then if user jack creates a file and his primary group is users, the file will be given permissions of him as owner BUT david as the group owner.
I cant take credit, a mate just suggested this method.
Linux david 2.6.29.3-desktop-1mnb #1 SMP Thu May 14 15:19:40 EDT 2009 x86_64 AMD Athlon(tm) 64 X2 Dual Core Processor 6000+
Distro: Mandriva 2009.1
Distro: Mandriva 2009.1
But the problem still persists. Even though the stickybit for gid is set resulting in all files/directories that get created underneath this directory are owned by the group owner of the top level directory (in this case john owner) the default umask sets any file to rw-r--r-- for everyone else. Even though john is the owner of the directory, if mary creats a file in this directory john's permissions are still only r--. John can delete the file, but cannot edit the file. Before John can make any changes to the file either root or Mary must chmod g+w.
Now if you also set the owner sticky bit on the directory, then this further complicates the issue in that only the owner of created files can delete the file. Thus, the file Mary created could not be deleted by John even though he owns the directory.
Now if you also set the owner sticky bit on the directory, then this further complicates the issue in that only the owner of created files can delete the file. Thus, the file Mary created could not be deleted by John even though he owns the directory.
Thanks for the help, guys.
Dann, I do appreciate your suggestion on last night's show. I'll try and remember it if/when ReiserFS supports that feature.
Until now, I taught my wife how to set permissions to folders when she creates them. So, that will have to do until more options are available.
Actually, it's not all that big of a deal. Even if she forgets, I can still make the appropriate changes as root. It was just an excercise to see if I could make the process even more automated.
Dann, I do appreciate your suggestion on last night's show. I'll try and remember it if/when ReiserFS supports that feature.
Until now, I taught my wife how to set permissions to folders when she creates them. So, that will have to do until more options are available.
Actually, it's not all that big of a deal. Even if she forgets, I can still make the appropriate changes as root. It was just an excercise to see if I could make the process even more automated.