Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We are setting up a backup system for our webserver with rsync through ssh.

On the client side (i.e. the webserver): We have a shared hosting plan which gives us shell access. However, it restricts access to any port aside from 22 for SSH. It will not accept connections on port 25022.

On the server side (i.e. the backup server): The server is only open on port 25022, it will not accept connections on port 22.

Is there any way to get these two servers to communicate via SSH? I have limited knowledge of this sort of stuff, but my intuitive sense makes me feel like there ought to be a way to resolve this problem.

Any advice is greatly appreciated!

share|improve this question
I believe your question is a duplicate:… – Sun Jul 30 '13 at 19:48
I don't think this is a duplicate of that linked article... This specific question is that two different servers are using two different ports, and restricting access to the other port... Whereas that article is simply about using the wrong port command for ssh. Unfortunately, I don't have any insight to help, I think you'll need to change the firewall on your backup server to allow connections on port 22, but I could be wrong. – Taegost Jul 30 '13 at 19:57
Those are the ports where the servers accept connections. Have you tried ssh -p 25022 backupserver on the webserver? – Paulo Almeida Jul 30 '13 at 20:03
Hi Paulo: We tried that, unfortunately it didn't work. – JoshuaD Aug 2 '13 at 18:56

One thing you're missing is that TCP connections use two ports, one on each side. The "source" port is usually assigned randomly, and the "destination" port is configured.

Also note the word "incoming". Your statement "it will not accept connections on port 22" only talks about incoming connections, not outgoing ones.

Also, firewalls on most servers usually are stateful; that is, even if they reject new incoming connections to ports other than 22, they will still accept packets belonging to established connections.

So in this case...

  • server A allows incoming connections from any port to port 22

  • server B allows incoming connections from any port to port 25022

  • both servers allow outgoing connections from any port to any port

  • both servers allow incoming packets that belong to established connections

This means that you should still be able to make an outgoing connection to the remote server, regardless of any restrictions on incoming connections.

In conclusion, the described restrictions on the client do not actually matter. Just specify the right port in the ssh configuration.

share|improve this answer
Hi grawity: Thanks for your answer, but I don't believe you are outlining the question correctly. Our webserver is not allowing outgoing traffic on port 25022. Our backup-server is not allowing incoming SSH traffic on port 22. We confirmed this by reviewing the firewall logs of the backup server. When we came out of our webserver on port 22, the connection failed, and we saw the firewall on the backup server rejecting the connection. When we tried to come out of the webserver on port 25022, the connection failed, but we did not see any entry in our backup server's logs. – JoshuaD Jul 31 '13 at 15:28
I want to be clear: I don't really understand TCP connections (that is why I'm asking questions here). I just know what tests we have done and how they appear to have failed. – JoshuaD Jul 31 '13 at 15:29
@JoshuaD Can't you configure the backup server to allow connections on port 22? – Paulo Almeida Aug 1 '13 at 1:17
@Paulo Almeida: As a matter of policy, we can't. – JoshuaD Aug 2 '13 at 18:55
up vote 1 down vote accepted

So after pursuing the issue with the help of you guys and a few other friends, we came to the conclusion that there was simply no way to do what we needed doing with the way the two servers were currently configured.

We contacted our hosting provided (Arvixe) and, after discussing the matter for a while, they were glad to open 25022 as an outgoing port for us. Once they did, the problem was solved.

Thanks for your help everyone.

share|improve this answer

Your Answer


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.