[KLUG Members] Default umask problem on Red Hat 9?

Robert V. Kanaley rvk at agdia.com
Fri Dec 2 12:27:11 EST 2005


Greetings and Happy Holidays to all.


On a Red Hat 9 Samba server (Samba 2.2.7a), I found that one of my WinXPP
users was creating directories with perms of 2755 instead of 2775. With
perms of 2755 members of the users group cannot save files in the
directories created by this user.

In smb.conf the directory mode = 0775.

My first guess was that the directory mode was defeated by a system default
user umask of 0022. As I normal user I logged into the system:
-bash-2.05b$ umask
0022

I believe that this should be 0002.

I checked for the default umask setting in /etc/bashrc. This seems to have
the correct code to set the umask for root as 022 and non-root users as 002.

if [ "`id -gn`" = "`id -un`" -a `id -u` -gt 99 ]; then
    umask 002
else
    umask 022
fi

But, if I login as a normal user then su - to root, I find umask is set just
the opposite of what I would expect:
-bash-2.05b$ id -u
515
-bash-2.05b$ umask
0022

bash-2.05b$ su -
Password:
root at aphid root]# id -u
0
[root at aphid samba]# umask
0002

I don't find anything in /etc/profile that would reset the umask, and most
of the samba users do not have a ~/.bash_profile, ~/.bash_login, ~/.profile,
or $HOME/.inputrc that could reset the umask.

I tried editing /etc/bashrc to simply set the umask to 0002. Strangely when
I subsequently log off and log on as a normal user, I still had a umask of
0022!

A strange twist: If I login to the Samba server as a normal user and mkdir
test1 in my home directory, the perms are 755 as would be expected with the
umask of 0022. But, if I connect to the samba server from a Win98 computer
and use Explorer to create a folder, test2, I get perms of 775!

This suggests that smbd is running as root and uses the umask of 0002 when
Explorer connects to the samba server to create directories. However, this
doesn't explain why on a WinXPP box using Explorer, the user would only be
able to create directories with perms of 755.

Perhaps this means I need to upgrade the Samba from 2.2.7a to support WinXP.

Does anyone have any suggestions on how I can fix this directory creation
problem?


Regards,

Bob

Robert V. Kanaley
Manager Information Systems
Agdia, Inc.
rvk at agdia.com
http://www.agdia.com



More information about the Members mailing list