Pages

Monday, November 19, 2012

How To Add/Remove Users Accounts From The Terminal On Ubuntu 12.10/12.04/Linux Mint 13

In
this tutorial, we will see how to create/remove user accounts using the
terminal under Ubuntu/Linux Mint. We will also show you how to add a
specific user to the "sudo" group so that you allow it to run sudo
commands, but be careful in using this because granting a user root
access implies complete control of your machine.

1. Adding A User Account

- You can add a user account from the terminal with this command:

sudo useradd username

Replace username with any name of your choice.

- Create the home directory for this new user with this command:

sudo mkdir /home/username

Assign now a password for this user with this command:

sudo passwd username

Grant this user ownership and access to its home directory with these two commands:

sudo chown username /home/username

sudo chgrp username /home/username

Log out now the current session to test the new user account name.

Grant Root Priviliges To A User Account (Optional)

If you want to give a user account root privileges so that it can execute "sudo" commands, run this command:

sudo adduser username sudo

2. Removing A User Account

Open the terminal and run these commands to delete a specific user account:

sudo userdel username

sudo rm -r /home/username/

Replace username with the user account name you want to delete.

This tip is compatible with Ubuntu 12.10/12.04/Linux Mint 13 or older.