To create a new sudo user on an Ubuntu Linux server, you can follow these steps:
Connect to the server using an account with sudo privileges.
Run the adduser
command to create a new user account. Replace username
with the desired username:
sudo adduser username
Follow the prompts to set the password and other user information for the new account.
Run the usermod
command to add the new user to the sudo
group:
sudo usermod -aG sudo username
Log out of the current account and log in to the server using the new sudo user account.
To test the sudo privileges of the new user, run a command that requires root privileges, such as apt-get update
. You will be prompted to enter the password for the new user account:
sudo apt-get update
If the password is accepted and the command executes successfully, the new user has been granted sudo privileges.