SSH for password less logins on remote server

| | 1 min read

SSH keys are a way to identify computers, without using passwords. If you have used git, or if you are an active participant in the open-source community, you will be definitely familiar with the important role of SSH. In the case of remote servers, when using SSH logins, the server will ask for password each time you try to login. This could be avoided by adding public key to server's authorized_keys.

First, use the command given below to create SSH key pair.

ssh-keygen

and follow the onscreen instructions.A public key - private key pair should be created inside the .ssh folder of your home folder.

To copy your public key to server, use the below command

ssh-copy-id @

If this method doesn't work (there is a probability that ssh-copy-id is not present in the system), you can use the below command

cat ~/.ssh/id_rsa.pub | ssh user@machine "mkdir ~/.ssh; cat >> ~/.ssh/authorized_keys"

(Assuming that your public key file name is id_rsa.pub)

We are one of the leading Drupal development companies in India. We will be happy to offer you offshore Drupal development services to help you maintain your website. Please feel free to contact us to know more.