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

I have an issue on my server: when folder quota is reached and someone tries to upload a file, he doesn't get any error code and he deposits a 0 bytes file. So I want to know if there's any solution (integrity check for example) to check if the file is well transferred.

share|improve this question

5 Answers 5

Not really. The best you could do is run sha1sum via ssh against the remote file and see if that matches the same hash of the local file.

A different tool such as scp or rsync may return an error code on transfer failure.

share|improve this answer
    
scp and rsync allow to perform ssh file transfert but i specially need to do it using sFTP –  achraf May 11 '10 at 12:56

sFTP protocol has buildin error checking.
That the client creates a zero-byte file in stead of given the user an error message can be due to 3 things:

  1. The server doesn't return the error properly to the client. (I've seen that happen with quota issues...) If that is the case the only way to verify that the file was transferred OK is to read it back (by the client) and compare to the original file client-side. (I'm assuming you can't make changes server-side.)
  2. The server returns the error, but the sFTP client program doesn't handle this properly. Get a different sFTP client. (Please note that in some clients error-handling can be disabled. Check the settings.)
  3. The client did handle the error but the user simply ignored it: Educate your user.
share|improve this answer

sftp has built in integrity checks, so I can only assume the user did not notice the error.

share|improve this answer

There are specific SFTP protocol extensions to calculate file hashes, and such extensions are supported by most clients and servers (it's very common). See this link for full documentation of such extensions: https://tools.ietf.org/html/draft-ietf-secsh-filexfer-extensions-00#section-3

Anyway, given the above, I would recommend to use a SFTP client that supports such extensions and calculate the hash code of your file both on the client and the server (after transfer) and check if they're the same. That's the safest way to accomplish your goal.

share|improve this answer

Compare with md5sum the checksum of the 2 files

share|improve this answer
    
@ignacio & @drfalk3n : yes but the problem is that i cant perform the checksum on production server. is there any solution to do the check on client side ? –  achraf May 11 '10 at 12:08
    
@achraf: Why can't you? Perform before upload. Then after download. –  abatishchev Nov 24 '13 at 21:32

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.