1

I have a script that sends 8 files to the same server. Running all 8 commands separately works, but when I run the script, the 5th scp command will timeout after the 4 previous files are transferred.

I replaced the 5th command with a simple ssh command with -vvv turned on and get the following messages:

OpenSSH_5.3p1, OpenSSL 1.0.1e-fips 11 Feb 2013
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to 192.168.1.14 [192.168.1.14] port 22.
debug1: connect to address 192.168.1.14 port 22: Connection timed out
ssh: connect to host 192.168.1.14 port 22: Connection timed out

I've also tried tuning the following values in /etc/ssh/sshd_config on the server I'm sending files to. ClientAliveCountMax, MaxSessions, MaxAuthTries, but none of them solved the problem. (note: have restarted sshd after editing file)

Any thoughts on what else might be the problem?

1

A likely explanation is that the server has a firewall which is throttling SSH connections (not uncommon to avoid bots incessantly trying to find a password). If it's UFW, use:

ufw status

to list the current values. You should see (among other things):

To Action  From
22 LIMIT   Anywhere                  

You can lift the restriction for specific addresses using

ufw insert 1 allow in from nnn.nnn.nnn.nnn

If it's raw iptables, then it's the same idea but the adequate commands are beyond my expertise (be careful to not fence you off your server).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.