create/delete users in CentOS

This tutorial demostrates how to create/delete users in Centos.
Use following command to create user in CentOS. before creating an users, you should be logged into the CentOS using your root account. Otherwise you can not create user accounts.

useradd username

Example :
useradd etutionlk

Use following linux command to delete existing user in CentOS.

userdel username

Example
userdel etutionlk



You have created an user in CentOS. you can create password for newly created user.Use following command to add password to your newly created user. It prompts you to type your password.

passwd username

Example
passwd etutionlk

Remember that above command does not delete user's Home folder. It deletes only the user account. To delete Users with the home directory, Use following command.

userdel -r username

Example
userdel -r etutionlk

Use Following Command to add users with specific user id.

useradd -u user_id username

Example

useradd -u 123 etutionlk2

Use Following command to add user without home directory.

useradd -M username

Example

useradd -M etutionlk3

Use following command to add user with Account expire date.

useradd -e data username

Example

useradd -e 2015-06-20 etutionlk3

to check user Account expire date use following command.

chage -l etutionlk3 

Use Following command to user account with password expire date.

useradd -e date -f no_of_days username

Exapmle
useradd -e 2015-06-20 -f 45 etutionlk3

Have A Nice Day !

0 comments:

Post a Comment

Ask anything about this Tutorial.