Linux User Management

This article describes how to manage users in Linux. The commands in this article are based on how it is done in Red Hat Enterprise Linux (or derivatives). It might be different on other distributions, so check your distributions documentation.

1. Create users

To create a user with name username and the default home directory /home/username, use the useradd command:

useradd username

If you want to specify the full name of the user you can do that this way:

useradd -c "Firstname Lastname" username
2. Set user password

To set the password of the user, use the following command:

passwd username
3. Delete users

To delete a user you can use the userdel command. This command removes the user, but does not delete the users home directory:

userdel username

If you want to also delete the home directory when you delete the user, then use the following command:

userdel -r username

Posted

in

by

Tags: