Before we begin, it is important to note that in Ubuntu, only users with administrative privileges (also known as “root” users) can add and delete other users. If you do not have administrative privileges, you will need to ask an administrator to perform these tasks for you.

Adding Users in Ubuntu

The adduser command in Linux is used to create a new user in the system. It is typically used with the following syntax:

Some common options that can be used with the user_name command are:

-c: Specifies the user’s full name. -d: Specifies the user’s home directory. -g: Specifies the user’s primary group. -G: Specifies a list of secondary groups that the user belongs to. -m: Creates the user’s home directory if it does not already exist. -s: Specifies the user’s login shell. -u: Specifies the user’s UID (user ID).

To add a new user in Ubuntu, follow these steps: Let’s see another example with a few options, to create a new user with the username “tecadmin” , a home directory at “/var/home/tecadmin” , and the Zsh shell as the login shell, you could use the following command: For a complete list of options and more information about the adduser command, you can consult the adduser man page by typing man adduser in a terminal window.

Deleting Users in Ubuntu

To delete a user in Ubuntu, follow these steps: Note: It is generally a good idea to back up any important files before deleting a user. Once a user and their files are deleted, they cannot be recovered.

Conclusion

In this article, we have explained how to add and delete users in Ubuntu 22.04. We have also discussed how to set additional user privileges using the usermod command and how to delete a user’s files during the deletion process. With these skills, you should now be able to manage users and groups on your Ubuntu system effectively.

How to Add and Delete Users in Ubuntu 22 04   TecAdmin - 65How to Add and Delete Users in Ubuntu 22 04   TecAdmin - 54