Table of Contents
Create Sudo User on Debian
sudo is a Linux command which provides a mechanism for allowing administrator privileges to a normal user. In this tutorial, you are going to learn how to create sudo user on Debian.
Before you start to create sudo user on Debian. You must have the root user account credentials of your system.
Create a new
First Log in to the server as a root user.
ssh [email protected]_ip_address
Now to create a new user account we will use here,
adduser command. To add new user run below command replacing
NEW_USERNAME with the username you want to add.
Here you will be prompted to enter the password for the user you want to create and confirm it. Enter a strong password for the new user you are creating:
New password: Retype new password: passwd: password updated successfully
Now after setting the password, it will create the HOME directory for the user saving some configuration files. Then it will ask you some more information about that user.
Changing the user information for username Enter the new value, or press ENTER for the default Full Name : Room Number : Work Phone : Home Phone : Other : Is the information correct? [Y/n]
To add newly created user to
sudo group you should use
usermod -aG sudo NEW_USERNAME
Test the sudo user access
Now you switch to new account using
su command to do so run below command:
su - NEW_USERNAME
Then run command
whoami to confirm sudo access:
If you have sudo access then you will get below output:
How to use sudo
You can only use sudo account to display contents of
sudo ls -la /root
Now enter the password of the new user to get the list of files:
[sudo] password for username:
You have successfully learned how to create sudo user on Debian. If you have any queries regarding this then please don’t forget to comment below.