top of page
Writer's pictureMukesh Chanderia

Linux Commands Part 15 - RPM passwd

Updated: Aug 21, 2021

To query if package is installed or not

[root@RedHat MyData]# rpm -qa zip

zip-3.0-23.el8.x86_64


[root@RedHat MyData]# rpm -qa unzip

unzip-6.0-43.el8.x86_64


Let's understand file "/passwd"

[root@RedHat ~]# cat /etc/passwd


root:x:0:0:root:/root:/bin/bash --> Total 7 Fields

root -⇾ login name

x -⇾ Password Pointer (x means password is set)

0 -⇾ User Id

0 -⇾ Group Id

root ⇾ Comment

/root -⇾ home directory

/bin/bash -⇾ login shell


[root@RedHat ~]# cat /etc/shadow | grep admin


admin:$6$STGdn7J1zBQMEfOt$aNKAJI.11RwA05VNwxR37ggN0wesSwzux6ue.dgc6bD1oD/73cmv24oQ4NINwO4e49HvWaxjEeOAtD3BmIHqs0:18642:0:99999:7::: -⇾ Total 9 fields


Password of user admin

Password Policy


[root@RedHat ~]# cat /etc/group

root:x:0:admin -⇾ Total 4 fields

root -⇾ Group name

x : Group password is set (/etc/gshadow)

0 -⇾ Goup ID

admin -⇾ Now all the user's belong to that group will appear in last field


[root@RedHat ~]# cat /etc/gshadow

root::: -⇾ Total 4 fields just like /etc/shadow

Group name

password

admin user of group

Normal users


Note : user's email information i.e. what he receives and send is stored in /var/mail/root

This can be used to find how many users are available


[root@RedHat mail]# ls /var/mail


admin mukesh packer udaipur


Note : user file in /var/mail will present even if user is deleted.


So if you want to remove all data associated with user the use "rf"


[root@RedHat mail]# userdel -rf udaipur

[root@RedHat mail]# ls /var/mail

adminji mukesh packer


Use command "ID Root" to find id of user


[root@RedHat ~]# id root

uid=0(root) gid=0(root) groups=0(root)

[root@RedHat ~]# id admin

uid=1001(adminji) gid=1001(admin) groups=1001(admin),4(adm),190(systemd-journal)


Points to remember :


User password is stored in /etc/shadow

Group password is stored in /etc/gshadow

75 views0 comments

Comments


bottom of page