SSH behind proxy ?

1

What is the best way to SSH to my sever behind company proxy , it seems that 22 port is not opened by default , is there any simple way to do that rather than to install corkscrew ??

When I do :

✗ ssh -i ~/.ec2/mykey.pem ubuntu@XX.XX.XXX.XXX
ssh: connect to host XX.XX.XXX.XXX port 22: Operation timed out  

Eki Eqbal

Posted 2012-03-21T12:14:06.267

Reputation: 285

Answers

3

The simple way is to modify /etc/ssh/sshd.conf on the server (XX.XX.XXX.XXX) to listen on some port you can access through the proxy. For example port 80 is not usually blocked. Port 443 is another good candidate. If you don't have root access to the server, you might persuade whoever has to do it for you. sshd must be restarted after changing the file for the effect to take place.

A different, simple, approach is to ask whoever administers the proxy to let you connect through it on port 22.

Eroen

Posted 2012-03-21T12:14:06.267

Reputation: 5 615

1Of course, you'll also need to tell the SSH client to connect to that port. e.g. via ssh -p 2222 hostname or (better, because the option also works with scp etc.) ssh -o Port=2222 hostname. And port 80 can be hooked up with e.g. transparent HTTP proxies for caching or filtering, so that may not work very well... you would need to find a port that passes the connection through unmolested. – zigg – 2012-03-21T12:30:40.007

Also, what zigg said. – Eroen – 2012-03-21T13:02:12.463

2

I wasn't aware of corkscrew, but that seems like your best bet, if you can issue CONNECT requests through an HTTP proxy. Either that, or use the ProxyCommand directive with some other command that can make the connection for you.

You really should be talking to your network administrator about your need to use SSH though.

zigg

Posted 2012-03-21T12:14:06.267

Reputation: 362