Every Raspberry Pi model comes with a default login and password. The default username is ‘pi ’ and password is ‘raspberry.’ Today, I will provide a guide to change these credentials in an easy way.
Why is it necessary?
For the beginners, for those who are doing the first Raspberry Pi project in offline mode; it’s not a necessary thing to change the credentials. But, if you want to connect your Raspberry Pi to the wired or wireless internet connection using an Ethernet or a WiFi adapter, then it is strongly recommended that you change username and password of your Pi.
The reason behind it is that as the default login and password are common in all Pi devices and they are so generic that any baby hacker can hack you set up and can create a mess in it. Also, the people who can have the physical access to your circuit can also change the things with the help of default username and password.
How to change Raspberry Pi default login?
Changing the Raspberry Pi credentials is a simple and quick process. Following some short and easy steps will do the job for you. Check them below:
Raspberry Pi change username
Remember, you cannot change the username while you are logged into the Pi. You have to make ‘root login’ for this. Before login as a root user, you have to enable it. Follow the steps below:
- Login in your Raspberry Pi as the default user – pi
- Now, type the command ‘sudo passwd root’
- Make a secure password for root login
- Logout from the default account. Type ‘logout’ for that
- Now, login back in the root account
- Type the command ‘usermod –l mdp pi’
- Enter the new password for the user ‘mdp’
The username will be changed to mdp from pi. The home directory will show it as below.
- usermod –m –d/home/mdp mdp
Raspberry Pi change password
So, the username of your Raspberry Pi has been changed. It’s time to change the password for Raspberry Pi. For this;
- Logout from your current account (you are currently in root account)
- Now, login back with the new username ‘mdp’
- Type the command ‘passwd’ and enter the new password when prompted
That’s it. You have changed the Raspberry Pi password too.
You can disable the root account if you want to. But, first, type the command below:
sudo apt-get update
If it works, then you are good to go. Type the following command to disable root login.
sudo passwd –l root
It’s recommended that you change the password of your Raspberry Pi frequently. It helps you to secure your project from any unwanted interruption. I hope the guide mentioned here is helpful. If you know or want to share any other methods to change the Raspberry Pi credentials, then feel free to write them in the comments section below.