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.

I'm trying to use psftp for a nightly sftp upload but I found out that it hangs. Does anyone have any experience with what may cause such hangs? The psftp can stay in this state for days at end. I tried adding -bc and -be to the start up, it already had -batch.

share|improve this question

6 Answers 6

up vote 2 down vote accepted

I assume you are using scheduled tasks to run this nightly?

Open a command prompt (use runas /user:login@domain.com cmd if the task runs with credentials other than your own), then attempt to run the command that you have scheduled. If you are using the -batch parameter, remove it for troubleshooting purposes.

Does the command run properly?

I recently had a similar issue with pscp, it got stuck in a "Running" state because the account the scheduled task was configured to use had not connected to the specific server before and pscp generated the normal "The server's host key is not cached in the registry." prompt and was waiting for confirmation. Using the -batch parameter conceals this prompt. Once I had accepted the prompt once, it ran perfectly, even with -batch.

share|improve this answer

What is it connecting to? We have recently had some issues connecting to VMWare servers although other network traffic works fine. The transfers will stall out after 100-200K of data. We have also had issues in the past where a transfer would finish, but the server would not end the connection. Adding a quit statement to the batch scripts fixed that issue.

share|improve this answer
    
Actually I don't know what's on the other end of the pipe. I'll try adding the quit and see if it makes any difference –  Remus Rusanu Jun 8 '09 at 16:27

It's also possible that there's a server configuration or connectivity issue. You can test this by using the -v (verbose) flag on the transfer as noted in section 3.8.3.3 of the putty manual. Look for any error messages or warnings, and post them in your question.

share|improve this answer

If you transfering just only one (or few) files (usually that's true for backups) you can try using pscp instead of pftp - scp is older and simpler protocol, and it uses different SSH subsystem - so less points of failure.

Here is wikipedia links to this protocols if you are interesting:

share|improve this answer

If you are uploading using secure ftp behind a NAT firewall, or any other NAT device, you will be able to connect/authenticate, but won't be able to upload, list director contents, etc, without first modifying the firewall/NAT rules.

Check http://www.lancerobinson.net/archive/2005/08/23/50912.aspx for more info.

share|improve this answer

Sometimes servers try doing a reverse DNS lookup on your address, so if you're connecting from behind a firewall there will be a 30s+ delay in connecting. This often causes SFTP to timeout. We change the timeout to 60 or 120 when connecting to third parties, which almost always fixes the problem.

share|improve this answer

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.