SSH Public Key Based Authentication

Motivation: I want to acces to my Bluehost server from my local computer, make some file copies ‘scp’ but from a script executed by Crontab, so I don’t want to introduce my password manually.
Solution:

  • Generate the key from your local machine (I don’t think it’s needed but, store the keys in ~/.ssh

    1
    
    ssh-keygen -t rsa
    ssh-keygen -t rsa
  • Copy the public key to your server:

    1
    
    scp .ssh/id_rsa.pub username@server_name_address:.ssh/authorized_keys2
    scp .ssh/id_rsa.pub username@server_name_address:.ssh/authorized_keys2

Source: ciberciti

Leave a Reply

Your email address will not be published. Required fields are marked *

*