Ubuntu SFTP file uploads get disconnected

sftpUbuntu

I have a few servers running Ubuntu Server 12.04.4 LTS, and they have all had an intermittent problem with uploading files from my Windows development machine. Occasionally when an upload is started (via SFTP) the upload starts in the client, the file is created server side, then it times out. The file on the server remains at 0kb. It can be deleted or overwritten, but once this has occurred once, each subsequent file upload results in the same problem for a period of time, sometimes 5 minutes, sometimes hours. Downloads work normally. File size doesn't seem to matter (1kb or 50mb), different SFTP clients result in the same error. Pulling my hair out over this one, and all my searching has not turned up an answer.

Update: Using PHPStorm, I am still running into this same issue, but it gives a little more information. The upload progress bar completes, it spins for a while, then it says:

Failed to transfer file 'filename.ext': could not close the output stream for file "sftp://host.tld/filename.ext".

I tried turning off the firewall on the server, thinking maybe it was getting in the way (sudo ufm disable) to no effect.

Update 2 (2014-07-29) I have found that if I connect to an encrypted VPN, I never have this issue, and it fixes the issue if I enable it after having problems without it. This leads me to think that this is somehow connected to my ISP? Is this at all a possibility? The only difference in the traffic is that it is encrypted to the VPN source, which is NOT internal to the server (so the server is still seeing it as external traffic).

Best Answer

Use something like wireshark to see what packets are being generated and sent in both directions. Get to the lowest level you can and see what's actually happening.