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.

useradd

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

Sr.No

Option

Description

01

-d dir

Sets the home directory of the new user.

02

-D

Displays default for all settings.

03

-e mm/dd/yy

Sets an date for the account.

04

-f days

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

05

-g group

Sets a group.

06

-m

Creates user's home directory.it dose not exist.

07

-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.

08

-M

Does not create user's home directory.

09

-p password

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

10

-s shell

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

11

-u userid

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

usermod

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

userdel

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 removed.in 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!