1

In order to get an identical setup between machines with identical hardware, I cloned the drive from one onto the other, then did the ip and hostname configuration to differentiate the two Linux machines. Everything seems to work fine except for scp. (NFS and even ssh between the machines work fine)

Looking at the results of scp -v, it seems to authenticates correctly, but then it copies 0 bytes. Is there any way to fix this? Would generating new ssh keys for the machine work? If so, how do I do that? (Machine level keys, not user level keys)

rck
  • 151
  • 2
  • 4
  • 1
    Can you add the output of scp -v so we can potentially see where it's failing? – Dave K May 15 '09 at 18:00
  • can you paste in the scp -v results? Purge anything sensitive (hostnames or ips)... – Tim Howland May 15 '09 at 18:00
  • 1
    Are you SURE ssh is connecting you to the OTHER machine, and not just back to itself? Does it work both ways? – Brent May 15 '09 at 18:15
  • I'm sure ssh isn't connecting to itself, I can remotely run apps that show up on the other machine's monitor and the like. I'll be back in a bit with the ssh -v – rck May 15 '09 at 22:09

3 Answers3

5

You can regenerate new host ssh keys using the following command:

ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key

If you are on OSX, the location is actually at /etc/ssh_host_dsa_key. Also, you can substitute rsa for dsa if you prefer.

Dave K
  • 2,751
  • 2
  • 21
  • 17
2

You probably have an entry in /etc/hosts that makes the cloned machine think it is the original one.

And if these are virtual machines, ensure that their virtual network cards have different MAC addresses.

Brent
  • 22,857
  • 19
  • 70
  • 102
0

i suspect that the destination have some problem, like read-only filesystem, corrupted filesystem, no sftp, no directory,etc

but anyway, i recommend you to bypass scp and use rsync, it a lot smarter than scp.

rsync -avx file_or_dir destination_host:somedir/

it will copy files, directories, recursive, with resume and all inside the ssh connection, just like scp. of course you have to have rsync installed on both sides.

the options "avx" are:

  • a -> copy all files/dirs/devices/etc with time and owner and permission
  • v -> verbose, show what is copying (use -P to show a progress to the copy)
  • x -> only one filesystem. its always safer to include this, just in case you have other mount points
higuita
  • 1,173
  • 9
  • 13