Clear, practical technology insights About · Contact

How to Manage Users in Linux

Unlike Windows, as a Unix-like system, Linux was conceived of as a multi-user system from its inception. The following sections deal with user management through the Linux command line. Type adduser -d /home/users/ into the command line.

Author: Micah Soto2 minutes read
Table of Contents
Method 1 of 4:

Adding Users

  1. images 1 of How to Manage Users in Linux
    Type adduser -d /home/users/ into the command line.
    1. Example: adduser bob -d /home/users/bob
  2. images 1 of How to Manage Users in Linux
    Type passwd and press return to set a password for the new user.
    1. Type the new password.
    2. Confirm the password.
Method 2 of 4:

Modifying Users

Changing Passwords

  1. images 1 of How to Manage Users in Linux
    Type passwd in the command line.
  2. images 1 of How to Manage Users in Linux
    Enter the new password for the user.
    1. Note: the cursor will not move however your password is being typed.
  3. images 1 of How to Manage Users in Linux
    Confirm the new password.
Method 3 of 4:

Removing Users

  1. images 1 of How to Manage Users in Linux
    Type userdel into the command line to delete a user.
    1. Example: userdel bob
  2. images 1 of How to Manage Users in Linux
    Type userdel -r to also delete their home folder and files.
Method 4 of 4:

Sudo and Su

Terms

  1. sudo: Switch User and Do
    1. Executes a command as root or another use while maintaining your current session.
  2. su: Switch User
    1. Switches your session to another user.
      images 1 of How to Manage Users in Linux

Usage

  1. images 1 of How to Manage Users in Linux
    Type sudo before a command to execute the command as the root user. You will be prompted for a password.
    1. Example: sudo apt-get install telnet
  2. images 1 of How to Manage Users in Linux
    Type sudo before a command to execute the command as another user on the system. You will be promoted for that users password.
    1. Example: sudo bob telnet localhost 22
  3. images 1 of How to Manage Users in Linux
    Type su to switch your command line session to the root user. You will be promoted for a password.
    1. Type logout to switch back.
  4. images 1 of How to Manage Users in Linux
    Type su to switch your command line session to another user. You will be promoted for their password.
    1. Type logout to switch back.

Was this article helpful?

Your feedback helps us improve.

Discussion

Reader Comments 0

Sign in with email or Google to join the discussion.