How to create sudo user in Ubuntu 18.04.3 LTS
The sudo
command provides administrator privileges to user, ordinarily only available to the root user, to normal users. This article will show usthe easiest way to create a new user with sudo access on Ubuntu. We won’t be updating/modifying your server’s sudoers
file.
If you want to configure sudo for an existing user, simply skip to step 3.
- Login to the server with root OR switch to the root.
ssh root@server_ip_address
OR
ssh rootuser@server_ip_address
sudo su
2. We can use adduser
command to add new user to the system. Be sure to replace the username
with your user name.
adduser username
2.1. Set and confirm the new user’s password at the prompt. A strong password is highly recommended for root, since anything can be done on server/machine with that access.
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
2.2 Write the information for the user. If you want to leave the value blank then just press Enter
.
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]
3. use usermod
command to add the user in sudo
group.usermod -aG sudo username
4. switch to the user. su — username
5. switch to root of that user. sudo su
| sudo -i
6. Now you can run commands which can be run via only root user.
This is very basic from linux and wrote the article because of having queries for above multiple times.
If you like this, please give clap/s for me, it really motivates me to write more useful things.
If you have anything in your mind and want me to write about that then also you can suggest me. My LinkedIn profile in the bio, you can connect with me from there.
Thank you very much for reading this.
Happy Learning !!! 🙂 📚
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]