Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I'm having trouble copying several very large sql dumps via SSH

I used this command:

/usr/bin/scp -P 2382 /ec2/path/file.sql root@$

And also

/usr/bin/scp -P 2382 -i My2KeyPair.pem /ec2/path/file.sql root@$

Every time I get this:

ssh: connect to host port 22: Connection timed out lost connection

Removing the -i port switch didn't help.

Source server is an EC2 instance (Amazon Standard linux AMI)
Destination is a dedicated server (CentOS 6.4 minimal)

I googled a lot, one suggestion that came up is to open port 2382 by editing this file: /etc/sysconfig/iptables

I entered this code that I borrowed from iptables.old:

-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 2382 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited

and restarted iptables:

`/etc/init.d/iptables restart`

But that didn't help either!

I'm clueless, any suggestion would be more than welcome!

share|improve this question
is the iptables configuration running on the source or on the destination server? Is sshd on the destination server running on port 22 or on 2382? – etagenklo Jun 7 '13 at 16:52
@etagenklo: I changed the iptables configuration on the destination server of course, and sshd is running on port 22 (as I said it didn't work on port 22 either) – TheDude Jun 7 '13 at 17:00
can you login from the source to the destination server via ssh? – etagenklo Jun 7 '13 at 17:02
@etagenklo Yes of course (I am right now, using port 22) – TheDude Jun 7 '13 at 17:03
So the destination server is reachable from the EC2 instance via ssh (or only from other places)? I just ask because your error message says it is not. – etagenklo Jun 7 '13 at 17:04

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.