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

I have a question.

How can i run SSH trough a proxy or a SSH Tunneling Protocol?

For example i have a computer(Ubuntu) with ip eg. and i want to connect to my server trough a proxy eg. so i can see in lastlog that the last authentication was made from .

I need this because i cannot access a certain server at work only with an specified range IP. What i tried so far was

where i used ssh -D 1 -p 443 where i had forwarded to a SSH Tunneling Protocol (i configurated listening on port 443 but no result, still no connection (denied) ...)

This question may sound simple, but i can't figure it out, can you please help me? Thanks.

share|improve this question

migrated from Nov 11 '12 at 9:14

This question came from our site for professional and enthusiast programmers.

I've run into a similar problem where I can connect to the machines at my university through 'central access' server also at the university. So what I did was add the following to my ssh conf

Host *
ProxyCommand ssh nc %h %p

that proxies all commands to anything under through the central access server. You still need to log in twice (once for the central server and again to the target machine) but it makes it possible to access git repos etc easily behind the central server.

You'll need to add the above lines into your ssh conf file. Open the ~/.ssh/config file in a text editor (if it doesn't exits then create it) and paste those two lines in there (replacing the host names of course with the ones you need to connect to).

Ssh will read the conf file on connect and see that a connection to * should be proxied with the command below it. See the ssh and nc man pages for an explanation on the parameters.

UPDATE Aah, so this is about Chrome, not abour ssh. In that case you need to set the proxy settings in Chrome. These vary across platforms, on OS X chrome seems to use the system wide proxy settings, but on Windows you can set the proxy specifically for Chrome. On Ubuntu there seems to be a problem with Chrome and the system wide proxy settings as per Ask Ubuntu. If you're open to using Firefox changing the proxy settings would become a bit easier.

share|improve this answer
+1 ... Note also, you might want to use ssh options -x -a -q in your ProxyCommand. And in recent OpenSSH versions, you can replace the netcat bits with a -W options. (All these are documented on ssh's man page.) – ghoti Nov 10 '12 at 20:13
i'm using Ubuntu and i don't know ssh well enough ... sorry, can you tell me step by step? Right now i want to connect to that server using the proxy (witch it is "pointing out" to proxy, so when i use in Chrome for example, i can surf web with that proxy, hope i made myself clear ... – Row Minds Nov 10 '12 at 20:54
I'm afraid you didn't, I thought you wanted to get ssh (not chrome) working through a proxy. See update above. – Matti Lyra Nov 11 '12 at 9:30
no, it's about log in to a linux server trough a proxy, not my base ip, understand? – Row Minds Nov 11 '12 at 16:38
ok, I don't know what you need chrome for then, but the ssh conf with netcat will work. – Matti Lyra Nov 11 '12 at 16:40

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.