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  

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.

  • 1
    Of 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 Mar 21 '12 at 12:30
  • Also, what zigg said. – Eroen Mar 21 '12 at 13:02

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.

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.