0

I'm running Raspbian Buster Lite on a board that I normally only access over SSH. The default login is pi/raspberry. I wanted to clear the password for convenience so I logged in and ran "sudo passwd -d root", which I often do on embedded linux systems. The command was accepted with the response "password expiry information changed" which is normal. However, now I am unable to log in over ssh with either a blank password or the original 'raspberry' password.

Is there a way to fix this or do I need to re-flash the memory card?

edit: I don't have a way to connect a monitor, so if I can't get in over SSH I'll have to wipe the memory card and start over. Which is not a huge deal, just a bit of wasted time.

edit2: Resolved now, after wiping the memory card.

3
  • I am sorry @AMTK, I don't think there is any good way of changing the password without actually booting the Pi with a monitor connected. In the future - try to not wipe the root password ;) Commented Nov 26, 2021 at 18:55
  • your title says sudo passwd -d pi - your question says sudo passwd -d root ... so which did you actually do?
    – Bravo
    Commented Nov 27, 2021 at 0:14
  • Good catch Bravo, it was '-d pi'. Anyway it's resolved now, I wiped the memory card.
    – AMTK
    Commented Nov 28, 2021 at 1:13

2 Answers 2

0

According to this website, there are numerous ways to change the raspberry pi password. You can use the "Raspberry Pi Configuration" tool in the menu under "Preferences" (you need a monitor for this), you can run sudo raspi-config, select "system options" and "password", or you can run sudo passwd root and change the root password. In the future, don't clear the root password for the device! There is no need to use the root user, as anything can be accomplished with sudo.

PS(VERY IMPORTANT!!!): When trying to ssh into a raspberry pi you need to specify the username. For example, you would run ssh [email protected] to ssh into a raspberry pi with an IP of 192.168.1.30 and a username of "pi". Chances are, if you wiped the root password you should ssh as root: ssh [email protected]. I hope this helped!

2
  • Thanks. Raspian Buster Lite only seems to have the 'pi' user account which apparently has root privileges since I was able to sudo. One thing I was hoping to find is the password for the actual 'root' account but there doesn't seem to be one. I realized I don't have a monitor cable that can connect to the pi, so I'll probably just reflash if I can't find a quick solution.
    – AMTK
    Commented Nov 26, 2021 at 18:44
  • If you have access to a monitor, keyboard, and mouse, and don't want to try any of the above you can try to create a new user on your pi. You can use the command useradd. A good website with the usage can be found here: educba.com/linux-add-user. Then just ssh into your pi from your new user. I haven't tried this myself, so I am not sure if the permissions will be the same, but it's definitely worth a try :) Commented Nov 26, 2021 at 18:48
0

It is unclear what you are trying to do. If is to remove a password you normally can't with the passwd command. Editing the /etc/shadow file can remove a password, but this is inadvisable.

The Raspberry Pi OS doesn't have a root password (and doesn't need one) and you can't ssh as root and AFAIK can't ssh without password, although you can set private/public keys to allow passwordless access.

To reset your password see:-

Headless Raspberry Pi 4 Password Reset?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.