Link to home
Start Free TrialLog in
Avatar of rgb192
rgb192Flag for United States of America

asked on

putty and plink

http://id10terror1337.blogspot.com/2011/04/how-to-tunnel-your-traffic-and-smash.html

Connecting using Windows
For Windows it’s as simple as browsing to the directory you saved plink to and runningplink.exe
-N -D 9999 you@example.com


I am running putty on windows 7 (connected to windows server 2008)
how can I run plink.exe

could it be in the same program as puty
Avatar of John
John
Flag of Canada image

Plink is a command line command tool that appears to use putty as its underlying connection.

http://the.earth.li/~sgtatham/putty/0.53b/htmldoc/Chapter7.html

I just use putty and I and am happy with it for the (increasingly) minor use I need for it.
Avatar of rgb192

ASKER

why is the author using both plink and putty
I do not use command line plink, just putty. It serves my needs.
Also I guess it is as simple as that some people like command lines and some of us don't need them. There is not much to choose here. plink appears to run on putty and if you like command lines, use plink. Otherwise, if putty is working for you, stay with that.
Avatar of rgb192

ASKER

but tutorial (from question) says I need to use both

connect as two users I think
In order to use plink, you need putty as well (looking down the tutorial confirms this).

But you can use putty all by itself and plink is not needed if you do not need the features. I just use putty.
Avatar of rgb192

ASKER

I downloaded latest version of putty
putty-2014-06-22-installer.exe
which is not portable. There is a start menu folder but plink is not present

I run latest version of plink.exe and run as administrator.
screen flashes and then program disappears.


In order to follow the tutorial I must log on twice. (I think)
Another option in tutorial is 2 programs:  putty and firefox
If you just download putty it does not come with plink (mine did not). If you want plink as well, go the site I put in my post above.
@rgb192 - I am not sure what problem overall you are trying to solve.

Putty and Plink are techie's tools. Putty runs by itself, Plink does not run by itself (you need Putty with it).  You have to do all the setup and put the pieces together yourself.

If you need a telnet tool, I use NetTerm. (www.securenetterm.com). This is a nice tool that you can set up, comes with profiles and can do most or all of what you need.

If you need file transfer, I use WS_FTP. (www.ipswitch.com). This is a top class file transfer tool that I have used for years.
Avatar of rgb192

ASKER

@rgb192 - I am not sure what problem overall you are trying to solve.

a programmer who I hired can not do work for me when he is at his office

so programmer suggested tunneling
of which I provide via windows server 2008
I use VPN (IPsec VPN) to make tunnels to clients. Then I use Remote Desktop Connection to use the clients' systems.  This stuff works in Vista 64-bit, Window 7 Pro 64-bit, and now my Windows 8 Pro 64-bit machines. My clients include work on Server 2008.

So you may wish to (a) find out how your programmer client gets in with modern systems and (b) consider then upgrading your own toolset.
Avatar of rgb192

ASKER

I use VPN (IPsec VPN) to make tunnels to clients.

maybe your idea would work


requirements
must run on port 143 because programmer is blocked from using ssh 22 at his workplace
Many websites are blocked at his office including facebook and youtube
So he can not test code on a browser.
Programmer does not want to use a proxy server like hidemyass.com to test websites.

I think he wants to access windows server 2008 (not by rdp by ssh) so he can code in php
Avatar of serialband
Plink.exe is mainly used for scripts or quick single line tunnels.  It allows you to free up your putty session for actual interactive sessions.  If you do a lot of scripting, then you should use plink.exe.

Putty.exe is nicer for a direct interactive connection, but you could also connect via plink.exe in your Command Prompt or Powershell.  Cut & paste and word wrapping via plink.exe depends on your command prompt or powershell settings and that can become very kludgy.
Avatar of rgb192

ASKER

Thank you Serialband for explaining difference between putty and plink.

Do you know how I can complete the tutorial in the original question with the results I have provided.
I'm not entirely sure about what you want.  The link you provided shows an example on how to create a tunnel and set your browser proxy to connect through the tunnel.

Are you referring to this:
Connecting using Windows
For Windows it’s as simple as browsing to the directory you saved plink to and running plink.exe -N -D 9999 you@example.com

To start, the tunnel, open up your Command Prompt and type:
plink.exe -N -D 9999 you@example.com

The tunnel will start and lock up your command prompt window until you end it.

You could put that line into a batch file and double click it as well and that should open a command prompt window and stay open until you close it.

You could install a better/smarter proxy addon to firefox and fine tune your proxy so that only certain links go through the tunnel, while everything else goes directly through.  That way, if your bandwidth through your proxy is lower, than you won't be tying it up with unnecessary proxying.
Avatar of rgb192

ASKER

okay but I can not use plink on windows7 home premium
Yes, that is correct because plink is pure DOS and not supported in a 64-bit environment.

I continue to recommend a VPN solution as I mentioned above.
Don't use the putty-0.63-installer.exe installer to install plink.  You probably have some UAC problem with installing it in C:\Program Files (x86)\Putty.  Download the putty.zip and extract that into a folder directly on C:\putty or an external or USB drive D:\putty.  Run it from there.  I've never had a problem running it in 64 bit Windows when I unzipped them into a folder.  Any user can unzip putty.zip and run it.  64 bit Windows supports 32 bit programs or else a lot of software would have broken during the transition.  I ran plenty of 32 bit programs in 64 bit Windows when it first came out.  There were no 64 bit viruses nor any 64 bit antivirus programs during that first year or so, and all the 32 bit viruses would just fail in the 64 bit environment.

The person that needs to connect to the proxy has to run the plink.exe -ND 9999 username@server command.  That means that your remote programmer runs that command and connects his browser proxy to port 9999.  If he can't connect to port 22 on your server, you should set your ssh server to respond on another port above 1024.  Pick any port.  If you set your ssh server to answer to port 12345, then add the -P option to set the port. plink.exe -P 12345 -ND 9999 username@server  He can then connect his proxy to port 9999 and it will tunnel through to your ssh server port 12345 and request a connection.  The ssh server will then assign a port on your server to run the connections.  Port 12345 would continue to respond to ssh connection requests.


FYI:
"Pure DOS" hasn't existed in any new OS for over a decade, Windows 95, Windows 98, Windows ME still had "pure DOS" to boot from.  In ME, you had toggle some settings to boot into DOS 7.  Windows NT have all booted into NT and use an emulated DOS Command Prompt with access to larger memory spaces.  There are many "DOS mode" or command prompt .exe programs, but some of these may not even run in the limited 640kB memory modes of "Pure DOS" anymore and will just crash in "Pure DOS"

Windows 2000 (aka NT 5.0) and XP (aka NT5.1) don't run "pure DOS."
Putty runs just fine in 64-bit. I have it running. It runs with a GUI interface and works fine.
And so does plink.exe
So, rgb192 - install plink and have fun. I prefer vastly more modern tools, so at this point I cannot assist more and will now unsubscribe
plink.exe is a "modern tool" for scripting.  Just because it's not a GUI does not make it not modern.  GUI tools are good for certain uses, but command line tools are great for scripting, very useful for managing, monitoring and configuring multiple systems.

rgb192
Exactly how are you running plink.exe?  It is a command line tool and you have to either open a Command Prompt or Powershell, or you put it in a Batch file.  You can't just double click or right-click on it to run it.  Double clicking on it to run will cause it to open a Command Prompt Window, output the help screen, and then the command will end, causing the Window to close.  If you need to run it with elevated privileges, you need use it with runas or you need to elevate the Command Prompt or Powershell and run it within that.  You could also put it in a batch file and run that with elevated privileges.
Avatar of rgb192

ASKER

windows7 home premium
I download putty.zip, extracted and ran plink.exe

clicked
and
right clicked 'run as administrator'

both flashed screen 1 second
did not appear on taskbar
You can't run it that way.  It's a command line program.  It disappeared because plink.exe without arguments just outputs the "help" screen and quits.  You need to start Command Prompt or Powershell to run it.
Avatar of rgb192

ASKER

What do i type in cmd window
You type the plink.exe command with the full path followed by the options.


"C:\Program Files (x86)\Putty\Plink.exe" -N -D 9999 username@server_or_IP

If you've set putty in your path, then you just need

Plink.exe -N -D 9999 username@server_or_IP

If you need to run it as administrator, you precede the above command with runas and you'll be prompted for a password.

runas /user:Administrator "C:\Program Files (x86)\Putty\Plink.exe" -N -D 9999 username@server_or_IP

runas /user:Administrator Plink.exe -N -D 9999 username@server_or_IP

You could als right-click on Command Prompt or Powershell and run them as Administrator.
Avatar of rgb192

ASKER

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\>cd "program files <x86>"

C:\Program Files (x86)>cd putty

C:\Program Files (x86)\PuTTY>plink.exe -N -D 9999 j3@my_ip
FATAL ERROR: Network error: Connection timed out

C:\Program Files (x86)\PuTTY>

Open in new window


I ran 2 windows as admin cmd.exe

I also tried on another plink.exe which is older that I downloaded from zip

Note: I can connect to same server on port 143 (my programmer can not use port 22) using putty.


related question about path
https://www.experts-exchange.com/questions/28468476/putty-in-path-running-plink-in-windows7.html
Then add the -P option to add the port

plink.exe -N -D 9999 -P 1234 j3@my_ip

Open in new window

You'll also need to remap the port on your firewall to 1234 for him to connect to.
Avatar of rgb192

ASKER

plink.exe -N -D 9999 -P 1234 j3@my_ip

do I literately use
9999
and
1234

or are there other numbers?
Those are just sample numbers.

You could use
plink.exe -N -D 8888 -P 2345 j3@my_ip
Avatar of rgb192

ASKER

the port I am using is 143 on windows server 2008
i do not know -D

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.


C:\Windows\system32>cd ../../"program files <x86>"

C:\Program Files (x86)>cd putty

C:\Program Files (x86)\PuTTY>plink.exe -N -D 8888 -P 2345 j3@my_ip
.com
FATAL ERROR: Network error: Connection timed out

C:\Program Files (x86)\PuTTY>

Open in new window


same error
Avatar of rgb192

ASKER

What is the exact command I type because I do not know the numbers next to dashes
Sorry, I didn't see the previous message and I've been really busy at work.

C:\Program Files (x86)\PuTTY>plink.exe -N -D 8888 -P 2345 j3@my_ip
In the above command, the 8888 can be replaced by whatever port you wish set up to proxy through.  The 2345 should be replaced by the ssh port of the system that you're connecting to.
Avatar of rgb192

ASKER

plink.exe -N -D 21 -P 143 j3@my_ip
plink.exe -N -D 22 -P 143 j3@my_ip
plink.exe -N -D 80 -P 143 j3@my_ip

asked me my password


from
http://id10terror1337.blogspot.com/2011/04/how-to-tunnel-your-traffic-and-smash.html
When you execute either of those commands, you’ll be prompted for your password. After you authenticate, nothing will happen. The -N tells ssh not to open an interactive prompt, so it will just hang there, waiting. That’s exactly what you want.


I know that windows server has port 143 open and I can connect to windows server via putty using 143

I do not know the answer for D but according to tutorial, I think I have a good response


and then what number should I use for firefox
Avatar of rgb192

ASKER

What is d?
Avatar of rgb192

ASKER

I am sorry, I still do not understand.
Run plink.exe by itself on the command line to generate a help screen.

plink.exe

The -P option is the port that you're connecting to on the remote system.
The -D option is the port you're redirecting to on the machine running plink.

You can use whatever number you want for -D.  If you set it to 9999, then you'll need to configure your proxy to pass your connections through port 9999 on your local system.
Avatar of rgb192

ASKER

You can use whatever number you want for -D.  If you set it to 9999, then you'll need to configure your proxy to pass your connections through port 9999 on your local system.

so I think
2 or 5 should be 9999

Set Firefox to use SOCKS proxy
Once your proxy’s up and running, configure Firefox to use it. From Firefox’s Tools menu, choose Options, and from the Advanced section choose the Network tab. Next to “Configure how Firefox connects to the Internet” hit the “Settings” button and enter the SOCKS information, which is the server name (localhost) and the port you used (in the example above, 9999.)
Save those settings and hit up a web page. When it loads, visit http://www.ipchicken.com to see if it’s using your remote ssh server to tunnel traffic. If you are, you may yell out Woot, Woot! In excitement
Also remember that you’ll need to open your firewall a bit by cracking open port 9999 on your local machine and port 22 on your server for SSH.

Let me know how things work out for you and if you have any questions on setting up in the comment section below.

radio button
socksv4, socksv5

and is 1 or 3 localhost or myIP

should I fill out 6?
User generated image
Yes.


You only need to fill out 6 for the sites that you don't want to proxy.
Avatar of rgb192

ASKER

okay, no 6

What should I write for 1,2,3,4,5?
More details are in previous comment
https://www.experts-exchange.com/questions/28460739/putty-and-plink.html?anchorAnswerId=40221886#a40221886
If you're only doing http, then just do 1 & 2 (localhost and 9999), otherwise enter it in 3 & 5
Avatar of rgb192

ASKER

is the radio button in the correct place
socksv4 vs socksv5

1=localhost
2=9999

The proxy server is refusing connections

Firefox is configured to use a proxy server that is refusing connections.

    Check the proxy settings to make sure that they are correct.
    Contact your network administrator to make sure the proxy server is working.

Open in new window


this is output I get on firefox browser

which is very descriptive compared to previous failure to connect messages
Avatar of rgb192

ASKER

What other changes could I make?
Avatar of rgb192

ASKER

since I have norton

Norton Security Suite
21.3.0.12
Windows 7 Home Premium
7601.18247.amd64fre.win7sp1_gdr.130828-1532
Norton Autofix Results: 0 item(s)

 which I do not know how to turn off
I created a traffic rule


User generated image

Is there a way to test if norton is blocking firefox from connecting to proxy
Avatar of rgb192

ASKER

I unchecked all the block traffic rules

and
norton firefox program rule is set to allow

User generated image

my windows firewall is off because norton suggests to disable
so I do not know what is blocking the proxy connection
Avatar of rgb192

ASKER

in all connections I am prompted for a password and then (quoting article)
When you execute either of those commands, you’ll be prompted for your password. After you authenticate, nothing will happen. The -N tells ssh not to open an interactive prompt, so it will just hang there, waiting. That’s exactly what you want.

cmd.exe: (either of choices)
plink.exe -N -D 21 -P 143 j3@my_ip
plink.exe -N -D 22 -P 143 j3@my_ip
plink.exe -N -D 80 -P 143 j3@my_ip

firefox:
The proxy server is refusing connections

Firefox is configured to use a proxy server that is refusing connections.

    Check the proxy settings to make sure that they are correct.
    Contact your network administrator to make sure the proxy server is working.

cmd.exe:
plink.exe -N -D 9999 -P 143 j3@my_ip
firefox:
The connection was reset

The connection to the server was reset while the page was loading.

    The site could be temporarily unavailable or too busy. Try again in a few moments.
    If you are unable to load any pages, check your computer's network connection.
    If your computer or network is protected by a firewall or proxy, make sure that Firefox is permitted to access the Web.
The proxy will work if the remote system is actually answering on port 143.  You must also be sure your proxy is set to 9999 or whatever port you set with the -D option.
Avatar of rgb192

ASKER

The proxy will work if the remote system is actually answering on port 143.  You must also be sure your proxy is set to 9999 or whatever port you set with the -D option.

I think testing port 143 is another question so I opened another question. I think they want me to install telnet.  

https://www.experts-exchange.com/questions/28503651/port-143-connect-and-test.html
I've requested that this question be deleted for the following reason:

Not enough information to confirm an answer.
Avatar of rgb192

ASKER

Can serialband offer any guidance on what I am doing wrong so I can ask another followup question.
ASKER CERTIFIED SOLUTION
Avatar of serialband
serialband
Flag of Ukraine image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rgb192

ASKER

okay I am using a mail port to attempt to view a browser.

Thanks for guidance.