ssh on virtual box (4.0.4)

Hello,

I have two virtual machines ubuntu on virtual box vm1 and vm2 , i'd like to use ssh to connect from vm1 to vm2, please what's the configuration should do?

Thank you

Log onto both VMs as the user you want to ssh from / to.

On vm2 and then on vm1:

ssh-keygen

(press enter a few times)

While still on vm1:

scp ~user/.ssh/id_rsa.pub user@vm2:/home/user/.ssh/authorized_keys (you need to enter the password)
scp user@vm2:/home/user/.ssh/id_rsa.pub ~user/.ssh/authorized_keys

Change "user" to whatever the username should be.

If .ssh is already configured, then:

scp ~user/.ssh/id_rsa.pub user@vm2:/home/user/.ssh/key.vm1 (you need to enter the password)
scp user@vm2:/home/user/.ssh/id_rsa.pub ~user/.ssh/key.vm2
cat ~user/.ssh/key.vm1 >> ~user/.ssh/authorized_keys
ssh user@vm2 "cat /home/user/.ssh/key.vm2 >> /home/user/.ssh/authorized_keys"

First check that you can at least ping each VM from the other one.