kenfallon / fix-ssh-on-pi

Safely enabling ssh in the default Raspberry Pi OS (previously called Raspbian) Image
MIT License
80 stars 36 forks source link

shadow root password change not quite correct ? #21

Open rwestgeest opened 1 month ago

rwestgeest commented 1 month ago

Hey, I was looking through your bash script. Nice work. I wondered though if line 408 works the way you expect:

sed -e "s#^root:[^:]\+:#root:${root_password_hash}:#" "${sdcard_mount_p2}/etc/shadow" -e  "s#^pi:[^:]\+:#pi:${pi_password_hash}:#" -i "${sdcard_mount_p2}/etc/shadow"

it contains a -i to interactively edit /etc/shadow at the end but /etc/shadow is also elsewhere on the line. Isn't that superfluous?

I tried both with and without, both seemed to work.