How to Create Sudo User on Debian
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.
How to Install Netbeans on Ubuntu 18.04
How to Install WebStorm on Debian 10
How to install LAMP stack on Ubuntu 18.04
How to Recursively Search all Files for a String in Linux
Secure Nginx with Let’s Encrypt SSL on CentOS 7
How to Install Mozilla Firefox on Ubuntu 18.04
Easily Quit Vim/Vi Without Saving Changes Command
How to Install Go on Linux Mint 19
How to Install Anaconda on CentOS 7
How to Install Docker Compose on Ubuntu 18.04
How to Remove Docker Images, Networks, Containers and Volumes
How to Install Google Chrome on Ubuntu 18.04