Now everyone account on Ubuntu servers can run the sudo command. If you want a user to be able run commands with sudo rights, you must configure that account to do so. the steps below is good starting point to get user to run the sudo command.
When installing Ubuntu servers or desktops, the first user you create is automatically added to the sudo program on the system. Sudo is a program on Linux systems that allows regular users assume super-user or “root” rights to execute programs and other tasks that regular user won’t be allowed to do.
So, the sudo program is very important. make sure that only users you want carrying out administrative tasks are added to the list of users who can use sudo.
After installing Ubuntu, any new user you create will not automatically be added to the sudo program. the currently administrator account is the only one who can add/remove users from the sudo program.
This brief tutorial is going to show students and new users how to create a standard user account on Ubuntu, then add the account to use sudo program to run administrative tasks.
To get started with creating user and adding users to sudo, follow the steps below:
Step 1: Creating Users on Ubuntu
To create new user accounts on Ubuntu using the terminal, run the commands below
sudo adduser richard
Replace richard with the user account name you wish to add.
When you run the commands above, you will get prompts to enter some more details of the user as well as creating the new user password. When you’re done, type Y for yes to save the information.
Adding user `richard' . Adding new group `richard' (1001) . Adding new user `richard' (1001) with group `richard' . Creating home directory `/home/richard' . Copying files from `/etc/skel' . Enter new UNIX password: Create new password for richard Retype new UNIX password: Retype password passwd: password updated successfully Changing the user information for richard Enter the new value, or press ENTER for the default Full Name : Richard Room Number : 101 Work Phone : 7632283373 Home Phone : 2089878233 Other : None Is the information correct? [Y/n] Y
This is how one creates new user accounts on Linux system using the terminal. Remember, the user account is automatically created as a standard account. this account won’t be allowed to carry out any administrative tasks. To allow the user do administrative tasks, add the user to the sudo program.
Step 2: Adding User to Sudo Program
Now that the user account is created, use the commands below to add the user to the sudo program which will allow the user to install / remove packages and well as make some system-wide changes to the server / desktop.
sudo usermod -aG sudo richard
Again, replace richard with the account name.
This will add the user to the sudo program or group.
After that, the user should be able to run and execute tasks only administrator have access to.
To test the new account, run the commands below to switch to the new users
su - richard
You’ll be prompted to type the new user passwords. when you’re done, run the commands below to update the Ubuntu machine
To run a command as administrator (user "root"), use "sudo
". See "man sudo_root" for details. richard @ubuntu1710:~$
Now run the commands below as Richard
sudo apt update && sudo apt dist-upgrade && sudo apt autoremove
The commands above should run without problems. that’s because the new account is now sudo-enabled.
You may also like the post below: