-
Notifications
You must be signed in to change notification settings - Fork 63
/
Copy pathssh auth
73 lines (36 loc) · 1.64 KB
/
ssh auth
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
1. Start two LinuxAcademy.com 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:
43:eb:29:50:45:57:78:64:58:03:d3:e3:e2:52:dc:0b root@server1.mylabserver.com
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@52.25.4.176
4. Remotely connect to server2 from server1 using the SSH keys.
[root@server1 ~]# ssh user@52.25.4.176
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@52.25.4.176
6. Issue a remote command to create a directory named "test" on server2.
[root@server1 ~]# ssh user@52.25.4.176 mkdir test