Creating and Deleting Users

Creating Users

When a Linux system administrator creates a user, an entry is created in etc/passwd for the user. The system also creates a directory, labeled with the user’s username, in the /home directory. For example, if you create a user named syuhada, the user’s home directory is /home/syuhada.

After creating a user, you must also create the user’s initial password with the passwd command:

Enter the new password twice. If you do not create an initial password for a new user, the user cannot log in.

The adduser command has many command-line options. The command can be used to set policies and dates for the new user’s password, assign a login shell, assign group membership, and other aspects of a user’s account.

See man adduser as well.

Deleting Users

Use the deluser command to delete users from your system. This command removes a user’s entry in the system’s /etc/passwd file. You should also use the command’s–remove-all-files and –remove-home options to remove all the user’s files and directories (such as the user’s mail spool file under /var/spool/mail):

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s