Getting ready

As with the previous section, confirm that both of your Vagrant boxes are enabled and connect to the first using the vagrant command:

$ vagrant ssh centos1

Ensure you have an SSH key available on centos1. Re-read the previous section on generating an SSH key if you need to:

[vagrant@centos1 ~]$ ls .ssh/
authorized_keys config id_ed25519 id_ed25519.pub known_hosts

Copy your key to centos2 if you haven't already, accepting the host key if you need to:

[vagrant@centos1 ~]$ ssh-copy-id 192.168.33.11
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/vagrant/.ssh/id_ed25519.pub"
/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
vagrant@192.168.33.11's password:

Number of key(s) added: 1

Now try logging into the machine, with: "ssh '192.168.33.11'"
and check to make sure that only the key(s) you wanted were added.

[vagrant@centos1 ~]$

Check that attempting to log into centos2 prompts you for your key passphrase:

[vagrant@centos1 ~]$ ssh 192.168.33.11
Enter passphrase for key '/home/vagrant/.ssh/id_ed25519':

Make sure you're on centos1 to begin.