Why is the default umask value for useradd in openSUSE set to 022

permissionsumaskuseradd

I recently built a very simple test environment with openSUSE.

As I tried to configure a shared directory, without using ACLs, but with SetGID on that directory instead for some reason, I noticed that the default umask for every user is set to 022 (i.e. 755 on directories & 644 on files).

This is done in /etc/login.defs.

I am used to a umask 002 (i.e. 775 directories / 664 files) for normal users and 022 for the root-user instead.

Shall I change the umask value for useradd in the above mentioned file, if I want to set it as default for all future useradds and how can I change the umask for all existing users on my system (except the root account, of course)?

Best Answer

Answering the question in your subject: OpenSuSE uses the traditional Unix umask setting, instead of the Debian-inspired one adopted by some other Linux distributions.

Editing /etc/login.defs should be sufficient to change it; this will not affect users currently logged in, nor is there any way for you to force such a change to programs that are currently running. It will also not affect users who have overridden it in their ~/.profile (or .bash_profile, .login, etc. as per their shell).

useradd is not involved with this; it is a per-process setting and the default is set during login (hence login.defs and not /etc/default/useradd).

Related Question