With a whole fleet of Raspberry Pi boards, it's sometimes a chore remembering all the passwords. Short of writing the password on a post-it stuck to each Pi, here are a few tricks.
Set up ssh authentication. If you haven't already, generate the private/public key-pair on your workstation.
ssh-keygen
Answer all questions with <Enter>.
This will generate your private key.
~/.ssh/id_rsa
And your public key.
~/.ssh/id_rsa.pub
Now copy your public key to the raspberry pi.
ssh-copy-id pi@raspberry.lan
Now you no longer need a password when logging in from your workstation because the pi trusts it.
ssh pi@raspberry.lan
You will still need the password when logging in from other devices, but if you ever forget it, you can do a password reset without knowing the password with the following command.
sudo passwd pi
No comments:
Post a Comment