Unable to change user umask

Hi All,

I've been trying to change umask of a local user. I've looked around for instructions, and tried adding umask in .login_conf in user's home directory.


Also ran cap_mkdb .login_conf after modification. umask remains 022, unchanged.

In addition, I've changed it in main login.conf. Didn't work either.


Changed it in .shrc to 002. As user uses sh shell.

Am I doing something wrong? Pointers will be appreciated.
The umask(1) is set in ~/.cshrc. Which overrules this as it's set after login.

# A righteous umask
umask 22
Thanks SirDice,

First up, I am a big fan of yours and DutchDaemon. Whenever I am troubleshooting a problem and I come across your posts, I try your suggestion without a thought. Cause you guys know your ship :). Thanks for supporting Freebsd forums. This place would not be the same without you guys.

Back to the query --> I changed it in .cshrc as well, but didn't mention it. It didn't work. Based on your suggestion, I changed shell to csh and it works now. Not sure if this is a bug, but its working fine in csh shell.

Hi, the issue is that each shell reads in config from different files. So the FreeBSD sh uses .profile, csh uses .cshrc (amoungst others) and bash uses .bash_profile (amoungst others).
Yep, that's probably the issue. Different shells use different configuration files, I assumed you were using csh(1) or tcsh(1). What you could do is set it in login.conf and remove any umask(1) commands from the various configs. When you login you'll get the umask(1) via login.conf but after that the shell's startup files overrule this.

When you remove umask(1) from the shell's scripts, don't forget the files in /usr/share/skel. These files are copied to a user's home directory when you create a new user.

For a normal user I can recommend using tcsh(1) instead of sh(1). The latter is a bit spartan, tcsh(1) has nice features for interactive use.