SFTP put Timing Out

December 17, 2017 by  Filed under: Computer 
 

SFTP is more secure and tends to be more reliable than FTP, so it is the recommended option where possible. To use SFTP, your FTP program may include one of the following:

 

  • The option to use SFTP from a menu.
  • A field to enter Port 22.
  • The ability to enter your server URL as sftp://example.com. Please replace example.com with your own domain name.

Problem:

While using SFTP and using Bitvise sftp client from a Window server 2008/R2 box for some my project and trying to send a file about 6MB out to a partner, the upload is stopping at 100% with and I am constantly getting a error similar to the following:

sftp> cd RPS04

Remote working directory: /RPS04

sftp> lcd c:/file_dir

Local working directory: c:/file_dir

sftp> put “current_statements_2012_03_13.xml.pgp”

local …c:file_dircurrent_statements_2012_03_13.xml.pgp

-> remote /RPS04/current_statements_2012_03_13.xml.pgp OK

Uploaded 4023065 bytes, 10 seconds, 397026 bytes/second

Warning: Setting remote file modify time failed: Permission denied. The requested operation cannot be performed because there is a file transfer in progress.

sftp> dir

listing remote directory /RPS04

ERROR: Server disconnected without sending a disconnect message.

Warning: Opening remote directory for listing failed: Connection lost.

The first warning about permission denied when changing file time is ok as it won’t cause anything to the connection. But then there is the ERROR that caused the job to fail.

I have tried to use keep alive and getting the same error. Here is the command line we used:

c:/opt/bitvise/sftpc.exe -ka -cmdFile=c:/working_dir/FTPCmds_export.txt -keypairFile=c:/users/jobuser/.ssh/id_rsa

email@removed > c:/log/ftp/ftp_log.txt

I have a hard time to get the partner to check on their end, so I am trying to as much as I can on my end first.

Solution:

If you use ssh a lot, you may have noticed that your ssh session times out and you’re logged out every once in a while. There are 2 ways to fix it. You only need to do one of them so choose whichever one is easiest for you. You’ll need root access, so for most people it’s probably safer to do the client fix rather than the server fix.

Way 1: On the server, login as root and edit /etc/ssh/sshd_config and add the line:

ClientAliveInterval 60

According to man sshd_config, this line,

Sets a timeout interval in seconds after which if no data has been received from the client, sshd(8) will send a message through the encrypted channel to request a response from the client. The default is 0, indicating that these messages will not be sent to the client. This option applies to protocol version 2 only.

Don’t forget to restart sshd on the server after you save the file.

Way 2: An easier and safer way is for your desktop machine to send those keep alive messages. As root on your desktop machine, edit /etc/ssh/ssh_config and add the line:

ServerAliveInterval 60

That will send a message to the server every 60 seconds, keeping the connection open. I prefer this way because I login to several machines every day, and I don’t have root access to all of them.

Speak Your Mind

Tell us what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!


You must be logged in to post a comment.

Prev Post:
Next Post: