I have VirtualBox Linux 4.15.0-36-generic #39-Ubuntu SMP Mon Sep 24 16:19:09 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux.
I've installed LXD 3.x linux containers I've spun up three instances of ubuntu type containers on them:
+------+---------+----------------------+
| NAME | STATE | IPV4 |
+------+---------+----------------------+
| db1 | RUNNING | 10.81.188.179 (eth0) |
+------+---------+----------------------+
| web1 | RUNNING | 10.81.188.27 (eth0) |
+------+---------+----------------------+
| web2 | RUNNING | 10.81.188.7 (eth0) |
+------+---------+----------------------+
In trying to establish ssh connection to db1 server. I've performed the following setup on the host env :
I've run ssh-keygen which resulted in the following:
~/.ssh/id_rsa
~/.ssh/id_rsa.pub
I have attached to the 'db1' instance like this:
sudo lxc exec db1 /bin/bash
I have then navigated on the db1 box to the /etc/ssh/sshd_config
file and I've set the PasswordAuthentication yes
parameter, and then I restarted the lxc instance
Back on the host node, I've attempted to copy/set the public key on the remote guest node using the following command:
ssh-copy-id -i ~/id_rsa.pub james@10.81.188.179, and
ssh-copy-id -i ~/id_rsa.pub 10.81.188.179
... both unsuccessful. Here is the log:
james@james-virtualbox:~/.ssh$ ssh-copy-id -i ~/.ssh/id_rsa.pub james@10.81.188.179
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/james/.ssh/id_rsa.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
james@10.81.188.179: Permission denied (publickey).
Why won't it add that key to the remote db1 machine... ?!