Linux Add and Remove User

Linux also provides the useradd,usermod,anduserdel command to manage user accounts.all these commands take in thir information as options on the command line.if an option is not specified,they use predetermined default values.these are command line operations.

to use them on your desktop you first need to open a terminal window(right click the desktop and select open terminal),and then enter the commands at the shell prompt.


with the useradd command,you enter values as option on the command line,such as the name of a user,to create a user account.then it creates a new login and directory for that name using all the default features for a new account.

#useradd bharat

useradd Command Option





-d dir

Sets the home directory of the new user.



Displays default for all settings.


-e mm/dd/yy

Sets an date for the account.


-f days

Sets the number of days an account remains active after its password expires.


-g group

Sets a group.



Creates user's home dose not exist.


-m -r skl-dir

sets the skeleton directory that holds skeleton files.such as .profile file which are copied to the user's home directory automatically when it is created,default is /etc/skel.



Does not create user's home directory.


-p password

Supplles an encrypted password(crypt or MD5).with no argument,the account is immediately disabled.


-s shell

sets the login shell of the new user.the is /bin/bash by default.the BASH shell.


-u userid

sets the user ID of the new user.the default is the increment of the gighest number used so far.


The usermod command enables you to change the value for any of these can change the home directory or the user can even change the username for the account.the usermod command takes the same options as useradd


When you want to remove a user from the system,you can use the userdel command to delete the user's login.with the -r option,the user's home directory will also be the next example,the user bharat is removed from the system.

#userdel -r bharat

Share Share on Facebook Share on Twitter Share on LinkedIn Pin on Pinterest Share on Stumbleupon Share on Tumblr Share on Reddit Share on Diggit

You may also like this!