# Unable to change user umask



## nixdmon (Nov 3, 2017)

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.


```
me:\
        :umask=002:
```

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.


```
dload:\
        :umask=002:
```

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


Am I doing something wrong? Pointers will be appreciated.


----------



## SirDice (Nov 3, 2017)

The umask(1) is set in ~/.cshrc. Which overrules this as it's set after login.


```
# A righteous umask
umask 22
```


----------



## nixdmon (Nov 3, 2017)

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.

Thanks.


----------



## AndyUKG (Nov 3, 2017)

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).


----------



## SirDice (Nov 3, 2017)

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.


----------



## xavi (Nov 3, 2017)

SirDice said:


> tcsh(1) has nice features for interactive use.



And to see tcsh's interactive use in action you could try following the examples on this page.


----------

