Professional Documents
Culture Documents
Result:
Tom: x: 1000:1000:/home/Tom:/bin/bash
Result:
rtkit:x:172:172:RealtimeKit:/proc:/sbin/nologin radvd:x:75:75:radvd user:/:/sbin/nologin
chrony:x:994:993::/var/lib/chrony:/sbin/nologin
pulse:x:171:171:PulseAudio System Daemon:/var/run/pulse:/sbin/nologin
gdm:x:42:42::/var/lib/gdm:/sbin/nologin
gnome-initial-setup:x:993:991::/run/gnome-initial-setup/:/sbin/nologin
postfix:x:89:89::/var/spool/postfix:/sbin/nologin sshd:x:74:74:Privilege-separated
SSH:/var/empty/sshd:/sbin/nologin tcpdump:x:72:72::/:/sbin/nologin
Tom:x:1000:1000::/home/Tom:/bin/bash
4. To check top 10 lines of user's file
Result:
root:x:0:0:root:/root:/bin/bash
bin:x:l:l:bin:/bin:/sbin/nologin
daemon:x:2:2:daemon:/sbin:/sbin/nologin
adm:x:3:4:adm:/var/adm:/sbin/nologin
lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin
sync:x:5:0:sync:/sbin:/bin/sync
shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
halt:x:7:0:halt:/sbin:/sbin/halt
mail:x:8:12:mail:/var/spool/mail:/sbin/nologin
operator:x:ll:0:operator:/root:/sbin/nologin
Syntax:
[root@ local host ~]# passwd <username>
Result:
Tom:
$6$IWiNPPn9$uBA.bikWMOG7Z/VI.JOAZoYOzW07yph.3WzltdX2.urlqEchlxTIOPpWvpEQ
5 RZrm7rVm.ltB6rxhdPy/AWcN 1:16677:0:99999:7:::
Verification:
Open another gui console to login with new user
[root@localhost ~]# gdmflexiserver
Note: To check Tom user data move to root user console by using ctrl+alt+fl and check
in his home directory.
Verification:
[root@localhost ~]# Is /home/Tom
Desktop Downloads Pictures Templates zooml zoom2 zoom4 zoom6 zoom8 Documents
Music Public Videos zoomlO zoom3 zoom5 zoom7 zoom9
Syntax:
[root@localhost~]# usermod -u <uid> <username>
[root@localhost~]# usermod -u 2001 Tom
Verification:
[root@localhost~]# grep Tom /etc/passwd
Tom: x: 2001:1000: /home/Tom:/bin/bash
[root@localhost~]# su - Tom [Tom@localhost~]$ id
uid=2001(Tom) gid=1001(Tom) groups=1001(Tom)
context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.cl023
Syntax:
[root@localhost~]# usermod -c <comment> <username>
Verification:
[root@localhost~]# grep Tom /etc/passwd
Copying bash files from default directory into user home directory [root@local
host"]# cp -rvp /etc/skel/. /salesdept/Tom Verification:
[root@localhost~]# grep Tom /etc/passwd
Tom:x:2001:1000:"Manager of Sales Dept":/salesdept/Tom:/bin/bash
Syntax:
[root@localhost~]# usermod -s <new shell> <username>
Verification:
[root@local host"]# grep Tom /etc/passwd
Tom:x:2001:1000:"Manager of Sales Dept":/Salesdept/Tom:/bin/ksh
[root@localhost~]# su - Tom
$ echo $SHELL
/bin/ksh
$ exit
logout
Syntax:
[root@ local host ~]# usermod -I <new name> <old name>
[root@localhost ~]# usermod-I John Tom
Verification:
[root@localhost ~]# grep John /etc/passwd
John:x:2001:1000:Manager of sales dept:/salesdept/Tom:/bin/ksh Note: User home
directory will not be changed, only username will change
Verification:
[root@localhost ~]# grep John /etc/shadow
John:!
$6$xylJN65M$iK6FLYNX01DcBfmnc9Ea23MljYdggkdpwMH7qcA3m4ZrP0dgKmlhD
qr8Zh Y6gkmNy3scVrqazV2DjVvh.JZFL/: 16677:0:99999:7:::
Note: (!) Exclamation mark is a sign of Locked user
[root@localhost ~]# gdmflexiserver
Result:
Username John not displayed because that account has been locked
Syntax:
[root@localhost ~]# usermod -U <username>
[root(§> local host ~]# usermod -U John
Verification:
[root@localhost ~]# grep John /etc/shadow
John:
$6$xylJN65M$iK6FLYNX01DcBfmnc9Ea23MljYdggkdpwMH7qcA3m4ZrP0dgKmlhD
qr8Zh Y6gkmNy3scVrqazV2DjVvh.JZFL/: 16677:0:99999:7:::
Note: (l)Exclamation mark will be removed once the user account is unlocked.
Result:
Username John is displayed and by using that name user John can login
Syntax:
[root@localhost~]# useradd -u <uid> -c <comment> -d <newdir> -s <newshell>
<username>
[root@localhost~]# useradd -u 2002 -c "Admin" -d /salesdept/Ali -s /bin/csh AM
Verification:
[root@localhost~]# grep Ali /etc/passwd
Ali:x:2002:1003:Admin:/salesdept/Ali:/bin/csh
Syntax;
[root@localhost ~]# userdel <username>
[root@localhost ~]# userdel John
Verification:
[root@localhost ~]# Is /home
Note: User directory will not be deleted
[root@localhost ~]# grep John /etc/passwd Result:
No user properties are shown
Syntax:
[root@ local host ~]# userdel -r <username>
[root@localhost ~]# userdel -r Ali Verification:
[root@localhost ~]# Is /home
Note: User directory will also be deleted
[root@ local host ~]# grep Ali /etc/passwd
Result:
No user properties are shown
END