0

My goal is to remotely access the RPI or interface with it without connecting it directly to a keyboard and monitor.

I'm using Putty to access the RPI. When I'm prompted for the username I supply a username, but I'm not able to supply a password; I forgot it. Is there a way reset the password without logging into the RPI first?

What does it mean to mount a root to the filesystem? What's happening exactly when I do that?

  • "When I tried to log into my RPI with my password, I'm denied access. How could I change the password if I can't access the RPI?" -> Please be explicit about exactly what you mean by "denied access", eg., what the specific error from PuTTy is. – goldilocks Oct 14 at 18:40
  • BTW, "mount the root of the system" probably refers to mounting the root filesystem, which you can't do on Windows without additional software. – goldilocks Oct 14 at 18:42
  • Mounting the root filesystem is a general unix question. You should better asked it at unix.stackexchange.com – Ingo Oct 15 at 7:55
  • "you should better asked it at..." sounds more natural to say instead "you should try asking it at..." Just in case you're learning English : ) – KdS Oct 21 at 22:33
1

You asked

Is there a way reset the password without logging into the RPI first?

ssh is the abbreviation for Secure SHell. It would break any meaning of this name if you are able to modify/reset the password without authentication. You can't never do it remotely (except you are using an unknown exploit). You have to login local with keyboard and monitor attached provided you know the password of another account (root) that can modify passwords of other user. Otherwise you have to put out the SD Card of the RasPi and attach it with your card reader to a computer that is able to read the ext4 file system. MS Windows can't. Then you have to modify etc/passwd and etc/shadow on the SD Card. For example, if the second partition (ext4 formated root partition) of the SD Card is mounted to /mnt/, you can reset the root password:

in /mnt/etc/passwd set line

root:x:0:0:root:/root:/bin/bash
to
root::0:0:root:/root:/bin/bash

in /mnt/etc/shadow set line

root:*:17555:0:99999:7:::
to
root::::   (4 colons are important!)

If you boot the SD Card next in the RasPi then login with user root and just hit enter when asked for the password. Don't forget to set immediately a new password.

  • That last part about modifying the files. I think one of the files is called "cmdline.txt." I've seen some articles that advise writing init=/bin/sh somewhere in the file I'm assuming after rootwait (regardless of whatever else follows after "rootwait"). I don't know which other files I should modify. – KdS Oct 21 at 22:30
  • @KdS I have updated the answer at the end. – Ingo Oct 22 at 8:11
  • @KdS Your question popped up again. Doesn't it work? If it works, please accept the answer with a klick on the tick on the left side. This will finish the question and it will not pop up again months for months. – Ingo Nov 21 at 11:46
  • I had no idea that was happening. Still learning to use the site and just returned today. Thanks for letting me know. – KdS Nov 26 at 1:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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