Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Changing default permissions for a directory
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
tyreth
Apprentice
Apprentice


Joined: 27 May 2002
Posts: 238
Location: Melbourne, Australia

PostPosted: Mon Jun 03, 2002 4:14 pm    Post subject: Changing default permissions for a directory Reply with quote

How do I change the default permissions for a directory? I have a directory that I want multiple users of a specific group to be able to access, and be able to modify any file that is created in it. It is too much of a hastle to change the perms every time the file is written. How do I tell linux, that for every file or directory created under this particular directory, should belong to <this> group with <these> permissions?

Any help appreciated. Thanks.
Back to top
View user's profile Send private message
klieber
Administrator
Administrator


Joined: 17 Apr 2002
Posts: 3657
Location: San Francisco, CA

PostPosted: Mon Jun 03, 2002 6:18 pm    Post subject: Reply with quote

tyreth wrote:
How do I tell linux, that for every file or directory created under this particular directory, should belong to <this> group with <these> permissions?


Set the group ID on the parent directory. Then, make sure that parent directory is group-owned by <this> group.

So, if you have a directory, foo and a group named, bar, you would do something like the following:

Code:
# chown root.bar foo
# chmod -R 2770 foo


The "2" in the above command tells linux to use the group ID of the parent directory, rather than the group ID of the process writing the file. Obviously, change the "root" and "770" parts to suit your particular permissioning requirements.

Setting UID and GID on files and programs can expose your system to large security holes (such as normal users running programs as root) so use this feature with caution.

--kurt
_________________
The problem with political jokes is that they get elected
Back to top
View user's profile Send private message
tyreth
Apprentice
Apprentice


Joined: 27 May 2002
Posts: 238
Location: Melbourne, Australia

PostPosted: Mon Jun 03, 2002 11:44 pm    Post subject: Reply with quote

Thanks, it's keeping the group I set, but permissions still change by default to 554 for files that are newly created.

Any way I can tell it to keep 770 for newly created files?
Back to top
View user's profile Send private message
klieber
Administrator
Administrator


Joined: 17 Apr 2002
Posts: 3657
Location: San Francisco, CA

PostPosted: Wed Jun 05, 2002 4:03 pm    Post subject: Reply with quote

tyreth wrote:
Any way I can tell it to keep 770 for newly created files?


Yep -- set the umask correctly. man umask or do a google search.

--kurt
_________________
The problem with political jokes is that they get elected
Back to top
View user's profile Send private message
tyreth
Apprentice
Apprentice


Joined: 27 May 2002
Posts: 238
Location: Melbourne, Australia

PostPosted: Thu Jun 06, 2002 12:09 am    Post subject: Reply with quote

As far as I can tell umask does not do what I want.

It changes the permissions I use, but I want to change the default permissions of any user creating files in that directory.

I have a project that has it's own directory, with 2 people working on it. Every time either of us create a file it defaults to 744, I want it to go to 774 or 770 for every user that creates a file in that directory, not just me.
Back to top
View user's profile Send private message
klieber
Administrator
Administrator


Joined: 17 Apr 2002
Posts: 3657
Location: San Francisco, CA

PostPosted: Thu Jun 06, 2002 12:53 am    Post subject: Reply with quote

tyreth wrote:
I want it to go to 774 or 770 for every user that creates a file in that directory, not just me.


In the user's .profile (or .bash_profile or whatever) put:

Code:
#sets the umask for default permissions
umask 007


Change that to 'umask 003' if you want 774 default permissions.

AFAIK, you cannot limit default permissions to one directory -- it's defined on a per-user basis, through the use of umask in the users' profile

--kurt
_________________
The problem with political jokes is that they get elected
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum