When you first set up your Raspberry Pi, understanding its default login credentials is essential for gaining access to the operating system. These credentials are pre-configured for ease of use but come with certain security risks if left unchanged.
In this guide, we’ll cover the Raspberry Pi’s default username and password, how to use them, and the best practices for securing your Raspberry Pi from unauthorized access.
What Are the Default Login Credentials for Raspberry Pi?
Default Username and Password
- Username:
pi
- Password:
raspberry
These credentials are standard for Raspberry Pi OS (formerly Raspbian) and allow you to log in either directly or remotely using SSH.
How to Log In to Raspberry Pi for the First Time
Method 1: Direct Login with Keyboard and Monitor
- Connect your Raspberry Pi to a monitor using HDMI.
- Attach a USB keyboard and mouse.
- Power on the Raspberry Pi and wait for it to boot.
- Enter the default credentials:
- Username:
pi
- Password:
raspberry
.
- Username:
Method 2: Remote Login via SSH
- Enable SSH: If using a headless setup (no monitor/keyboard), create an empty file named
ssh
in the boot partition of the microSD card. - Boot your Raspberry Pi and find its IP address using network scanning tools or your router’s admin panel.
- Use an SSH client like PuTTY (Windows) or Terminal (macOS/Linux) to log in:
- Enter the default password when prompted.
Why Change the Default Login?
Leaving the default username and password unchanged poses a significant security risk:
- Vulnerability to Hacks: Default credentials are widely known, making your Raspberry Pi an easy target.
- Remote Exploits: Devices accessible via the internet with default credentials can be compromised.
- Unauthorized Access: Intruders could manipulate files, steal data, or disrupt your projects.
How to Change the Default Login Credentials
1. Change the Password
The first step to securing your Raspberry Pi is changing the default password.
- Open the terminal.
- Use the
passwd
command: - Enter the current password (
raspberry
) when prompted. - Enter and confirm a new, strong password.
2. Change the Username (Optional)
Changing the default username involves creating a new user and removing the old one.
- Create a new user:
Follow the prompts to set a password and basic user information.
- Grant administrative privileges:
- Log out and log in with the new username:
- Remove the old user:
Securing Your Raspberry Pi
1. Disable Password Authentication for SSH
For additional security, use SSH keys instead of passwords:
- Generate an SSH key pair on your client machine:
- Copy the public key to your Raspberry Pi:
- Disable password-based SSH login:
Edit the SSH configuration file:Set
PasswordAuthentication
tono
.
Restart SSH:
2. Enable a Firewall
Install and configure ufw to block unauthorized access:
- Install the firewall:
- Allow SSH and enable the firewall:
3. Keep Your Raspberry Pi Updated
Regular updates ensure that your Raspberry Pi has the latest security patches:
Default Login for Other Raspberry Pi OSes
Depending on the OS you install, the default credentials may vary:
OS | Default Username | Default Password |
---|---|---|
Raspberry Pi OS | pi |
raspberry |
Ubuntu for Raspberry Pi | ubuntu |
ubuntu (change at first login) |
Kali Linux | kali |
kali |
RetroPie | pi |
raspberry |
Note: Always check the documentation for your specific OS to confirm default login details.
FAQs
1. Can I reset the password if I forget it?
Yes. Boot into recovery mode by adding init=/bin/sh
to the /boot/cmdline.txt
file, then use the passwd
command to reset it.
2. Can I disable the default pi
user without removing it?
Yes. Use the usermod
command to lock the account:
3. Is changing the default password enough for security?
Changing the password is a good start, but for better security, consider disabling the default user, enabling a firewall, and using SSH keys.
4. Can I re-enable SSH after disabling it?
Yes. Use sudo raspi-config
and navigate to Interface Options > SSH to re-enable SSH.
Conclusion
Understanding and changing the default login credentials on your Raspberry Pi is critical for securing your device. Whether you’re a beginner setting up your first Pi or an experienced user deploying it for advanced projects, following the best practices outlined in this guide ensures that your Raspberry Pi remains safe from unauthorized access.
Take control of your Raspberry Pi’s security today, and enjoy peace of mind knowing your projects are protected.