To create a linux user in Ubuntu 20.04 LTS run the following command as root:
adduser myuser -q --disabled-password
When the terminal prompts to add user data, just hit Enter key until it finishes.
To delete the user and it's home directory run the following command:
deluser --remove-all-files -q myuser
It might complain that perl is not installed. To install it just run
apt-get install -y perl as root user.
As root user run the following command
echo "myuser ALL=(ALL:ALL) NOPASSWD: ALL" > /etc/sudoers.d/myuser
Make sure that files in
/etc/sudoers.d don't have any
~ characters in the name.
Later, if you want to remove the sudo access for the user, just delete it's file from
It is best practice to grant sudo access by creating a file for each user in
/etc/sudoers.dinstead of adding an entry in