0

I'm trying to experiment with a small virtual cluster of machines to learn hadoop. I'm using LXD for this purpose. I've installed ssh servers on each vm and now need to connect from one vm to another. Using the IPs I get from lxc list I'm not able to connect (get a 'Connection Refused' error).

Here is (what should be) a reproducible set of commands:

Create machines

for n in 1 2 3 4 5;do sudo lxc launch images:centos/7/amd64 hadoop$n done

Install OpenSSH

for n in 1 2 3 4 5;do sudo lxc exec hadoop$n -- apt-get update sudo lxc exec hadoop$n -- apt-get upgrade -y sudo lxc exec hadoop$n -- yum -y install openssh openssh-server openssh-clients openssl-libs; done

Restart machines

for n in 1 2 3 4 5;do sudo lxc stop hadoop$n sudo lxc start hadoop$n done

Create password less ssh connections

On the machine hosting installer (hadoop1)

(MapR 5.1 requires that the install script be run from one of the nodes where hadoop will be installed, which is why I'm running this script from one of the VMs and not my host laptop)

ssh-keygen

Host OS

sudo lxc file pull hadoop1/root/.ssh/id_rsa.pub .

for n in 2 3 4 5;do sudo lxc file push ./id_rsa.pub hadoop$n/root/.ssh/authorized_keys -p sudo lxc exec hadoop$n -- chmod 600 /root/.ssh/authorized_keys sudo lxc exec hadoop$n -- sudo chown root: /root/.ssh/authorized_keys; done

Test ssh from hadoop1 to hadoop2

ssh root@<ip from lxc list>

...Connection refused

1 Answer 1

0

You can't copy the ssh key like that

There is an ssh command to copy the key properly:

ssh-copy-id user@other-host

A good writeup/guide is:

http://www.beginninglinux.com/home/server-administration/openssh-keys-certificates-authentication-pem-pub-crt

Brian

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .