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.
Method 1 of 4:

Adding Users

  1. How to Manage Users in Linux Picture 1How to Manage Users in Linux Picture 1
    Type adduser -d /home/users/ into the command line.
    1. Example: adduser bob -d /home/users/bob
  2. How to Manage Users in Linux Picture 2How to Manage Users in Linux Picture 2
    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. How to Manage Users in Linux Picture 3How to Manage Users in Linux Picture 3
    Type passwd in the command line.
  2. How to Manage Users in Linux Picture 4How to Manage Users in Linux Picture 4
    Enter the new password for the user.
    1. Note: the cursor will not move however your password is being typed.
  3. How to Manage Users in Linux Picture 5How to Manage Users in Linux Picture 5
    Confirm the new password.
Method 3 of 4:

Removing Users

  1. How to Manage Users in Linux Picture 6How to Manage Users in Linux Picture 6
    Type userdel into the command line to delete a user.
    1. Example: userdel bob
  2. How to Manage Users in Linux Picture 7How to Manage Users in Linux Picture 7
    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.
      How to Manage Users in Linux Picture 8How to Manage Users in Linux Picture 8

Usage

  1. How to Manage Users in Linux Picture 9How to Manage Users in Linux Picture 9
    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. How to Manage Users in Linux Picture 10How to Manage Users in Linux Picture 10
    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. How to Manage Users in Linux Picture 11How to Manage Users in Linux Picture 11
    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. How to Manage Users in Linux Picture 12How to Manage Users in Linux Picture 12
    Type su to switch your command line session to another user. You will be promoted for their password.
    1. Type logout to switch back.
5 ★ | 1 Vote