Normal users can acquire administrator privileges which is usually held by the root user, via the sudo command. In this short article, you will find an easy way to create a powerful new user who will have sudo access on Ubuntu. This will be achieved without modifying the server’s Ubuntu sudoers file. You will then be able to execute commands which require administrator privileges without logging in as a root user.
In order to add a new user to the system, use the adduser command.Make sure to replace the username below with the new username to be created.
sudo adduser username
You will then be prompted in order to confirm the new user password, and other credentials (you can leave them blank by pressing ENTER to accept the default) . Make sure to provide a complex password that can not be hacked.
You may be interested to read: The Sudoers File in Ubuntu
Create sudo user ubuntu
After setting the password, the command above will set up a home folder for the new user as well as copy various configuration files in the home folder.
Sudo access privilege is granted to all members of the sudo group by default on Ubuntu.In order to add the new user you have created to the sudo group, you can use the usermod command as shown below :
usermod -aG amin_net2
Add user to sudoers Debian
in order to switch to the new user account, type in the su command as shown below :
su – username
Now in order to check that ‘sudo’ can be used with the new user account, invoke any command which require superuser privileges. For instance :
Or simply try to list out all files under the root folder… sudo ls -l /root
You may be interested to read : How to become root user in Ubuntu
If you like the content, we would appreciate your support by buying us a coffee. Thank you so much for your visit and support.