How to add user and group in Linux -
1. To add a group in Linux server - (Suppose I have to add admin named group)
[root@amiteshjsk home]# groupadd admin
Verify group name which you added recently -
admin:x:1001:
where group id is - 1001
group name is admin
2. Now we can add user in this group -
[root@amiteshjsk home]# useradd -m -g admin, -c "Amitesh Sharma amiteshjsk@hotmail.com UNIX Team" -s /bin/bash amiteshjsk
where-
-g to assign to a group
-c to define values in captions
-s to define shell
Now we can set a password-
Changing password for user amiteshjsk.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
[root@amiteshjsk home]#
For Non-expiry password-
#passwd -x 99999 amiteshjsk
To check password or details-
#chage -l amiteshjsk
To reset the password in first login -
#chage -d 0 amiteshjsk
Check entry in /etc/passwd -
amiteshjsk:x:1001:1002:Amitesh Sharma amiteshjsk@hotmail.com UNIX Team:/home/amiteshjsk:/bin/bash
Very infofmative
ReplyDelete