Session 2

Let's setup a different power user on the Pi.

Once your Raspberry PI 4 completed booting Raspbian, you can remotely connect to it with SSH. Open your terminal and type this command:

ssh pi@raspberrypi.local

This logs in the pi user. Keep in mind that the default password is raspberry (unless you've changed it).

Create a new user and delete the pi user

As you noticed in the previous session, the default user in Raspbian is pi with password raspberry. Everyone that ever played with a Raspberry PI knows this. Thus it is highly recommended to change the password for the pi user as soon as possible. My personal recommendation is to take this a step further: create a new user and delete the pi user altogether.
To create a new user, run the command:

sudo adduser newusername

Replace newusername with the username of your preference. The command prompts you to enter some basic information about the new user, including the password. You can leave any of this blank, except the password. The password should be a strong one.

As a next step, add the new user to the same groups as the pi user belongs to (just excluding the pi group itself). The following one-liner pipes together a few commands to achieve this. (This should all be on ONE line in the terminal)

groups | sed 's/pi //g' | sed -e "s/ /,/g" | xargs -I{} sudo usermod -a -G {} newusername

Before actually removing the pi user, close the current SSH connection and establish a new one. This time login as the newly created user:

ssh newusername@raspberrypi.local

After verifying that you can login as the new user, it is time to remove the pi user, including its home directory:

sudo deluser --remove-home pi

Now we have a new user, one that has all the same privileges of the pi user without the world guessing what your username is.

Share this