Generate SSH key

Category: Note to Self

To allow SSH login without password need to generate keys.

To login in via SSH to a remote server

1. On local machine check for a folder  ~/.ssh and check if files id_rsa and id_rsa.pub exist

if files do exist  then go to step 3

2. Generate public and private keys if required:

ssh-keygen -t rsa
 (no passkey)

two files –  id_rsa and id_rsa.pub will be created in ~/.ssh/

the file id_rsa.pub contains is your public key.

3.  Log on to Remote server  and locate/create folder  ~/.ssh
if necessary create a file in this folder called authorized_keys and copy the contents of the public key  (from local machine) into it.

You should now be able to log in to remote machine without a password

example:

perform rsync operation from local machine  to remote server  soyuz

rsync -avz -e ssh /source/path/  remote_user@soyuz:/remote/folder/

Leave a Reply

You must be logged in to post a comment.