How to setup password-less ssh between two vagrant machines?

6

2

I have set up a enviroment of two machines in vagrant where I used the following CentOS image: http://developer.nrel.gov/downloads/vagrant-boxes/CentOS-6.4-x86_64-v20130427.box

Lets call the two machines master and slave.

I would like to be able to talk to the slave from master over password-less ssh, so I followed the instructions in this blog post for setting up password-less ssh: http://www.thecloudavenue.com/2012/01/how-to-setup-password-less-ssh-to.html

The steps in the post would then be:

sudo apt-get install openssh-client
sudo apt-get install openssh-server
ssh-keygen -t rsa -P "" -f ~/.ssh/id_dsa
ssh-copy-id -i $HOME/.ssh/id_dsa.pub vagrant@slave-hostname
cat $HOME/.ssh/id_dsa.pub >> $HOME/.ssh/authorized_keys

The steps works fine and the slave gets the master key written in authorized_keys.

The problem is that the slave keeps asking for password when I try to enter it over SSH from the master.

Are there setting in Vagrant which I need to change in order to get password-less ssh to work?

Leonard Saers

Posted 2013-07-05T13:53:23.520

Reputation: 181

Have you change the permitions? You can try this: http://superuser.com/questions/255396/how-do-i-ssh-without-a-password-setting-up-ssh-keys-doesnt-work

– cfreire – 2013-07-06T15:14:51.663

Thanks for pointing out that link. BillThor had an excellent explanation which lead me to the answer. – Leonard Saers – 2013-07-08T13:39:23.637

Answers

2

The following answer suggested that I have to look at the permission all the way from root to the ssh folder.

https://superuser.com/a/255411/210224

In order to solve the problem I had to add the sticky bit to the home folder.

sudo chmod +t /home

Read the linked answer above for more details.

Leonard Saers

Posted 2013-07-05T13:53:23.520

Reputation: 181