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?

  • what type of system are you initiating the SSH with? You'll want some sort of "SSH authentication agent" Commented Oct 16, 2018 at 11:22
  • You might want to have a look at this blog entry (and its follow-ups) raspberrypise.tumblr.com/post/148032481829/…
    – Ghanima
    Commented Oct 16, 2018 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
    Commented Oct 16, 2018 at 13:43

1 Answer 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
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.