Sudo is a command line tool that allows a specific user (or group of users) to run some (or all) commands as root while keeping all commands and arguments logs. It operates on a per command basis. Using timestamp files it implements a “ticketing” system”. For example if a user invokes sudo and enters their password, they are granted a ticket for 5 minutes. So each subsequent sudo command updates the ticket for another 5 minutes. This tool also gives the system administrator the ability to modify the command duration in sudo conf file. In addition the conf file is setup in such a way that it can be copied for many machines. In this guide we will see how to add users to sudo group On Ubuntu 18.04.
- 99RDP VPS
- Terminal Access
Adding Users To Sudo Group On Ubuntu 18.04
- Firstly, og In to the server using the given command, or use Putty.
# ssh root@99RDP_VPS_IP
- Upgrade the package and repository list for the VPS using the given command.
# apt-get upgrade
# apt-get update
- After the update is finished create a new user, by running the given command, stup the password.
# adduser test
- Enter the password, and confirm it.
- Now we are going to add this 99RDP user to sudo group using the usermod command.
The usermod is a Linux command used to change Linux user properties from the command line. After creating a user, you may need to change attributes such as password or login directory.
# usermod -aG sudo test
Verifying Sudo Access
- Switch to the new “test” account by using the su command
# su test
- After switching the account try to list the files of any root directory, without sudo command. For example:
- Now run the same command with sudo.
# sudo ls
You can also check the logs for each sudo user accounts on the system by opening the /var/log/auth.log file. To do so enter the given command. # sudo nano /var/log/auth.log
This will show the history of command ran by the sudo users. In the output you can see the sudo user running the ls command.
In this guide we saw how to add users to sudo group. This can help system administrator to mange monitor newly created user accounts for various factors. With this you have more control over the level of permissions you grant to specific users. If you have any questions or suggestions feel free to drop by us.