Home media center system or just a simple project box — the Raspberry Pi is versatile and popular. But this popularity can lead to your Pi being hacked or even stolen, resulting in wasted time, effort, and data. So what can you do about it?

Change your default password

The default password for your Raspberry Pi needs to be changed. Often this is not the case, but it is easy to do so.

ai-security configuration

To change your Pi’s password (if you’re using Raspbian — for your favorite Pi flavored distribution, check the related documentation) download it, open a terminal and run sudo raspi-config to display the settings tool.


Here select the option » Change User Password» and follow the instructions.

This is actually the easiest way to change your Raspberry Pi password. The fastest way is to simply enter the password into the terminal and enter the new password when prompted; this method does not require the sudo command, since for the pi user you are already logged in as. Please note that no text is displayed on the screen when you enter your password, so your new passcode remains safe.


If you are changing the password of another account, you will need sudo .

Which brings us to an interesting point: can you also change the pi username?

Changing the default username

If an attacker has your username, they are halfway to accessing your data. So you have to change the pi username to something else.

Because deleting an account can be dangerous if you don’t have the necessary permissions, it’s best to create a new superuser account:

 sudo useradd -m christian -G sudo 

The -m condition creates a home directory for the user, and the second «sudo» adds the user to that group.

Next enter:

 sudo passwd christian 

This will allow you to set a password for the new user (called «Christian» in this case).

Your new account should now have the same permissions as pi, since both are in the sudo user group.


Before deleting the pi, log out of the account and then log in again using the new account, and sudo visudo run again sudo visudo . If successful, your account is ready to accept the command.


In terminal enter sudo deluser pi to delete only the user account. You can leave it there if you like, or remove the directory as well /home/pi by using sudo deluser -remove-home pi .

Those are much better options than leaving the default pi/raspberry username/password combination unchanged, don’t you agree?

Firewalls and Raspberry Pi

This ridiculously flexible computer can be configured to act as a physical firewall, the first entry point into your home network (or even vice versa, as a secure anonymous gateway). about the world as a whole). However, this is not what we discuss in this guide.

Instead, we’ll look at ways to secure your Raspberry Pi. Various firewall software applications are available for the Pi, but perhaps most impressive is the powerful Firewall Builder, an easy-to-use graphical interface that will configure various firewalls, including iptables, which is quite difficult to set up correctly.

Install with

 sudo apt-get update sudo apt-get install fwbuilder 

In the Raspberry Pi GUI (type startx on the command line to run) you will find Firewall Builder listed in the submenu Other . Follow the instructions to create a firewall and save the script. For best results, you need to make sure the script is loaded before your Pi comes online. To do this, open the script /etc/network/interfaces in a text editor and modify it by adding:

 pre-up /home/pi/fwbuilder/firewall.fw 

Finally, add this to the script section labeled Epilog:

 route add default gw [YOUR.ROUTER.IP.HERE] eth0 

This will give you access to the Internet. Now you’re all set and your Pi is secure from online intrusion!

Raspberry Pi under lock and key

This Raspberry Pi is definitely an impressive joke. A less reliable person might even be tempted to turn it off and hide it in their pocket…if they don’t already have one!


The small size makes this little computer extremely easy to carry in your pocket, so keeping it and your data under lock and key is recommended. When not in use, place your Pi in a locked drawer; if it’s on all the time, you should similarly consider placing it in a closed container, albeit one with more airflow.

Also, don’t forget to regularly back up your SD cards and any other connected data so they don’t get stolen or corrupted.

Security: Raspberry Pi Style

Anyone with an internet connection can use Google to find the default username and password for your Raspberry Pi. Do not expose this discovery to intruders — change your default credentials, and while you work on this, install a firewall and make sure you have a safe place to store your Raspberry Pi!

Do you have any security tips for your Pi?

Похожие записи