ssh to VM

      Host: FreeBSD
Guest (VM): NetBSD

Make sure sshd(8) is running on the guest.

service sshd status

If it's not you might need to add that daemon to the rc.conf(5).

sysrc sshd_enable="YES"

It should run automatically after reboot but for now you probably have to start it manually.

service sshd start

With sshd enabled on guest make sure you try to connect to the correct system (VM) from the host.

Run the following command on the guest to display fingerprint of its public key file.

ssh-keygen -l -f /etc/ssh/ssh_host_ed25519_key.pub

Try to ssh to the guest from host and compare fingerprints.

ssh <guest_IP>

Transfer host's public key to the guest with scp(1).

scp ~/.ssh/<host_public_key>.pub <guest_user>@<guest_IP>:

Authorize host's public key on guest.

cat <host_public_key>.pub >> ~/.ssh/authorized_keys

It should be now possible to ssh to guest without credentials.

ssh <guest_user>@<guest_IP>

Consider adding entry to the ~/.ssh/config to make it even easier.

Host <name>
     User <guest_user>
     HostName <guest_IP>
     IdentityFile ~/.ssh/<host_private_key>

Now it's even better.

ssh <name>