SSH or Secure Shell is network protocol that allows users to connect with remote server using command line. To login with SSH, you can either use remote server password or you can use SSH keys which doesn't require to input password on connection.
To connect with remote server, first you need to generate SSH keys in your local system. Then you need to upload keys in your account in provider.
Run the below OpenSSH command to generate SHA256 RSA key pair in your local system.
This will ask you to select the location where you want to generate keys. The default path is ~/.ssh. SSH automatically check the keys at this location so it is advised to keep default location.
Then it will ask to enter and confirm passphrase. You can simply press enter to keep passphrase empty.
Once you press the Enter SSH keys will be generated on the selected. The below out
You can see ~/.ssh directory generated. In this directory id_rsa is private key, id_rsa.pub is your Public key and known_hosts with string.
Now you need to add your SSH public key in your account. You can add it through your providers account portal. For example, if you are using Digital Ocean server, then you can find option in Settings > Securiry.
When you click Add SSH Key, it will ask to input public key.
Paste the public key from /home/user/.ssh/id_rsa.pub and save it. Now connect with your remote server using ssh command.
ssh [email protected]8.23
If everything goes right, you will connected with remote server without asking for password.
Was this article helpful?
Leave a comment
Copyright 2021 HackTheStuff