[ALUG] User management on Linux/Unix

Andreas Tauscher ta at lonestar-bbs.de
Mon Apr 15 16:28:09 EAT 2013


Am 15.04.2013 14:01, schrieb Hamisi Jabe:
> 
> Dear All,
> 
> How to add users on linux/unix with the default rights of 700 to be
> automatically. i have tried to check the file /etc/default/useradd but it
> doesn't give any information on setting  the user rights

If you want to set the mask for the home directory created adjust
DIR_MASK in /etc/adduser.conf
If you want all files the user created with 700 add
umask 0007
to ~/.profile
or for all new users created to /etc/skel/.profile

A check if the user is a regular user might be usefull. Some system
tools/daemons might not work like expected when the umask is changed.
Normal users are created with in a uid between 1000 and 29999 on debian
systems.
So something like:

ID=`id -u -r`
if ((1000<=$ID && $ID<=29999)
 then umask 0007
fi
unset ID

Will change the umask only if the real id is between 1000 and 29999.

Andreas


More information about the Linux mailing list