On 02/06/19 10:33, Richard Lewis wrote:
> I have a RaspberryPI with Raspbian I can ssh to it as I previously swapped
> keys, I can even run sudo without having to enter a password.
>
> But I have forgotten what the password is, given my current level of
> privileges is it possible to somehow recover the pw?
>
> TIA,
> RenMas
>
password reset is usually pretty simple. boot into a single user
console, where a login is (most likely) not required. then run 'passwd'
to create a password for root. log in as usual after that, using new
password.
If you can't leverage single-user mode, and ALSO don't have a user
capable of running 'sudo su' [mentioned earlier by someone else], you
can boot up a different Linux image in which you know what the password
is, and mount the SD card for the image you need to reset the password
on, and THEN use 'chroot' and the 'passwd' utility to assign the
password onto the other SD card's /etc/shadow and /etc/passwd files
so if you mount the original SD to /mnt, then you should be able to do this:
chroot /mnt
passwd root
(enter new password)
That assumes that you're running it on an RPi booted with a different
but compatible Linux image and are logged in as 'root', so that doing
the 'chroot' on the mounted SD card gets you "the OS" as you'd normally
see it [and you can safely operate on it this way].
there may also be an easier way, but this should work for resetting a
root password using a 'virgin' image in which you haven't changed the
passwords from their default values.
--- SoupGate-Win32 v1.05
* Origin: Agency HUB, Dunedin - New Zealand | FidoUsenet Gateway (3:770/3)
|