Here are steps, how to do it in Linux type environment on LOCAL host:
- USER_REMOTE=username@remote-host
- ssh-keygen -t rsa #no password
- ssh $USER_REMOTE mkdir -p .ssh
- cat .ssh/id_rsa.pub | ssh $USER_REMOTE ‘cat >> .ssh/authorized_keys’
- ssh $USER_REMOTE ‘chmod 700 .ssh; chmod 640 .ssh/authorized_keys’
- ssh $USER_REMOTE
Step 2 is necessary only if you don’t have id_rsa.pub file yet
Steps 3,4,5 need remote password
Steps 3 and 5 are not necessary, if the file .ssh/authorized_keys with appropriate access rights is already on remote host
Step 4 actually transfers the public key
Step 6 does not need password, you are there already, congratulations!