Docs:01.2 Creating Users

This page was last edited on 19 February 2025, at 15:43.

Once we have set up our Pi with the correct operating system we then want to make user accounts for the individuals who will be using the environment.

We based the following steps on the instructions from this guide from Systerserver. This allows us to create users and give them different access levels. Depending on how you organise your collaborations, you might want everyone to be a SuperUser (a user account with the highest level of access), or you might want to give that role to a certain subset of people. See 01.0.5 Users, collective work, names for more discussion of the organisational issues of assigning roles to users.

Adding Users

Before creating any new users, make sure you are at root level (or the root user) of the machine. This is the systems default SuperUser. To do that, run the following command:

sudo su

To make a new user, use the command below.

adduser <nameofuser>

[!note] You will be prompted to input a password and it is always better to give different users different passwords for security.`

If you want to give this user sudo access, then they have to be added to the “sudo” group. You don’t need to create this group, it exists by default and you can just add or remove users from it. The sudo group is stored in this directory: /etc/sudoers.d/

To add a user to the sudo group run the following command:

usermod -aG sudo <nameofuser>

You can check to see who is in the group sudo using this command:

 grep '^sudo:.*$' /etc/group

Now you can change into the new user (in other words, sign into their account) using the password you just set up for them:

su <nameofuser>

Removing sudo access

If for any reason you would like to remove sudo access from an account, but retain the account, you can run the following command:

sudo deluser USERNAME sudo

Careful! The following similar command deletes the user (without deleting the user files):

sudo deluser USERNAME