Results 1 to 2 of 2
Enjoy an ad free experience by logging in. Not a member yet? Register.
- Join Date
- Feb 2009
How to change umask for files created in ext2/ext3
I have ext3 partition mounted on /mnt/shared/ as follows
$ cat /etc/fstab .. /dev/sda12 /mnt/shared ext3 noauto,users,noatime 0 2 .. $ ls -l /mnt/ .. drwxrwsr-x 3 root users <..> shared ..
Goal is to have all files created on the fs
1) to belong to group 'users' and
2) to have this groups permissions set to rw (rwx for directories)
so that all users who belong to group 'users' have full read/write access to data and
everyone else to have only read access.
Now because of setgid bit (s) in group permissions every file created has group 'users' and additionally setgid bit is set for directories. Because every users umask by default (on my system) is set to 0022 all created files will have permissions 644 for ordinary files and 755 for directories.
Net result of above means that users A and B who both belong to group 'users' won't be able to modify files created by the other.
So how can I make files created on the fs to be created always with umask 0002 WITHOUT changing default umask for users that is used elsewhere (like in their home directory) ?
Any ideas ?
then change recursively the group ownership of / by typing :
sudo chgrp -R 'users' /usr
Now, all the files and directories that are located in the /usr belongs to group 'users'. Now let's put the rights to that group by typing :
sudo chmod -R u=g,g=rwx,o=a,a=r /usr
Now, all members of the group 'users' can read write and execute file from /. Users that are not in the group 'users' can only read. If so, then newly created file will belongs to the user from the group 'users' and won't be editable by other groups, but they will be able to read those files.
I think it's what you wanted.