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. Picture 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. Picture 2 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. Picture 3 of How to Manage Users in Linux
    Type passwd in the command line.
  2. Picture 4 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. Picture 5 of How to Manage Users in Linux
    Confirm the new password.
Method 3 of 4:

Removing Users

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

Usage

  1. Picture 9 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. Picture 10 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. Picture 11 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. Picture 12 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.
Update 04 March 2020
Category

System

Mac OS X

Hardware

Game

Tech info

Technology

Science

Life

Application

Electric

Program

Mobile