When you’re running Ubuntu on your PC or on a server, you’re essentially given a default root user. The root account has a lot of privileges and flexibility, which can be dangerous if someone that’s not yourself starts messing with things. That’s why creating a user account for other people that use your system is so important. In fact, it can be wise to even create yourself a user account with standard privileges for when you need to do tasks that don’t require root access.

Follow along and we’ll show you how to add and delete new users.

Adding a new user

Adding a new user to your system is super easy. If you’re signed in with root access, you can add a new user by opening the Terminal and typing in the # adduser username command, with username being the name of the account. This can be anything you’d like it to be. If you’re not a root user, but have “sudo” or superuser privileges, you can add a new user by opening Terminal and typing in the $ sudo adduser username command.

After entering either of these commands into Terminal, you’ll be asked a series of questions about the new user, such as setting a password and other information about this new user.

Deleting a user

If a user account is no longer being used, it’s always a wise move to go ahead and delete the user account. It’s just as simple as adding a new user, too.

First, open Terminal. Next, type in # deluser username, if you’re on a root account. Or, if you’re on a sudo account, type in $ sudo deluser username.

Adding privileges

If you want, you can add sudo privileges to any new user account you create. You can add these privileges by adding the new user to the sudo or superuser group.

To do this, open Terminal and type in $ usermod -aG sudo username. In this case, -aG is telling usermod to add the entered in user account to the sudo group, giving that user superuser privileges. You can change the privileges on this user by adding it to a different user group. By default, new user accounts are added to the newuser group, so if you wanted to remove sudo privileges, you could always send that user to the newuser group using the above command, but by replacing sudo with newuser. So, it’d look like $ usermod -aG newuser username.

Closing

And that’s all there is to it! By following the above steps, you can easily and quickly start adding and deleting new users, along with assigning privileges.