Latest LQ Deal: Latest LQ Deals
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 07-16-2008, 05:14 PM   #1
Registered: Sep 2004
Location: USA
Distribution: red hat, fedora & centos
Posts: 202

Rep: Reputation: 30
Umask Per Dir

I am trying to share a dir between several users whom I added all to same group. by sitting the GUID on the shared folder all newly created folders/files owned by that group but the system wide umask is 0022 - so when a new file is created its permission is "rw r r" - is there a way to get around this issue and have all newly created files be writable by the group as well.
Old 07-16-2008, 05:36 PM   #2
LQ Guru
Registered: Feb 2003
Location: Mineral, Virginia
Distribution: Debian 8
Posts: 7,877

Rep: Reputation: 318Reputation: 318Reputation: 318Reputation: 318
I don't think that the umask can be set for a directory. It can be set per user.

You can set the umask for individual users in /home/user/.bashrc or /home/user/.profile (the file used varies from distribution to distribution). Put this command in /home/user/.bashrc for each member of the group which shares the directory:

umask 002

This does not do exactly what you asked. Now each user will create all directories with permissions 775 and all files with permissions 664. This includes all files and directories in the shared directory and all files and directories outside of the shared directory. That may or may not be acceptable as a solution to your problem.

Steve Stites
Old 07-16-2008, 06:18 PM   #3
Mr. C.
Senior Member
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 63
To clarify a bit more, umask is a per-process setting, having nothing to do with the file system itself. Rather, each process starts with the umask of its parent process (in your case, likely the shell). An application may change its own umask, and there are no restrictions on this. The umask is simply a mask that zero's portions of the default file creation modes (in open(), creat()).

You would need a special "shell" to prevent a user from changing their own shell process' umask, but it would also have to control which programs could be exec'd, etc. This gets into a more restrictive shell (like rsh, the restriced mode of the shell, not remote shell)..

Last edited by Mr. C.; 07-16-2008 at 06:30 PM.
Old 07-16-2008, 06:45 PM   #4
Senior Member
Registered: Dec 2005
Location: Massachusetts, USA
Distribution: Ubuntu 10.04 and CentOS 5.5
Posts: 3,873

Rep: Reputation: 335Reputation: 335Reputation: 335Reputation: 335
Ignore this.


permissions, share, umask

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
rsync -u Does it update the contents of a dir if that dir is changed? crazyivan Linux - Software 1 04-02-2008 03:08 AM
Command to display /dir, /dir/sub, /dir/sub/files knockout_artist Linux - Newbie 9 10-25-2007 02:57 PM
Share configuratin dir (.dir) for 3 accounts on local computer LiNuXkOlOnIe Linux - Software 5 01-08-2006 03:36 AM
chmod + umask for a whole dir tree Ephracis Linux - Security 2 08-15-2005 06:55 PM
howto make a dir shared that is not in my home dir Schmurff Linux - Newbie 2 06-19-2004 07:54 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:21 AM.

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