Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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)

share|improve this question
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
add comment

3 Answers

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.

share|improve this answer
add comment

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.

share|improve this answer
add comment

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
share|improve this answer
add comment

protected by MadHatter May 28 '13 at 15:59

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

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