How to Create and Delete Users on Ubuntu

Admin Ubuntu

Several ways to create a user on Ubuntu and other useful commands.

How to Add a User

In the example below, we will create the user ploshadka.

а) adduser

sudo adduser ploshadka

Then we create a password, answer typical questions.

б) useradd

useradd -m -s /bin/bash ploshadka

Set a password:

passwd ploshadka

In both cases, a user directory will be created:

cd /home/ploshadka

Sudo Group for a User

Use next command to add the user ploshadka to the sudo group:

usermod -aG sudo ploshadka

How to Delete a User

If you need to delete a user:


userdel ploshadka

Logging In as a New User

This can be done in one of the ways:

а)

su - ploshadka

б)

sudo -iu ploshadka

Exit

If you need exit to the root user:

exit

Leave a Reply

Write your comment if you have something on the topic of the current article:
"How to Create and Delete Users on Ubuntu"