In this lab, you will set up SSH key-based authentication.
Outcomes
Students will set up SSH user key-based authentication to initiate SSH connections.
Create an SSH key pair as student on desktopX using no passphrase.
[student@desktopX ~]$ssh-keygenGenerating public/private rsa key pair. Enter file in which to save the key (/home/student/.ssh/id_rsa):EnterCreated directory '/home/student/.ssh'. Enter passphrase (empty for no passphrase):EnterEnter same passphrase again:EnterYour identification has been saved in /home/student/.ssh/id_rsa. Your public key has been saved in /home/student/.ssh/id_rsa.pub. ...
Send the SSH public key to the student account on serverX.
[student@desktopX ~]$ssh-copy-id serverXThe authenticity of host 'serverX (172.25.X.11)' can't be established. ECDSA key fingerprint is 33:fa:a1:3c:98:30:ff:f6:d4:99:00:4e:7f:84:3e:c3. Are you sure you want to continue connecting (yes/no)?yes/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed /usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys student@serverX's password:studentNumber of key(s) added: 1 Now try logging into the machine, with: "ssh 'student@serverX'" and check to make sure that only the key(s) you wanted were added.
Run the hostname command by using ssh to display the hostname of the serverX.example.com machine without the need to enter a password.
[student@desktopX ~]$ssh serverX 'hostname'serverX.example.com