When you start using a Raspberry Pi or BeagleBone Black, they come with a default username and password. While this makes it easy to log in and get started, it also makes it easy for anyone to log in. We should probably do something about that. Luckily this isn’t very hard to fix, you just need to create a new account and disable the default account.
Changing the username and password on a Raspberry Pi or BeagleBone Black
On a Raspberry Pi, the default username is
raspberry and the password is
pi, and on a BeagleBone Black, the default username is
debian and the password is
temppwd. We will secure our system by creating a new user and disabling the default user.
We’ll be working from the terminal, so start a shell if you aren’t already working from the command line.
- Log in to your system using the default username and password.
- Create a new user:
sudo adduser username
You’ll want to replace
usernamewith the username you want to use for the new account.
- Now you’ll be asked a variety of questions, for the user’s full name and other details. You can either answer these questions or just hit
Enterto skip through them. The one important step you’ll want to watch for is setting the password. Make sure you enter in a secure password for your new account.
- Your new user is now created, but by default new accounts don’t have administration privileges. Set the new account as an administrator by entering:
sudo adduser username sudo
Remember to replace
usernamewith the username you used above when creating the account.
- Lastly, let’s disable the default account. We can prevent it from being used by marking the password as having expired. The command to do this for a Raspberry Pi is:
sudo passwd -l raspberry
and for a BeagleBone Black:
sudo passwd -l debian
Now that the new account is created, reboot the system with the following command:
You’ll then be able to log in with your new username and password!