LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   group and file rw permissions (https://www.linuxquestions.org/questions/linux-newbie-8/group-and-file-rw-permissions-576405/)

Cichlid 08-11-2007 04:41 PM

group and file rw permissions
 
Hi All,

With the help of setfacl and chmod 2770 I have been able to accomplish half of my goal.

My goal: have twoo separate users write to a group specific directory where new files created by either user will be rw-rw----.

Currently, when either user creates a file is reads: rw-r--r--. Not what I want.

Any help would be greatly appreciated.

stress_junkie 08-11-2007 06:44 PM

You want to use the umask utility to set the default file creation permission. This is done when a user account logs in. The log in process involves automatically running some scripts that set up the user's environment. These files include but are not limited to /etc/bashrc and /etc/profile. Different distributions do this in different ways. My distribution has a directory /etc/profile.d with a bunch of scripts. Then the file /etc/profile runs all of the scripts in the /etc/profile.d directory. So I created a file called /etc/profile.d/z-myprofile.sh to set the umask and any other things that I want to do to a user's environment. This is the code to set the umask to what you want.
Code:

umask 027

Cichlid 08-12-2007 02:22 PM

Thanks a lot for your help.

I'm curious though, from what I understand, changing the umask in the etc/profile it will affect all users. Is this correct? Is there a way to use umask for certain users on a particular directory?

stress_junkie 08-12-2007 07:54 PM

Quote:

Originally Posted by Cichlid (Post 2856537)
Thanks a lot for your help.

I'm curious though, from what I understand, changing the umask in the etc/profile it will affect all users. Is this correct? Is there a way to use umask for certain users on a particular directory?

You can specify which users have their umask reset by using bash logic. The umask cannot be controlled based on directory. This line will set the umask for user accounts that are in the mygroup user group.
Code:

test "`groups | grep mygroup`" && umask 027
The default setting of 022 is stupid. I always set the umask of user logins to 027 or 077. You should not want "others" to have any access to files that a normal user creates.


All times are GMT -5. The time now is 06:24 AM.