Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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. 123.123.123.123 and i want to connect to my server trough a proxy eg. 111.111.111.111 so i can see in lastlog that the last authentication was made from 123.123.123.123 .

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

http://daniel.haxx.se/docs/sshproxy.html

where i used ssh -D 1 [email protected] -p 443 where i had 127.0.0.1 forwarded to a SSH Tunneling Protocol

http://www.nixtutor.com/linux/installing-and-configuring-an-ssh-server/ (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
add comment

migrated from stackoverflow.com Nov 11 '12 at 9:14

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

1 Answer

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 *.host.name.com
ProxyCommand ssh central.access.server.host.name.com nc %h %p

that proxies all commands to anything under host.name 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 *.host.name.com 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.

http://www.googlechrometutorial.com/google-chrome-advanced-settings/Google-chrome-proxy-settings.html

share|improve this answer
1  
+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 127.0.0.1 (witch it is "pointing out" to 111.111.111.111 proxy, so when i use 111.111.111.111 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
show 1 more comment

Your Answer

 
discard

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.