Add / Create a new user with SUDO privilegdes to Ubuntu (Linux)
How to add a new user with password access
- Log in to your server as the
root
user. - Use the “
adduser"
command to add a create the new user to your system, including their home directory and groups. (replace username with new users username)
COMMAND: adduser username - Follow the prompts to add the new users password.
- Follow next set of prompts to add relevant info about user.
- Next use the “usermod” command to add the new user to the sudo group and any other groups they need access to.
COMMAND: usermod -aG sudo username - Test the user and their access to sudo commands by switching to the user (use “su” command) and running a sudo commmand.
COMMAND: su – username
COMMAND: sudo ls -la /root