SAGARFIVE

Linux Users – Create/Delete/Modify

1 Create user – w/o password login as root user useradd <username>
2 Create user – w/o password – as normal user with sudo sudo useradd <username>
3 To add password to user as root user passwd <username>
4 To add password to user as normal user – with – sudo sudo passwd <username>
5 Create User with uid ( select 4 digit ) useradd -u <uid> <username>
6 Create user with groupid useradd -g <group id> <username>
7 Create user with comment Useradd -c <comment> <username>
8 Create user with home directory useradd -d <directory> <username>
9 Create user with different shell useradd -s <bin/sh> <username>
10 Create User with all details :
useradd -u 1451 -g 1000 -c ggluser -d /home/ggluser -s /bin/sh ggluser
11 Create user with expire date useradd -e 2022-10-10 <username>
12 Delete user userdel <username>
13 Delete user with home directory userdel -r <username>
14 Default assigned values for new user to be created useradd -D
15 Modifying the existing user Usermod -c <comment> <username>
16 Modify the user home directory with data usermod -d <dir> -m <username>
17 Modify the user id and groupid usermod -u <uid> -g <gid> <username>
18 Modify username usermod -l <new name> <old name>
19 Modify normal user to root user(sudo group :wheel) usermod -aG wheel <username>
20 To add group with groupid groupadd -gid 1458 <group name>
21 To verify that group created  getent group | grep <group name>