Change Username and Password on Raspberry Pi  Guide ▷ 2021

Default, Raspberry Pi boards come with a default username and password. This leaves our team vulnerable and anyone can access our files and documents with advanced permissions without our authorization.

To protect the security of the computer, we must change the default credentials. Although we cannot do it when installing an operating system, once it is configured we will get to work to make sure that only we, or who we have authorized, we have the option to connect.

In this course we bring you the step by step about how to protect the data that you have included in the Raspberry Pi, there will also be infallible tips so that your password is robust and secure, without fear that someone can crack.

Learn step by step how to manage and change the default username and password of your Raspberry Pi

Password change from the Raspberry Pi OS desktop

Change the data that the operating system creates by default on the Raspberry Pi is not complicated. That’s very necessary because the default credentials are easy to guess. User is “pi” and password is “raspberry”. To make the modification, a mouse, keyboard and monitor must be connected to the device to see the commands.

So carefully follow the steps outlined below:

  • To change the user, we enter the terminal and write the following command: sudo /usr/sbin/useradd –groups sudo -m “usuario".
  • What we do is replace the word “user” by the name we have chosen.
  • Ready the user, let’s go for the password. Here we will use the following command: sudo passwd usuario.
  • It will ask you to enter the new password twice to be safe and not to make mistakes.
  • Choose a password that is strong and robust, difficult to decipher and enter it into the terminal.
  • You already have your new password. But it is recommended disable default user. To do this, use the following command: sudo passwd -l pi.

We teach you how to improve the privacy and security of your Raspberry Pi to protect your data to the maximum

This step it is especially important if you have your device permanently connected to the internet. If privacy is not protected, it can be attacked and manipulated for completely different purposes than the project you have done. To avoid taking any risks and to protect your data, follow the tips below.

You will see how in a short time you learn more about how to have a safer computer:

Update the operating system

Keep the latest version operating system ensures you have the latest security fixes and fewer people can use an old bug to violate your privacy. Equally, configure package list so that they are updated periodically.

To update from SSH or a terminal, we must be connected to the internet and then do the following:

  • Run the command sudo apt update.
  • Later, writes sudo apt dist-upgrade.
  • Followed by sudo apt clean.
  • And finally, we type sudo reboot.

When executing the last command, the Raspberry Pi must be restarted and when we start up again we will have the most recent version installed.

Secure SSH connection

SSH connection on Raspberry devices

This is the tool we use to connect remotely. If it is not configured properly, it can be a fragile side of our system.

You can use two-factor authentication or SSH which are two good forms of protection:

  • To edit it, enter with this command: sudo nano /etc/ssh/sshd_config.

There are many settings that can be changed, here are a few:

  • Change the port: Port 3426.
  • Set the time in which the “Login” to identify yourself: LoginGraceTime 1m
  • To save the changes and verify that everything is fine, we execute: sudo service ssh restart

Set up a firewall

Using Raspberry as a Firewall

The firewall is used to allow or block incoming connections to your mini computer. It will natively block all traffic that tries to penetrate any port that has not been explicitly opened.

There are several ways to do it, a simple way to configure it is through UFW, which is designed to run without complications:

  • To install it, run this command: sudo apt install ufw

Then add these two lines that prevent the entry of traffic, but prevent the exit:

  • sudo ufw default deny incoming
  • sudo ufw default allow outgoing

Encrypt important files

A good idea is hide the content of important documents that we have saved on the server so that they cannot be seen with the naked eye. When entering, they will appear letters, numbers or symbols without any meaning, but when you enter the key that you have placed in them, you will see them correctly.

Install fail2ban

Fail2ban configuration in Raspberry

This tool works as a scanner that detects suspicious activities on the network to which it is connected and in this particular case to the Raspberry. If there is any gap with the firewall, this wizard covers it and fulfills the protection functions.

Tips to create an unbreakable password for your Raspberry Pi and secure your files

For protect privacy and security, one of the fundamental aspects is have a good password. But the reports show that many people use weak keys and that they do not meet the required standards.

Therefore, we give you some tips to create passwords that are difficult to crack:

Use random words

Alternate words with numbers, special characters, uppercase and lowercase letters. This allows it to have a high level of security and complexity. Therefore, they are less likely to discover it. For it you can use our strong password generator.

Don’t use very common words

Change password in Raspbian

There are data that are very easy to know and obtain like the date of birth, name, age or any other personal aspect. That’s among the first things hackers use when trying to break a password.

Control the length of the password

Although it is thought that eight characters is high security, not all the time is enough. That’s the bare minimum, but the longer your password is the better. Keep in mind that emoticons increase your confidence level considerably.

Use different passwords on your accounts

Maybe you have many services to which you are affiliated in which you need a username and password. If you use the same also in your Raspberry you run the risk of being deciphered. Make sure that each username and password are different from the ones you use on this device.

Change it frequently

At least once a year it is advisable to change the password, using one that is as safe as the one you have today. Spending a lot of time with the same encryption increases the chance that third parties will know about it.

Don’t tell anyone

It seems like an obvious step, but in many cases it is overlooked. It is better that only you know, not even your relatives, much less leave it glued to the computer, especially if many people frequent the place where you access.

If you have any questions, leave them in the comments, we will answer you as soon as possible, and it will surely be of great help to more members of the community. Thanks! 😉

Author: Mario José

Graduated in journalism, specialized in investigation, I look for the truth of all things. Now 100% focused on technology, computing and Internet issues.

You may be interested:

Rate this post

Leave a Comment