How to create, update and delete users in Ubuntu 22.04

In Ubuntu there is a function for the administrator to add, update or delete users in Ubuntu. Various users are added to Ubuntu to perform tasks; However, user permissions can be updated at any time. Likewise, they can also be deleted in Ubuntu.

This article will discover methods to create, update and delete the users in Ubuntu 22.04.

How to create, update and delete users in Ubuntu 22.04?

The method of creating, updating and deleting users using the terminal has been explained in detail in different sections. First open the terminal with the key combination CTRL+ALT+T:

The terminal has been opened.

How to create users in Ubuntu 22.04?

For creating users in Ubuntu we follow the general syntax below:

$ sudo add user -m [username]

After the above command, just replace the “[username]’ with the username and the ‘-m’ option is used to create the home directory of the newly created user, e.g. in Ubuntu to add a user named ‘Paul’ the above command is modified:

$ sudo add user -m Paul

The user has been created, but to make the user account more secure, set a password with the command:

$ sudo password Paul

When the command runs, you will be prompted to set a password and then re-enter the password to match both passwords.

How to update users in Ubuntu 22.04?

When the user is created and some of the user’s permissions are to be updated, the user is granted administrative rights. These permissions can be granted by adding the user to the sudoers group by running the following command:

$ sudo user mod -a -G sudo Paul

To change the password of user Paul, run the following command:

$ sudo password Paul

User Paul’s password has been updated.

How to delete users in Ubuntu 22.04?

For example, to delete the user from the user use the userdel command, to remove the user “Paul” run the command:

$ sudo user del -r Paul

The user will be deleted with the execution of the above command.

Conclusion

The adduser and deluser commands are used to create and delete the users in Ubuntu 22.04 and to update their password use the passwd command. This blog explained how to create, update and delete the users in Ubuntu 22.04.

Related Posts