0% found this document useful (0 votes)
56 views2 pages

Generate SSH Keys and Connect Servers

The document outlines a step-by-step process for generating RSA keys on a Linux server and using them for SSH connections. It includes instructions for copying the SSH key to a second server and connecting to it without repeatedly entering the passphrase. Additionally, it demonstrates how to execute a remote command to create a directory on the second server.

Uploaded by

Tamil Thug Life
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
56 views2 pages

Generate SSH Keys and Connect Servers

The document outlines a step-by-step process for generating RSA keys on a Linux server and using them for SSH connections. It includes instructions for copying the SSH key to a second server and connecting to it without repeatedly entering the passphrase. Additionally, it demonstrates how to execute a remote command to create a directory on the second server.

Uploaded by

Tamil Thug Life
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

1. Start two [Link] lab servers.

This exercise will refer to the servers


as server1 and server2.

2. Working as the user "user", on server1 generate a new RSA public and private key
with a pass phrase of your choosing.

[root@server1 ~]# ssh-keygen

Generating public/private rsa key pair.

Enter file in which to save the key (/user/.ssh/id_rsa):

Enter passphrase (empty for no passphrase):

Enter same passphrase again:

Your identification has been saved in /user/.ssh/id_rsa.

Your public key has been saved in /user/.ssh/id_rsa.pub.

The key fingerprint is:

[Link] root@[Link]

The key's randomart image is:

+--[ RSA 2048]----+

| .o +O* |

| . .oo+. |

| . .. + . |

| . . .E o |

| . So o . |

| . ..o. . |

| . o. |

| . |

| |

+-----------------+
3. Copy the SSH key to server2.

[root@server1 ~]# ssh-copy-id user@[Link]

4. Remotely connect to server2 from server1 using the SSH keys.

[root@server1 ~]# ssh user@[Link]

Enter passphrase for key '/user/.ssh/id_rsa':

5. On server1, issue the correct commands to temporarily store the pass phrase in
your current shell session. This will prevent you from having to enter the pass
phrase each time you connect to server2.

[root@server1 ~]# ssh-agent bash

[root@server1 ~]# ssh-add

Enter passphrase for /user/.ssh/id_rsa:

Identity added: /root/.ssh/id_rsa (/user/.ssh/id_rsa)

[root@server1 ~]# ssh user@[Link]

6. Issue a remote command to create a directory named "test" on server2.

[root@server1 ~]# ssh user@[Link] mkdir test

You might also like