Page 37 - RHEL8 BOOK
P. 37
gpasswd-With this command we can to assign the password to existing group as well as we can add and
remove the Secondary members of the group.
6. To add user in a group as a primary user
[root@sun ~]#useradd aftab
[root@sun ~]#useradd –g Aftab ali
[root@sun ~]#useradd –g Aftab aman
[root@sun ~]#usermod –g g3 Aftab
7. Assign the password to the group
[root@sun ~] # gpasswd <group name>
[root@sun ~] # gpasswd g3
8. Adding user to group
[root@sun ~]#useradd u1
[root@sun ~]# gpasswd <options> <group name>
[root@sun ~]# gpasswd -a u1 g3
9. Adding multiple users to the group
[root@sun ~]#useradd u2
[root@sun ~]#useradd u3
[root@sun ~]# gpasswd -M u2,u3 g3
10. Remove user from the group
[root@sun ~]# gpasswd -d u1 g3
11. Adding and Removing the secondary Members
[root@sun ~] #useradd -G <group name> <user name>
[root@sun ~] #useradd -G g3 ali
[root@sun ~] #usermod –G g3 ravi
groupdel -The group is empty or maintain the secondary users we can delete the group “ g3”. In case the
group maintain single primary user then we cannot delete the group “g3”
[root@sun ~]# groupdel <groupname>
[root@sun ~]# groupdel g3
12. To see the password details of user
[root@sun ~]# chage <option> <username >
[root@sun ~]# chage -l username
Last password change : Oct 09, 2011
Password expires : never
Password inactive : never
Account expires : never
Minimum number of days between password change : 0
Maximum number of days between password change : 99999
Number of days of warning before password expires : 7
S. Pradhan
(MCA, MBA-IT, BCA, CCNA, MCSA 2012, RHCE, ETHICAL HACKING)
Email Id:-spradhan.iiht@gmail.com
37