User Access and Privileges
Managing User Access and Privileges in Linux
This guide will walk you through logging in as the root user, adding new users, and granting root privileges to those users.
1. Login as the Root User
To switch to the root user, use the su
command:
1
su root
You will be prompted to enter the root password. After successfully entering the password, you will be logged in as the root user.
2. Adding a User
a. If the User Does Not Exist
To add a new user, use the adduser
command followed by the desired username:
1
adduser username
For example:
1
adduser jon
This command will create a new user named “jon” and prompt you to set up a password and other user information.
b. If the User Already Exists
To add an existing user to the sudo
group (which grants the user administrative privileges), use the following command:
1
sudo adduser jon sudo
3. Granting Root Privileges to a User
To give a user root privileges, edit the /etc/sudoers
file by running:
1
visudo
This command opens the sudoers
file in the default text editor. Look for the line that specifies root privileges:
1
root ALL=(ALL:ALL) ALL
After the root user line, add a new line for your user in the same format to grant them administrative privileges:
1
jon ALL=(ALL:ALL) ALL
Replace “jon” with the actual username you want to grant root privileges. Save and close the file.
This completes the process of logging in as root, adding users, and granting them root privileges. If you encounter any issues or need further assistance, feel free to ask for help.
This guide provides a basic understanding of managing users and their privileges on a Linux system.