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