How To Create a Sudo User on Ubuntu 20.04 LTS

To create a new user with sudo permissions on Ubuntu 20.04 LTS, you can use the following steps:

  1. Open the terminal and run the command:
sudo adduser <username>

this command will create a new user with the given username, it will prompt you to set a password and some personal information for the new user.

  1. To give the new user sudo permissions, you can add them to the sudo group by running the command:
sudo usermod -aG sudo <username>

This command adds the user to the sudo group, which allows them to execute sudo commands.

  1. To check if the user has been added to the sudo group, you can run the command:
sudo groups <username>

This command will show you the groups that the user is a member of, and should include sudo.

  1. You can also check the user’s permissions by running the command:
sudo -l -U <username>

This command will show you the sudo permissions of the user, which should include (ALL:ALL) ALL.

  1. After the user is created and has been added to the sudo group, you can switch to the new user by running the command:
su - <username>

This command will switch to the new user’s account.

It’s important to note that creating a new user with sudo permissions is a security best practice, as it allows you to separate the user’s permissions from the root user’s permissions. Additionally, it is a good practice to use a strong password for the new user, and avoid using the root user for everyday tasks.

Leave a Comment