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
-
Type adduser -d /home/users/ into the command line.- Example: adduser bob -d /home/users/bob
-
Type passwd and press return to set a password for the new user.- Type the new password.
- Confirm the password.
Method 2 of 4:
Modifying Users
Changing Passwords
-
Type passwd in the command line. -
Enter the new password for the user.- Note: the cursor will not move however your password is being typed.
-
Confirm the new password.
Method 3 of 4:
Removing Users
-
Type userdel into the command line to delete a user.- Example: userdel bob
-
Type userdel -r to also delete their home folder and files.
Method 4 of 4:
Sudo and Su
Terms
- sudo: Switch User and Do
- Executes a command as root or another use while maintaining your current session.
- su: Switch User
- Switches your session to another user.
- Switches your session to another user.
Usage
-
Type sudo before a command to execute the command as the root user. You will be prompted for a password.- Example: sudo apt-get install telnet
-
Type sudo before a command to execute the command as another user on the system. You will be promoted for that users password.- Example: sudo bob telnet localhost 22
-
Type su to switch your command line session to the root user. You will be promoted for a password.- Type logout to switch back.
-
Type su to switch your command line session to another user. You will be promoted for their password.- Type logout to switch back.
5 ★ | 1 Vote
Read More
- How to manage Linux services using Systemd
- How to Install and Use Fonts in Linux
- How to manage and restore Tmux sessions in Linux
- 8 commands for efficient management of Linux processes
- How to manage memory to restrict Linux to use too much RAM
- Guide to network operation for Linux users: 11 commands to know
- How to modify and manage Hosts files on Linux
- Instructions for installing software and applications on Linux
- How to manage packages on RPM-based Linux distributions with DNF
- How to Launch Programs from Command Line on Linux
- 9 most popular Linux package managers today
- 7 ways to run Linux software on Windows
- How to check and manage disk space in Linux
- How to find, set and change IP addresses on Linux