Assuming you mean to access an external SOCKS proxy from windows, here you go. If you meant setting up a SSH server in windows, cygwin can do this with sshd
.
In windows, cygwin makes this easy, but if you don't have cygwin already, here are PuTTY instructions.
Set it up like this:
replace port 2222 with 22 or whatever your port for SSH is. Leaving it blank should work too. 22 is the default, but I had it on a non-standard port. Replace 127.0.0.1 here with your actual address.
Here, LEAVE the 127.0.0.1 where it is. It is SUPPOSED to be there. You can change 8080 to whatever port you want the SOCKS proxy on.
Be sure to set the login username to whatever yours is. Mine is 'mobile' on my iphone, which I was using when i made this example for the apple stack exchange.
If you want, you can then save a profile for this, to avoid setting it all back up each time you have a problem. This is done in the 'session' section at the very top.
Linux/Unix/BSD/Solaris/OSX/HP-UX/whatever I'm still missing
You can run ssh -D 8080 user@address
Now, you need to open your web browser of choice; I use firefox, so I will use it as an example. I have used chrome and opera, but as I do not like them and do not currently have them installed, I cannot presently use it for an example. But you set it up as a SOCKS proxy, regardless of browser.
These screenshots were done with a forwarded X11, so the fonts are ugly, but pay it no mind.
First, go to the preferences window (tools -> options
or edit -> preferences
, depending on OS). Then, go to Advanced -> Network -> Settings...
.
Use the following configuration for the browser.
Problems and Solutions
Problem:
My app doesn't allow setting a SOCKS proxy.
Solution:
I have had this problem with games like Minecraft. Here's some fixes.
For minecraft, I added a argument to ssh
. I regularly play on the nerd.nu reddit minecraft servers (reddit.com/r/mcpublic). Since minecraft 1.6, SSH tunneling and SOCKS proxies set as command line arguments haven't worked. You used to be able to add java parameters -DSocksProxyHost=127.0.0.1 -DSocksProxyPort=8080
and it would work. Now, however, the solution isn't quite as nice, but it does work.
When you start ssh
, instead of ssh -D 8080 user@address
, do
ssh -D 8080 -L 127.0.0.1:25565:p.nerd.nu:25565 user@address
.
Then, when you want to connect to the server, instead add the URL 127.0.0.1:25565
to your list of servers! The remote server will appear on 127.0.0.1/localhost thanks to the miracle of SSH tunneling!
For other programs/games, the same rule applies. If you can't set a SOCKS proxy and nothing else works, just add -L 127.0.0.1:<port>:<remote URL to access>:<remote port>
.
There is nothing forcing you to use the same port on 127.0.0.1
that you would normally, so I could have, for example, mapped p.nerd.nu:25565
to 127.0.0.1:1025
and the game wouldn't care as long as I specified the port. Not all programs are so lenient, but it's useful to remember.
Best Answer
The
-m
command-line switch of PuTTY works for the SSH only, not for the Telnet.See PuTTY documentation (emphasis mine):
There's no way to execute a command on the server automatically with PuTTY over the Telnet protocol.
Though you might be able to use Plink (PuTTY command-line connection tool).
As with PuTTY, you cannot use the
command
parameter as that works with the SSH only.But you might be able to use input redirection: