First we are going to set up the basics: an OS (we're going to be using Raspbian), a new user and ssh. Rasbian by default comes with a user pi (password: raspberry) who has full permissions on the system. This is a problem when we connect the raspberry pi to the internet, as anyone could mess around with the system. We could just change the password, but might as well set up a new user and delete "pi" altogether. We are setting up SSH so that we can control the server remotely, both from within the network or any other computer connected to the internet.
After booting the pi for the first time from NOOBS, we select the Raspbian OS. This will set up the operating system and might take a while to run. After the installation is complete, we reboot the raspberry and find ourselves in the "Raspberry Pi Software Configuration Tool". If this does not come up automatically, start it by typing
In the config tool, we are changing a couple of things:
- Change pi password: Even though we are later going to set up a new user, let's change the password from raspberry to something more unique.
- Boot to console: This will keep Raspbian from booting into the GUI and instead present us with a console terminal window after boot.
- Advanced options - Enable SSH: This will allow us to remotely connect to the raspberry pi.
- Advanced options - set hostname: We'll change this from "raspberrypi" to "pi" mostly so that the prompt in the terminal is a bit shorter
- Advanced options - memory split: Here we can select how much memory the GPU can have. Since we are going to run the raspberry without graphical interface, we'll set this to the lowest possible option, 16.
After updating all the settings, select finish and reboot the computer. Once prompted, login with the user "pi" and the password we just updated.
We're now going to set up a new user with the same rights as the current pi user. Type
to see a list of groups the user pi belongs to. In my case, this is
pi adm dialout cdrom sudo audio video plugdev games users netdev gpio i2c spi input
In order to add a new user called phil with the same group memberships, type
sudo useradd -m -G adm dialout cdrom sudo audio video plugdev games users netdev gpio i2c spi input phil
and set the password for this user:
sudo passwd phil
After entering the password twice, reboot the computer again:
Once the raspberry pi has finished it's boot process, login as the new user. The last thing to do is deleting the old pi user account:
sudo deluser --remove-all-files pi
After a while the computer should print "Done." indicating that the user pi and all their files have been removed.