An easy way of making your Pi that little bit more secure is to remove the default user, Pi. So when setting up a new Pi installation this is one of the first things I do which is very simple. SSH into your Pi as usual:
1 | ssh pi@192.168.0.2 |
Switch to the root user:
1 | sudo -i |
Create a new user:
1 | adduser puk |
Will result in the below, add a decent password when asked and then repeat it:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | Adding user `puk' ... Adding new group `puk' (1001) ... Adding new user `puk' (1001) with group `puk' ... Creating home directory `/home/puk' ... Copying files from `/etc/skel' ... Enter new UNIX password: <REDACTED> Retype new UNIX password: <REDACTED> passwd: password updated successfully Changing the user information for puk Enter the new value, or press ENTER for the default Full Name []: Puk Room Number []: Work Phone []: Home Phone []: Other []: Is the information correct? [Y/n] Y |
Add the new user to the sudo group:
1 | adduser puk sudo |
1 2 3 | Adding user `puk' to group `sudo' ... Adding user puk to group sudo Done. |
Quit the Pi by typing exit a couple of times, first to log out as root then to leave SSH. Log back into the PI with SSH using your new username/password:
1 | ssh puk@192.168.0.2 |
Now to delete the old Pi user:
1 | sudo deluser pi |
Will give you an output, add the user Pi’s password when asked:
1 2 3 4 5 6 7 8 9 10 11 | We trust you have received the usual lecture from the local System Administrator. It usually boils down to these three things: #1) Respect the privacy of others. #2) Think before you type. #3) With great power comes great responsibility. [sudo] password for puk: Removing user `pi' ... Warning: group `pi' has no more members. Done. |
Finally change the default password of the root account, use a new pass […]