/etc/passwd : all users and accountt data /etc/shadow /etc/group
0: Root id
1-99 are traditionally reserved for special system users (sometimes called pseudo-users), such as wheel, daemon, lp, operator, news, mail, etc.
1-200: system processes (Redhat)
201-999: system users that uses system process but don't own file on the system
1000 - : system users
whatis id
id milad
id -u
id -un
id -g
id -gn
id -G
id -Gn
id -g milad
useradd -mM -c "Milad As" -g [primary group id] --skel SKEL_DIR -s /bin/bash -u UID -e Y-M-D milad
-U create a same group as username and add user to it
-m create home dir
-M do not create home directory
-d home dir
/etc/skel Default SKEL_DIR
/etc/default/useradd Default settings
usermod -L milad # lock # Adds a ! in shadow file password field
usermod -U milad # unlock
-a, --append append the user to the supplemental GROUPS
-m, --move-home move contents of the home directory to the
# Change user password
passwd # Current user
passwd username
/usr/sbin/nologin - to prevent login
# have look at:
/etc/shadow
milad:x:17032:0:99999:7:::
user : passHash : lastPassCh : DayToAllowPassCh : DayToRequirePassCh : warnBeforeExpire : activeAfterExpire : expireDate
/etc/login.defs - shadow password suite configuration
ex: how many day to change pass or shoud change pass
man 5 login.defs
chage - change user password expiry information
chage -l milad
chage -E [`date -d "+10day" +%F` | -1 to remove]
groupadd
groupmod
groupdel
gpasswd
getent group sudo
groups milad
cat /etc/group | grep milad | wc -l
mkdir test
ls -lhd test
chgrp adm test
ls -lhd test
chown :milad test
ls -lhd test
chgrp adm test
cd test
touch newfile.txt
ls -lhtrFA
newgrp adm
touch newfile2.txt
ls -l
chmod g+s test/
# inharite parent directory group
ipynb
format: https://github.com/ravexina/linux-notes. html
exports of project available at: https://ravexina.github.io/linux-notes.Linux Notes by Milad As (Ravexina) is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.