docs:ssh:public_key_authentication

This is an old revision of the document!


You know you can connect to a host with ssh by typing a password when requested. However it is usually easier, especially for a scripted environment, to run ssh without having to type the password. This also keeps the user password safe.

  1. on the connecting client, NOT the ssh server host, generate a public/private key pair (don't type a password when asked)
    ssh-keygen
  2. this creates a private key ~/.ssh/id_rsa, and a public key ~/.ssh/id_rsa.pub
  3. the single line inside the public key file needs copied to a file on the ssh server host at ~/.ssh/authorized_keys
  • the authorized_keys file may contain one or more lines for all the hosts that are authorized to connect
  • the authorization files are per user on the host, so the appropriate user should hold the authorized_keys file
  • docs/ssh/public_key_authentication.1254621006.txt.gz
  • Last modified: 2009/10/03 19:50
  • by billh