My Account

Wish List (0)

Saved Carts

Compare

How to add new users and add users to groups

November 22, 2013

If multiple people are using the same raspberry pi you may want to add new users so each person has their own user account.

Adding a new user is simple enough, the following method was done whilst logged in as the default user 'pi' which has the root or 'sudo' privileges needed to add and modify user accounts.

For this example we will create a new user called 'newuser', simply replace this with whatever name you want. To add the user 'newuser' use the following command:

sudo adduser newuser

This will create a new user along with a group 'newuser' and  new home directory. You'll also be prompted to enter a password for the new user. If you ever need to change the password of the 'newuser' you can do so with the command:

sudo passwd newuser

In order for the user to have the same privileges as the default account 'pi' we'll need to add the it to several user groups. To find out what groups the user 'pi' belongs to type the following command:

groups pi 

You can see pi belongs to several groups such as 'audio' and 'video'

Do the same for the 'newuser':

groups newuser

You'll see it only belongs to one group 'newuser'

We need to add new user to the same groups as the user 'pi' to enable him to use audio, accelerated video, pluggable devices, etc

To add a user to a group  we use the command:

sudo adduser <username> <groupname> 

So to add 'newuser' to the group 'dialout' type:

sudo adduser newuser dialout

Now repeat this step for all the remaining groups apart from the group 'pi'. If you don't want the new user to have admin or root ('sudo') privileges then don't add the user to the groups 'sudo' or 'adm'.

You can check the user has been added to correct groups by using the command groups newuser again.

Deleting a user and removing a user from a group

If you want to remove a user from a group you can use the following command:

sudo deluser <username> <groupname>

So to remove user 'newuser' from the group 'adm' you would type:

sudo deluser newuser adm

A similar command can be used to delete an entire user along with it's home directory:

sudo deluser <username>

Tags: add-user-to-group, raspberry-pi, add-new-user, group, new-user Last update: September 11, 2015

Comments

Leave a Comment

Leave a Reply

* Name:
* Comment:
* E-mail: (Not Published)
Website: (Site url with http://)
Verification code: