0

In my system I set the umask for the user root to 0077 and for the non-root users to 0027 (via /etc/profile). This is working for the normal terminal logins. But if I login as root and change user with su command like this:

su user
umask
0077

I get the 0077 umask instead of 0027. Is this normal behavior? how can I configure my umask 0027 setting for the su command to 0027? My default shell for the non-root users is the dash not the bash

  • are you using ubuntu ? – Wissam Roujoulah Dec 5 '16 at 11:17
  • No its a Yocto build Linux system – Oliver G. Dec 5 '16 at 11:18
1

You could run su - user to get a login shell which probably will read /etc/profile.

0

The problem is when you switch the use it doesn't source the profile file so you have to put the umask command in place the will be sourced every time you switch the user.

Usually for setting a umask for every user individually we put it in ~/.bashrc because it will be sourced every time you open new session for the user but in your case you have to look in you ~/.bashrc file and figure out which file it source from /etc/ when it called for example in CentOS the file is /etc/bashrc will be called every time by ~/.bashrc

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.