Sunday , December 22 2024

How To Create Ssh Key and Connect Another Machine by Copying SSH Key

If you are using Linux and want to securely connect to servers without using a username password, you can create a ssh key and connect to remote server by copying ssh key to that server. Thus, you can connect to servers without a username password and securely.

How To Create ssh key in Centos?

Before creating ssh key, you need to login with the user you want to create ssh key, or you need to switch to that user.

We run the following command to create ssh key.

After running the command, our ssh keys were created under the /home/frks/.ssh directory seen above.

How To Copy ssh key to Another Server?

Let’s make ssh by copying our ssh key to a different server from the machine we are on. We must copy our ssh key to remote server to connect without username and password as below.

Sample Usage:

We copied the ssh key to instance-2 server with the frks user with the above command.

After copying the SSH key, we can connect with ssh as follows.

 

Loading

About Faruk Erdem

Leave a Reply

Your email address will not be published. Required fields are marked *