[et_pb_section bb_built=”1″][et_pb_row][et_pb_column type=”4_4″][et_pb_text _builder_version=”3.1.1″ text_font=”Open Sans||||||||”]
SSH or Secure SHELL is the most popular and trusted UNIX-based cryptographic network protocol. It can be used for secure data communication, remote server logins, remote command execution, and many other secure network services between two networked servers. Normally, password authentication is used to connect to a remote server via SSH. In this blog tutorial we will show you how to login to a remote Linux VPS without password, using SSH keys. This method is more secure than using a password.
SSH login without password
First of all, we need to generate the public and private keys. We will use the RSA (Rivest-Shamir-Adleman) cryptosystem.
ssh-keygen -t rsa Generating public/private rsa key pair. Enter file in which to save the key (/root/.ssh/id_rsa): PRESS ENTER Enter passphrase (empty for no passphrase): PRESS ENTER Enter same passphrase again: PRESS ENTER Your identification has been saved in /root/.ssh/id_rsa. Your public key has been saved in /root/.ssh/id_rsa.pub. The key fingerprint is: 4a:91:e0:19:89:37:41:ce:3e:ff:56:2c:02:eb:65:cb [email protected] The key's randomart image is: +--[ RSA 2048]----+ | o=o | | .+++ . | | .=.o | | .. . | | oo. S. | | .++.. o | | . +oo o | | . E.. | | .. | +-----------------+
This will create 2048 bit public and private keys in the ‘/root/.ssh/’ directory on your server
ls /root/.ssh/ id_rsa id_rsa.pub
Create a new ‘.ssh’ directory on the remote server
ssh [email protected]_SERVER mkdir -p .ssh
Copy the newly generated public key to the remote server you want to SSH without password
cat /root/.ssh/id_rsa.pub | ssh [email protected]_SERVER 'cat >> /root/.ssh/authorized_keys'
Change the permissions of the public key and the ‘.ssh’ directory
ssh [email protected]_SERVER "chmod 700 .ssh; chmod 600 .ssh/authorized_keys"
Now, login to the remote server and configure the SSH server to accept key authentication. Open the SSH configuration file
And make sure that the following three options are not commented and ‘RSAAuthentication’ and ‘PubkeyAuthentication’ are set to ‘yes’.
RSAAuthentication yes PubkeyAuthentication yes AuthorizedKeysFile %h/.ssh/authorized_keys
Save the changes and restart the SSH server
That’s all. You should be able to the remote server without password
Of course you don’t have to do any of this if you use one of our Linux VPS Hosting services, in which case you can simply ask our expert Linux admins to explain or set up SSH login without password. They are available 24×7 and will take care of your request immediately.
PS. If you liked this post on SSH login without password, please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.