folder access question

Red Squirrel

No Lifer
May 24, 2003
70,166
13,573
126
www.anyf.ca
Lets say I have user1 and user2. I want to make a folder that user1 can write to, user2 can read but nobody else can read. What I tried, but failed at was this

-chmod the folder 770
-Make user1 and group1 the owner
-put user2 in group1.

But still, anyone else can read it too.

Linux user/groups have always confused me, they're not as straightforward as NTFS permissions are.
 

Kakumba

Senior member
Mar 13, 2006
610
0
0
OK, here you go:

Set "user1" to be the owner.
Set private group "user2" to be the "group" for this folder.
chmod 750 the folder (Owner has full access, group has read and execute, others have nothing).

Test this works as intended. To be honest, I think that even though it means you have to learn another style of permissions, this style is far superior.
 

Red Squirrel

No Lifer
May 24, 2003
70,166
13,573
126
www.anyf.ca
Actually realized the user has to log out and back in for it to take effect, what I did was working as well after having done that. Well they both had write but yeah 750 is what I really wanted.
 

Kakumba

Senior member
Mar 13, 2006
610
0
0
Sweet, glad it all works for ya. The only reason I suggested making the group user2, is that user1 is a private group normally, so that is just my preference. Either way works though, as you have shown. Also, if the numeric security confuses you, I think you can use chmod like this (note, I could be wrong, I use octal values, not this other way):

chmod u=rwx,g=rx,o=

This should give the owner read, write and execute, group read and execute, and others nothing.