What is 'sudo' ?
Actually 'sudo' command provides administrator privileges. When we create a new server it has a default 'root' user. So, here I'm going to create a new user with sudo access.
Step One
Open your terminal and write the following command
root@localhost:~$ adduser [username]
Step two
Set the password and confirm the password again.
Step three
Now you need to give 'sudo' permission to the newly created user. So, use the usermod command in the terminal. Command is given bellow -
root@localhost:~$ usermod -aG [username]
Now, the new user added to the sudo group. you can check by this command -
root@localhost:~$ su - [username]
And run any command with 'sudo' in the terminal -
username@localhost:~$ sudo apt-get update
If you want to add sudo to the existing user then just follow the step three.
Thanks for reading <3
Top comments (0)