3. Configuring the Pi

3.1. raspi-config

A lot of the Pi’s system settings are configured in raspi-config, a terminal/shell based tool. When we run this tool, we will run them as a root user, the root has the permission to modify files or default settings as an administrator. By default on Raspbian (the operating system of our Pi) the root user is pi and the root password associated to the root user is raspberry. To operate as a root user in the terminal every command is preceded by the sudo (super user do) command.

Type the following command and press ‘Enter’ to open the configuration menu of the Pi:

$ sudo raspi-config

Note

The $ symbol in front of the command signifies when this command should be written in the terminal window. When writing the command you should not write the dollar sign, only the command: sudo raspi-config.

The terminal will show a menu. The options can be navigated with the vertical keys of your keyboard, to accept the options press ‘Enter’, to finish press the lateral keys of the keyboard.

../_images/raspi-config.png

3.1.1. Keyboard

First we set up the keyboard to prevent any problem when we will change the root password. We access the option: 4 Localisation Options:

../_images/localisation-options.png

Then Change Keyboard Layout:

../_images/keyboard-layout.png

Then we choose Generic 105 key:

../_images/keyboard-generic-105.png

And then English (UK):

../_images/keyboard-english-uk.png

Then we can choose the default options that the menu is prompting by pressing enter:

../_images/keyboard-default-layout.png ../_images/keyboard-no-compose.png ../_images/keyboard-terminate-server.png

3.1.2. Timezone

Then we are re-directed to the main menu, now we change the timezone from the 4 Localisation Options menu.

../_images/localisation-options.png

Then we choose Change Timezone:

../_images/timezone-change.png

Then Europe:

../_images/timezone-europe.png

Then London:

../_images/timezone-london.png

3.1.3. User password

Now we will change the root user password. This increases the security of the connection we will establish from our laptop to the Pi. Since you are sharing this Pi with your colleagues choose a password together. To change the password we are re-directed to the main menu and here we choose the first option: 1 Change User Password:

../_images/password-change.png

Then we agree to change the password:

../_images/password-ok.png

Type the new password twice:

../_images/password-typing.png

Note

Nothing will appear on screen when you are typing the password. This is normal - it’s still working! If you need to cancel, press Ctrl+C on the keyboard.

../_images/password-changed-ok.png

We have set the new password. Do not reboot the Pi yet.

3.1.4. Enable SSH

We will now check that the SSH is enabled. We need to enable it to connect with the Pi remotely. From the main menu we access: 5 Interfacing Options:
../_images/interfacing-options.png

Then we select SSH:

../_images/ssh.png

Then we confirm that we want to enable the SSH server:

../_images/ssh-enabling.png

We confirm again:

../_images/ssh-is-enabled.png

Exit the menu by pressing the right arrow twice to select Finish and press the Enter key. You will re-enter the terminal.

3.1.5. Expand root partition

Lastly we will expand the root partition to fill the SD card. From the main menu we access: 7 Advanced Options:

We select 1 Expand Filesystem.

../_images/expand-filesystem.png

We confirm the changes. You will need to reboot the Pi for changes to be implemented (see next step).

../_images/root-confirm.png

Note

SD Cards can be split into partitions to separate storage of data. The partition has been shrunk to make the download size smaller, but we now want to expand the root parition to fill the whole SD card (allowing more space for file storage). If you do not do this you will find you are unable to create new files.

3.1.6. Reboot

Now reboot the Pi to ensure all your changes are made:

$ sudo reboot now

Tip

Following the new kernal update “Raspian Stretch” released in September 2017, some users have found that their settings are reset after reboot. If so, please perform Pi Configuration within the X-Environment:

  1. Click on Raspbian Icon
  2. Preference
  3. Raspberry Pi Settings

3.2. Adding users

A guide on adding new users to the Pi can be found here. Generally this is not necessary, and you can continue to use the pi account. Just remember to change the user password for pi from raspberry to something new!

You can create additional users on your Raspbian installation with the adduser command. Enter sudo adduser bob and you will be prompted for a password for the new user bob. Leave this blank if you do not want a password. However, we recommend that each user get a password to access remotely in the future, for example:

ssh bob@123.343.1.105

You can delete a user on your system with the command userdel. Apply the -r flag to remove their home folder too:

sudo userdel -r bob

The default pi user on Raspbian is a sudoer. This gives the ability to run commands as root when preceded by sudo, and to switch to the root user with sudo su.