-1

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.

AMTK
  • 1
  • 1
  • 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 ;) – Quizzer515SY Nov 26 '21 at 18:55
  • your title says sudo passwd -d pi - your question says sudo passwd -d root ... so which did you actually do? – Bravo Nov 27 '21 at 00:14
  • Good catch Bravo, it was '-d pi'. Anyway it's resolved now, I wiped the memory card. – AMTK Nov 28 '21 at 01:13

2 Answers2

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 pi@192.168.1.30 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 root@192.168.1.30. I hope this helped!

Seamus
  • 21,900
  • 3
  • 33
  • 70
Quizzer515SY
  • 109
  • 4
  • 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 Nov 26 '21 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: https://www.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 :) – Quizzer515SY Nov 26 '21 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?

Milliways
  • 59,890
  • 31
  • 101
  • 209