Help - Search - Members - Calendar
Full Version: More File Permission Problems
Linuxhelp > Support > Technical Support
ishcoleobo
I made a previous post about file permissions and chown'ing the folder and so on and so forth. I am still having problems when new files are made. When we make a new file I need the permissions to be set automatically to 774 in stead of whatever it is setting it as. It won't let group members write to the file. Once again, I am using Red Hat 9.

Thanks for the help,
Russell
hughesjr
You need to set the umask of the user(s) to 0002.

You can set it in each users .bash_profile ... or if you want it set that way for every user on the system, you can remove any umask commands from the user's .bash_profile and set it in the system's bash setup file at /etc/bashrc. Since there is already a umask statement in the /etc/bashrc file (at least on my PC), that is where I would change it. My current /etc/bashrc says this:
CODE
if [ "`id -gn`" = "`id -un`" -a `id -u` -gt 99 ]; then
   umask 002
else
   umask 022
fi


(that has normal users (with a user ID of 100 or higher) with a umask of 002 and root or low id's [less than 100] have 022)

SO ... if you want users with high id's to create files with 664 then change it to this:

CODE
if [ "`id -gn`" = "`id -un`" -a `id -u` -gt 99 ]; then
   umask 0002
else
   umask 0022
fi


If your distro doesn't do /etc/bashrc ... then you can simply put the statement:

umask 0002

in each users .bash_profile.

To see what the users current umask is, type the command umask at the command prompt while logged in as that user.

The extra zero (0002 vice 002) is for created directories

notes:
... files will only be created as 664 because you can't use umask to create a file that has 777 ... even if umask is 0000, it will only create files with 666 (rw-rw-rw-) .. you must use chmod to make a file executable...
ishcoleobo
That did not work, the server is already set to do that. I tried both ways and had no luck. Any other ideas???
ishcoleobo
I found a solution surfing around the internet. Just for future problems, it was fixed by adding this to smb.conf [Shared] - section:

force group = staff

force create mode = 774
create mode = 774
force directory mode = 774
directory mode = 774

Almost what you guys said... just needed that force create line.

Again, Thanks for the help,
Russell
hughesjr
I didn't read your other post ... I thought the file creation problems where while logged in to the Linux machine not via samba from windows....sorry tongue.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2017 Invision Power Services, Inc.