We earn commission when you buy through affiliate links.
This does not influence our reviews or recommendations.Learn more.
Using SSH it’s possible for you to manage and administer remote servers securely.
This can be helpful in many ways.
I will generate a private key and a public key.
The private key should be stored on your ssh client machine and must be kept secured.
Youll learn the following.
If it is not installed, initiate the commands below to install.
Generate SSH Keys
This needs to be done on a client server.
Run thessh-keygencommand to generate a SSH key.
Just press enter when it asks for the file, passphrase, same passphrase.
It generates a pair of keys in ~/.ssh directory by default.
Id_rsa is the private key and id_rsa.pub is the associate public key.
It will generate two new files in~/.sshdirectory.
Copy SSH Key to Remote Server
The private key should be copied~/.sshfolder on a remote server.
Most of the servers should already have this folder if not, you should probably create a folder.
And, to do so:
If you already have .ssh folder then take a backup of it.
Next, lets push the public key from a client server.
launch the command below to set permissions on the authorized_keys file on remote server.
Great, this concludes key is exchanged and permission is all set.
Login to Remote Server using SSH
Lets test to see if it works!
Lets login to the remote server (192.168.56.101) from a client machine (192.168.56.102) as geekflare user.
trigger the command below to test, it wont ask password this time.
I have logged in to remote server successfully.
Running below command will give the IP details of the remote machine.
Conclusion
Setting up SSH key exchange is very straightforward as you’ve got the option to see.
I hope this helps you and interested in learning Linux administration and troubleshooting then check out thisUdemy course.