OnWorks Linux and Windows Online WorkStations

Logo

Free Hosting Online for WorkStations

< Previous | Contents | Next >

1.4. SSH Keys‌


SSH keys allow authentication between two hosts without the need of a password. SSH key authentication uses two keys, a private key and a public key.


To generate the keys, from a terminal prompt enter:


ssh-keygen -t rsa


This will generate the keys using the RSA Algorithm. During the process you will be prompted for a password. Simply hit Enter when prompted to create the key.


By default the public key is saved in the file ~/.ssh/id_rsa.pub, while ~/.ssh/id_rsa is the private key. Now copy the id_rsa.pub file to the remote host and append it to ~/.ssh/authorized_keys by entering:


ssh-copy-id username@remotehost


Finally, double check the permissions on the authorized_keys file, only the authenticated user should have read and write permissions. If the permissions are not correct change them by:


chmod 600 .ssh/authorized_keys


You should now be able to SSH to the host without being prompted for a password.


Top OS Cloud Computing at OnWorks: