User and Group management command

  • Create a new user account
[root@daddylinux~]# useradd uddika
[root@daddylinux~]# passwd uddika
Changing password for user uddika.
New UNIX password: ******
Retype new UNIX password: *****
passwd: all authentication tokens updated successfully.
  • Multisession Login(Users can login same time)
Alt+F2
Then give a username and password

Count the login users
[root@daddylinux~]# who
  • Changing your own password as a normal user
Login the account
[uddika@daddylinux~]$ passwd
Changing password for user uddika.
Changing password for uddika.
(current) UNIX password: ******
New UNIX password: *******
Retype new UNIX password: *******
passwd: all authentication tokens updated successfully.
  • How to change the password properties of a user
View the current password properties
[uddika@daddylinux~]$ chage -l uddika

Change the current password properties
[root@daddylinux~]# chage uddika
  • The things that happened automatically once you create a user account
Every user will get a private home folder
[root@daddylinux~]# ls -l /home

Every user will get a private group account
Username = Uddika Private Group name = Uddika

Every user will get a user id (uid) and group id (gid)
[root@daddylinux~]# id Uddika

The user account database and the group account database will be automatically updated
  • User account database
View the user account database
[root@daddylinux~]# cat /etc/passwd |more

Display last 10 records
[root@daddylinux~]# tail /etc/passwd

Display last 5 records
[root@daddylinux~]# tail –n5 /etc/passwd
  • Group account database
View the group account database
[root@daddylinux~]# cat /etc/group |more
[root@daddylinux~]# tail /etc/group
  • How to delete user account
View the current account
[root@daddylinux~]# tail /etc/passwd

Delete with home folder
[root@daddylinux~]# userdel –r username

Delete without home folder
[root@daddylinux~]# userdel username

Verify the account
User account - [root@daddylinux~]# tail /etc/group
Home folder -  [root@daddylinux~]# ls -l /home
  • Deleting Groups
View current groups
[root@daddylinux~]# tail /etc/group

Delete the group
[root@daddylinux~]# groupdel groupname

Verify group
[root@daddylinux~]# tail /etc/group

2 comments:

Post a Comment