reset password with physical access

January 31, 2024, 22:49

nickwebcouk

What’s the simplest way to reset a password with physical access to a pi? Have one set up but lost the password. I have it set up as a server and want to keep the data. It’s accessible in that I can u plug and remove it and the SD card but it’s not anywhere near a keyboard/mouse and monitor. I know I can init/sh the commandline.txt but this would then require a monitor and keyboard to change the password. I have a laptop that I can plug the SD card into. Whats the easiest way to reset the password?

jannik44

you could plug the sd card in your laptop and copy all your files over

oops.se

1. Open the file /etc/shadow on your SD card 2. Generate a new password, openssl passwd -1 -salt test newpassword 3. Replace the long cryptic text after the user you want to reset the password for, but keep the ":" structure. Example test:appWTvv667:14454:::::: This is for user test and replace the password appWTvv667 with the one generated in the previous step. Requirement: - Filesystem driver for Linux filesystem (Windows) - OpenSSL

nickwebcouk

Perfect. Thanks!

oops.se

What OS do you have on the laptop?