0

This question already has an answer here:

I just want to run a python file on raspberry pi and use terminal code ssh. So, I don't want type password to do that. What should I do?

marked as duplicate by Ghanima Oct 22 '18 at 19:24

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • what type of system are you initiating the SSH with? You'll want some sort of "SSH authentication agent" – Jaromanda X Oct 16 '18 at 11:22
  • You might want to have a look at this blog entry (and its follow-ups) raspberrypise.tumblr.com/post/148032481829/… – Ghanima Oct 16 '18 at 11:57
  • Use public/private keys instead or as well as password login. You only need an authentication agent if you then use a password for the key. – goldilocks Oct 16 '18 at 13:43
1

You can use public key authentication without protecting the private key with a password. On your management computer execute these commands:

mngmt ~$ mkdir -m 700 ~/.ssh
mngmt ~$ ssh-keygen -N '' -f ~/.ssh/id_ecdsa -t ecdsa -b 521

This will give you a keypair id_ecdsa as private key and id_ecdsa.pub as public key in ~/.ssh/. Now on your client RasPi login as a user, for example pi, and create also:

rpi ~$ mkdir -m 700 /home/pi/.ssh

and copy id_ecdsa.pub from the management computer to home/pi/.ssh/authorized_keys on the client RasPi. Check with a simple ssh from your management computer if it works by executing /bin/hostname on the client. That should return the hostname of the RasPi:

mngmt ~$ ssh pi@raspberrypi hostname
raspberrypi
mngmt ~$

This is a save authentication method as long as nobody else does get access to the private key file id_ecdsa. Everyone owning this file have access to your clients so please pay attention to it.

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