Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have installed to 2 Ubuntu on VMware and i m trying to communicate between 2 machines using ssh.

I made the following changes Updated the etc/host files on 2 machines Master and Slave with ips

127.0.0.2   slave
127.0.0.3   master

and created a key to communicate between the two machines.

When I try to copy the file from master to slave its copying into the master and not to the slave:

sh-keygen -t rsa -P ""
cat $HOME/.ssh/id_rsa.pub >> $HOME/.ssh/authorized_keys
ssh-copy-id -i $HOME/.ssh/id_rsa.pub user@slave

Trying to copy from master to slave

scp -r /usr/local/somedir user@slave:/home/user/Downloads/Somethings

Could you please let me know where exactly I'm going wrong?

share|improve this question

3 Answers 3

Your using loopback addresses, It looks up slave and that's pointing back to itself

You need to assign your machines local addresses ie. 192.168.0.x

Plus I cannot understand why you need to put the public key in the same hosts authorized_keys file.

share|improve this answer
    
Thanks for the reply.I put the public key to communicate between 2 machines without prompting for password everytime. I will try to change host file and try again. –  Annt May 1 '13 at 16:21
    
The host file is the least of your worrys thats only to link names to ips, get it working with IP's first, you need to setup each host with a local IP address. I can't vouch for vmware but in qemu-kvm you have to setup a network first and then configure your hosts accordingly. –  Shutupsquare May 1 '13 at 16:27

I am not entirely sure what you've done here. Who's the slave and who's the master? Are they both running in virtual machines? What is the host OS? Can you actually access these machines using the IPs you added to hosts?

Assuming your question is only about copying ssh keys around, you need to copy your key to the machines you want to log in to. So, if you are logged in to the "slave", run

sh-keygen -t rsa -P ""
ssh-copy-id -i $HOME/.ssh/id_rsa.pub user@master

Now you can log on to master from slave without a password. You don't need to add anything to the authorized_keys file, that will be done automatically when you log in.

To log into slave from master, you will need to first log into master and then repeat the process:

sh-keygen -t rsa -P ""
ssh-copy-id -i $HOME/.ssh/id_rsa.pub user@slave
share|improve this answer
    
Thanks for the reply.I am new to ubuntu. –  Annt May 1 '13 at 16:25
    
You're welcome. As others have pointed out your main problem will be the IPs you are using. That's why I asked if you can actually access the machines using them. –  terdon May 1 '13 at 16:28

IPv4 network standards reserve the entire 127.0.0.0/8 address block for loopback purposes. That means any packet sent to one of those 16,777,214 addresses (127.0.0.1 through 127.255.255.255) will be looped back.

From

Wikipedia: Localhost

This means that trying to access any IP in the 127...* range will access the local computer.

You need to set the IPs of the VMs to a private subnet allocated by VMware; to do that, set up an "Internal" type network adapter. The IPs should be automatically allocated by DHCP. See the VMware docs on the network editor applet.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.