The fastest way to find your Raspberry Pi username
If you can connect to your Raspberry Pi through a monitor and keyboard, open a terminal window and type whoami, then press Enter. The name that appears is your current username. If you are logged in as the default user on a fresh Raspberry Pi OS installation, this will almost always be pi.
If you cannot remember which user account you are logged into, or if you need to see all usernames on the device, type cat /etc/passwd in the terminal. This shows every user account on your Raspberry Pi. Look for lines that end with /bin/bash — those are the accounts that can actually log in. Accounts ending in /usr/sbin/nologin are system accounts and not meant for human users.
The username appears at the very start of each line, before the first colon. For example, a line reading pi:x:1000:1000::/home/pi:/bin/bash tells you that pi is a valid login account.
Key Takeaways
- Type whoami in a terminal to see which user account you are currently logged into.
- Type cat /etc/passwd to see all user accounts on your Raspberry Pi; look for lines ending in /bin/bash to find login accounts.
- The default username on a fresh Raspberry Pi OS installation is pi, but this can be changed during setup or by the previous owner.
- If you cannot access the terminal, you may need to reset your Raspberry Pi or use a different device to read the SD card.
Finding the username if you are locked out
If you cannot log in because you do not remember the password, the terminal method will not work. In this case, you need to access the SD card from another computer. Remove the SD card from your Raspberry Pi, insert it into a card reader connected to a Windows, Mac, or Linux computer, and open the file manager.
Navigate to the etc folder on the SD card. Open the file named passwd with a text editor — right-click it and choose "Open With" if the file does not open automatically. Search for lines that end with /bin/bash. The username is the text before the first colon on that line. Once you know the username, you can reset the password using Raspberry Pi's official recovery tools or by creating a new user account.
Checking usernames over SSH or network connection
If your Raspberry Pi is on your network and SSH is turned on, you can find the username without physically accessing the device. On Windows, Mac, or Linux, open a terminal or command prompt and type ssh pi@raspberrypi.local, then press Enter. If this connects, you are logged in as the pi user. Type whoami to confirm.
If that command does not work, your Raspberry Pi may have a different hostname or username. Try ssh pi@192.168.1.1, replacing the IP address with your Raspberry Pi's actual address on your network. You can find the IP address by checking your router's connected devices list, or by using a network scanning tool like Angry IP Scanner.
If you do not know the password for the pi account, you will not be able to connect this way. Return to the SD card method described above.
Understanding the default Raspberry Pi user account
Raspberry Pi OS comes with a default user named pi that has full permissions to install software, change settings, and control hardware like GPIO pins. This account is created during the first boot of a new installation. If someone else set up your Raspberry Pi, they may have created a different username instead of using pi, or they may have disabled the pi account entirely.
Starting with Raspberry Pi OS version 12 (Bookworm), released in 2024, the installer no longer creates a default pi user automatically. Instead, you set your own username during the first setup. If your Raspberry Pi is running an older version of Raspberry Pi OS, the pi user will be present unless someone removed it.
What to do if you find multiple usernames
When you run cat /etc/passwd, you will see many lines. Most of these are system accounts used by the operating system itself, not real people. System accounts typically have names like root, daemon, bin, sys, sync, games, man, lp, mail, news, uucp, proxy, www-data, backup, list, irc, gnats, and nobody. These accounts end with /usr/sbin/nologin or /bin/false and cannot be used to log in.
The accounts you care about are the ones ending in /bin/bash. On a standard Raspberry Pi, you will usually see only root (the system administrator account) and pi (or whatever custom username was created). If you see other names ending in /bin/bash, those are additional user accounts that someone created.
Recovering access if you know the username but not the password
Once you know the username, you can reset the password without erasing your files. The easiest method is to use Raspberry Pi Imager, the official tool for setting up Raspberry Pi OS. Insert your SD card into a card reader on another computer, open Raspberry Pi Imager, select your SD card, and click the gear icon in the bottom right. Choose "Set username and password" and create new credentials. This will reset the password for the account you specify without affecting your data.
Alternatively, you can boot your Raspberry Pi into single-user mode (also called recovery mode) by editing the boot configuration on the SD card from another computer. This is more technical but does not require reinstalling the operating system. Instructions for this method vary depending on your Raspberry Pi model and the version of Raspberry Pi OS you are running.
Frequently Asked Questions
Is the default username always "pi"?
On Raspberry Pi OS versions before Bookworm (released before 2024), yes. Newer versions ask you to create your own username during setup. If someone else set up your Raspberry Pi, they may have chosen a different name or disabled the default account.
What if "whoami" returns "root"?
You are logged in as the root user, which is the system administrator account. This works for most tasks, but some software expects a regular user account. If you need a standard user account, you can create one using the adduser command in the terminal.
Can I find the username without removing the SD card?
Yes, if you can access a terminal on the Raspberry Pi itself or connect over SSH. If you cannot log in at all and do not know the password, removing the SD card and reading it from another computer is the only option.
What does the output of "cat /etc/passwd" actually mean?
Each line contains seven fields separated by colons: username, password status, user ID, group ID, description, home directory, and login shell. For finding usernames, you only need to look at the first field and the last field (the shell). If the shell is /bin/bash, it is a real user account.