Linux Server Access Using SSH Key without Password

Linux Server Access Using SSH Key without Password


Generating SSH keys allow you to log in to your Hostway server without the need to enter a password. You can generate SSH keys and install them on the remote server by following the directions in this article.


To complete this task, you will have to generate an SSH Key pair (private and public key) and copy the SSH public key to the remote server.


Generate an SSH Key pair on your local computer:


In your local computer, enter the following command in terminal:


ssh-keygen -t rsa


Press enter to choose the default location of the newly created ssh keys.


Enter the optional passphrase to secure your SSH key with a password, or press enter twice to skip the passphrase step.


You now have a private key in ~/.ssh/id_rsa and a public key in ~/.ssh/ If you used the optional passphrase, you will be required to enter it.


Copy the public key from your local computer to the remote server. Typically, the public key will be saved in ~/.ssh/authorized_keys on the remote server. For example, if you are setting up keys for the root user, the public key will be saved to /root/.ssh/authorized_keys.


Copy the SSH public key to the remote server:


Execute the following command from the remote server:


vim /root/.ssh/authorized_keys


Open a text editor, such as vim. In vim, press ā€œIā€ to enter insert mode, then paste the public key you created into the authorized_keys file.


Press :WQ to save your changes and exit vim.


You should now be able to ssh into the remote server without entering your root password.



You may see an existing public key in the authorized_keys file on the remote server. Take extra care not to delete any of the existing public keys. Hostway may have a public key installed on your server so we can login when you open support tickets.


Was this article helpful?
1 out of 8 found this helpful

Have more questions? Contact our support instantly via Live Chat