# Add and remove Ubuntu users User management in an Operating System is one the most critical administrative tasks an adminstrator needs to supervise. This allows to manage, compartmentalize and secure access and permissions to the system's resources. It's also often the first task an administrator has to configure after a fresh installation, even if they are the sole user of the system. This is because at first, the administrator is granted the utmost access privileges. In the case of Ubuntu/Linux, the user with omniscient control over the operating system is called `root`. However, with great power comes great responsibilities and risks: `root` access can be dangerous and destructive in the wrong hands. This is why it is imperative to know how to manage Linux users. In this blog post, we will cover in details how to add and remove Ubuntu users using 2 different approaches: - **GUI (Graphical User Interface)**: using the graphical interfaces. This is the intuitive and visual way. - **CLI (Command Line Interface)**: using commands in the terminal. Can be quicker and is more suitable to automation scripts. ## Prerequisites - Ubuntu OS (or any other Linux flavor) - `sudo` privilege: since these are sensitive administrative tasks, the current user is required to be an administrator, or more precisely in the Ubuntu/Linux word: "have `sudo` privileges". ## Using the GUI To access the management interface for users on Ubuntu, right-click on your desktop and click **Settings**. In the left menu, choose **Users**. Since managing users is sensitive, it's protected and can be unlocked, as the top dropdown suggests: ![](https://i.imgur.com/lvjNFEZ.png) It will require your current user's password and will unlock the add/remove features if the user has `sudo` privileges. ### Add Ubuntu User To add a user, click on the green `Add User` button. You will be presented with a form to supply the new user's information: ![](https://i.imgur.com/nNmXLDK.png) You have the option to set a password for the user, or leave it undefined for the user to specify on their first login. If you wish to set a password yourself, Ubuntu will require it to be a strong password, and not use common words. ### Remove Ubuntu User To remove a user using the GUI navigate to their settings profile. At the bottom, you can find a red button to **Remove User**: ![](https://i.imgur.com/hkydXQU.png) You will be then asked on how to handle this user's files: either delete them, or keep them as is. ![](https://i.imgur.com/YyD46hm.png) ## Using the CLI > Note: we will refer to the new user as `<username>`. Please change it to the actual name you pick for your new user. Although the CLI approach could be considered more advanced than the GUI approaches, it's always useful to know how to do the same task in multiple ways. Sometime, CLI might be your only option, such as the case for remote Cloud instances. To issue command to our Ubuntu OS, we will need to launch a terminal. You can do so using the keyboard shortcut **Ctrl-Alt-T**. ### Add Ubuntu user To add a new Ubuntu user, use the following command: `sudo adduser <username>` You will be asked to supply and verify a password for the user, as well as additional optional information such as the Full Name and Phone Number: ![](https://i.imgur.com/4uPgVAg.png) ### Remove Ubuntu user To remove an Ubuntu user, use the following command: `sudo deluser <username>` If you wish to delete the user's home directory and mail spool too, you can use the `--remove-home` flag: `sudo deluser --remove-home <username>` ## Potential improvements of the article - List users - Grant/Revoke sudo priviliges - Add/remove groups - Add/remove users to groups