useradd with 755 permissions
I d like to set the home directories permissions as 755 when i add the user via useradd.
How can i do this?
Thanks.
Solution 1:
Look at the UMASK parameter in /etc/login.defs:
UMASK (number) The permission mask is initialized to this value. It is used by useradd and newusers for creating new home directories. If not specified, the permission mask will be initialized to 0077.
(from man login.defs
)
This is a mask, so the default of 0077 will give you home directory permissions 700, 0022 will give 755.
Interestingly, OpenSuse uses 0022 by default.
If you want to change the default permissions for the files your users create in their home directories, you need the umask
command. This can be run from /etc/profile for example.
Solution 2:
I know its a quite old post, however:
useradd -K UMASK=0077
Solution 3:
I believe this is the answer for your question :
/etc/login.defs
here you can define default values for useradd.
--
Regards,
Robert