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.

Each time I download a big file over sftp, the md5sum on the source machine doesn't match the md5sum I do on the destination machine.

I have a 13gig file on an Ubuntu 12.04 machine with openssh-server running.

I used FileZilla to download that file to my laptop over sftp. However, the file isn't exactly the same after the download completes.

Perhaps the FTP protocol isn't the best choice? Without an external hard-drive handy, what the most certain way I can transfer this file and be certain that the copy I get is exact?

share|improve this question
1  
FTP is not SFTP. –  Ignacio Vazquez-Abrams Aug 6 '12 at 4:09
    
Are you sure it is at all related to the size? Have you tried a small file (like 100mb)? If it also fails then you make a GREAT job listing misleading elements in your question. –  TomTom Aug 6 '12 at 4:14
2  
You can use rsync to fix any discrepancies in the file. Just make sure you run it in the right direction! –  David Schwartz Aug 6 '12 at 4:17
    
@Ignacio: sFTP IS FTP (over ssh); the ftp protocol is still used in sFTP. And, as protocol I don't believe it makes much effort in ensuring a download is exact; the larger the file, the less likely it is to be exact. –  LonnieBest Aug 6 '12 at 4:28
1  
You're thinking of FTPS, which is FTP over SSL. SFTP is a completely different protocol. –  Ignacio Vazquez-Abrams Aug 6 '12 at 4:32
show 1 more comment

2 Answers

up vote 1 down vote accepted

SFTP can actually still suffer from potential issues related to ASCII/binary transmission modes, etc.; I recommend using SCP (Secure Copy, via SSH) instead. If your destination machine is a Windows machine, one of the best clients -- also free -- is the PuTTY binary pscp.exe from http://www.chiark.greenend.org.uk/~sgtatham/putty/.

To copy from the source to destination using pscp.exe, open a Windows command prompt to the location where pscp.exe is saved, and run the following:

pscp.exe [username]@[remote-machine]:[path-to-file] [local-save-location]

share|improve this answer
1  
I understand the distinction between SFTP and FTPS. Nevertheless, anecdotally, I have still encountered transfer issues on occasion using SFTP, and therefore recommend SCP for a guarantee of file integrity. –  Matt Aug 6 '12 at 7:19
add comment

I agree that I believe that for some reason you are running ASCI transfer mode between the two machines. The line terminators between Windows type machines and UNIX based machines are different, and transfer in ASCI mode causes an automatic line termination conversion.

Running in BINARY mode, makes no translation whatsoever. SFTP I believe has ONLY a binary transfer mode.

There of course is a caution, the content may be interpreted different despite the checksum if you are attemmpting to transfer Windows TEXTUAL material to Linux (and visa versa). Some editors however take care of these line termination details automagically but NOT all.

share|improve this answer
add comment

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.