Plink stands for PuTTY Link.
Never play alone - with Plink, you'll discover gamers who play the way you do! - Enjoy sharing, voting, and discussing games. High-quality voice calls, group chats, private messages – feel free to use either the mobile or desktop version. With Plink, there are no limits! Launch plink from Command Prompt. You can’t just double-click on plink.exe to launch it. Windows Users, it's time to shut down your VirtualBox's. After trying so many different SSH emulators (Putty/Cygwin etc), I'm releasing a package based upon Simon Tatham's plink. All you need to do is download the package, run install.bat and open a command prompt. Then type in your SSH connection statement as standard.
Plink is a companion command-line utility for PuTTY.
On a very high-level:
In this tutorial, we’ll discuss the following:
First, download plink executable from here.
If you don’t have PuTTY already installed on your machine, make sure you also download putty executable along with plink.
If you have a 32-bit Windows laptop, make sure you download the 32-bit version of plink. If not, download the 64-bit version.
1. Launch plink from Command Prompt
You can’t just double-click on plink.exe to launch it. Since this is a command-line only utility (Without GUI), you should first launch your Windows command prompt. Mac os mojave dmg download.
For this, click on start menu on your windows, and type “cmd.exe” in the search box and press enter, this will launch the Windows command prompt.
Also, depending on where you have downloaded the plink.exe, you may have to modify the Windows’s PATH variable accordingly.
Go to your “System properties” windows, click on “Environment Variables”, select Path variable, and append the directory where the plink.exe is located here.
Or, you can just set your PATH variable as shown below. In the following example, I’ve downloaded the plink.exe to C:Downloads directory.
Next, type plink in the command prompt, this will display the various options available.
2. Plink Interactive SSH Session
The following is the basic syntax for plink:
In the above syntax:
While the command is optional, when you don’t give it, it will display a raw interactive session, which will have lot of non-printable non-readable character on the screen. As explained earlier, plink is not meant to be used as interactive session. Use putty for interactive session.
For now, let us see various methods to use the connection.
First, you can just give the ip-address of the remote-server. This will then ask for the username and password to login.
Or, you can also use the username using @ symbol as shown below. This will ask only for the password, as we’ve specified the username.
You can also pass the username using -l option as shown below:
You can also use the name of an existing putty session. In this example, I’m using the existing saved putty session called “devdb”. This is the recommended way of using, as you can bring all the configuration information from PuTTY to here for this particular “devdb” session.
The following -load is exactly the same as above.
As you see below, once you login, you’ll get a command-prompt. But, doing anything here will display some non user-friendly characters.
Again, for interactive SSH session, please use PuTTY.
On a related note, even if you’ve been using PuTTY for a while, you might find few tips from here helpful: 10 Awesome PuTTY Tips and Tricks You Probably Didn’t Know
3. Plink Non-Interactive SSH Session to execute a Remote Command
Using plink, from windows, you can execute a command on the Linux server without any user interaction and just display the output.
Free download sap gui 7.50 for mac. For this, pass the command as the last argument to the plink as shown below.
How to download and install eclipse in mac. In the following example, it will execute “crontab -l” command on the remote server and display the output.
If you want to execute multiple commands, then group them together as shown below.
The following will execute the db-backup.sh shellscript on the remote Linux server. But, you are initiating this from your Windows machine.
Few points to keep in mind:
4. Execute Multiple Linux Commands from a Windows File
Free download program for google in my mac. Instead of specifying all the commands to be executed on the remote Linux server in the plink command-line, you can also put them in a text file and specify the file as a parameter to the plink.
For example, create the following file called commands.txt on your Windows.
Now to execute all of the above commands on the remote Linux server one-by-one in a sequence, execute the following plink command on your Windows laptop.
5. Specify Connection Protocol
Plink allows the following protocols: SSH, Telnet, Remote Login (rlogin), Raw, Serial Connection
The most popular and the default is SSH. Use -ssh as shown below.
For Telnet:
For Remote Login using rlogin:
For Raw:
If you are trying to specify a particular protocol, and if you are getting “FATAL ERROR: Network error: Connection refused” error, it means that the remote server doesn’t support the specified protocol.
If you don’t want to specify the protocol on the command line:
6. Specify SSH Password as Plink Argument
If you don’t have the key based authentication setup, then you can pass the password as a parameter in the command-line. Needless to say this method is not recommended.
This will connect to the server as root using the password specified by the -pw option, and execute all the given Linux commands and display the output on your Windows command-prompt.
Of course, the easy method is to use a saved putty session (For example, devdb) instead of specifying the username and ip-address as shown below.
7. Debug Plink Issues
First, make sure you have the latest version of plink. Use -V option (upper-case V) as shown below. The current stable release is 0.69
Next, use -v option (lower-case v) as show below for more verbose output.
8. Specify SSH Port as Plink Option
By default for SSH, it will connect to port 22. But, on your Linux server if SSH is configured to run on a different port, then use -P option in plink to specify the port.
In the following example, plink will connect to the remote Linux server on port 25.
When you use a saved PuTTY session and -P option, instead of using the port from the saved session, it will use the given Port.
9. Plink Log Files for SSH Connections
For the SSH protocol in Plink, there are couple of useful logging options.
The following –sshlog option will save the logs in the given file (sshlog.txt).
This is the partial content of the sshlog.txt output
For more detailed log, use -sshrawlog option. Please note that the filesize of this will be larger than the above, as this will store lot more information in the log file.
Also, this will take longer to execute than the above command, as sshrawlog option collects more log information than regular sshlog option.
10. Specify SSH Protocol (SSH-1 or SSH-2)
By default, it will use SSH-2 protocol, which can also be specified using -2 option as shown below.
For SSH-1 protocol, use -1 option as shown below. If your server doesn’t support it, you’ll get the following error.
11. Specify IP Protocol (IPv4 or IPv6)
By default, it will use IPv4, which can also be specified using -4 option as shown below.
To use IPv6, use-6 option as shown below.
12. Use Private Key File for Authentication with Plink
Use -i option to specify the location of the private key file that should be used for authentication.
In the following example, it will use the devdb.ppk file from C:Downloads directory.
Note: You’ll get “Server refused our key”, if the given key is not properly configured to be used with your Linux Server.
If the key file is not found (for example, when you give a wrong directory name), you’ll get the following error:
If you specify a Key what is not of proper format, you’ll get the following error message.
13. Additional Enable and Disable Options for Plink SSH
You can also use the following plink SSH options:
14. Fingerprint and HostKey with Plink
Use -pgpfp option which will display the PGP fingerprint details for PuTTY. Typically you can use this to establish trust from plink.exe executable to another program or executable that you are trying to connect to.
Also, you can use hostkey in the plink to connect to the remote server accordingly using -hostkey option.
15. Plink -batch option for Windows Batch Files
If you are running plink inside a Windows batch file, then it is recommended that you use -batch option.
In the above example, if the complex-linux-command fails, or asking for an input from the user, or hangs, etc, then your Windows Batch script will not be waiting. Instead, plink will just abandon the command, and the batch script will fail.
This is probably what you would expect to happen instead of your windows batch file job just waiting or hanging.
So, use -batch option in plink when you are writing Windows batch scripts using plink.
> Add your comment
If you enjoyed this article, you might also like.
Next post: How to Fix Git Push Insufficient Permission Error for Objects Permanently
Previous post: 3 Methods to Connect to MySQL from PHP using Example Code
Previous | Contents | Next
Plink (PuTTY Link) is a command-line connection tool similar to UNIX
ssh . It is mostly used for automated operations, such as making CVS access a repository on a remote server.
Plink is probably not what you want if you want to run an interactive session in a console window.
7.1 Starting Plink
Plink is a command line application. This means that you cannot just double-click on its icon to run it and instead you have to bring up a console window. In Windows 95, 98, and ME, this is called an 'MS-DOS Prompt', and in Windows NT and 2000 it is called a 'Command Prompt'. It should be available from the Programs section of your Start Menu.
In order to use Plink, the file
plink.exe will need either to be on your PATH or in your current directory. To add the directory containing Plink to your PATH environment variable, type into the console window:
This will only work for the lifetime of that particular console window. To set your
PATH more permanently on Windows NT, use the Environment tab of the System Control Panel. On Windows 95, 98, and ME, you will need to edit your AUTOEXEC.BAT to include a set command like the one above.
7.2 Using Plink
This section describes the basics of how to use Plink for interactive logins and for automated processes.
Once you've got a console window to type into, you can just type
plink on its own to bring up a usage message. This tells you the version of Plink you're using, and gives you a brief summary of how to use Plink:
Once this works, you are ready to use Plink.
7.2.1 Using Plink for interactive logins
To make a simple interactive connection to a remote server, just type
plink and then the host name:
You should then be able to log in as normal and run a session. The output sent by the server will be written straight to your command prompt window, which will most likely not interpret terminal control codes in the way the server expects it to. So if you run any full-screen applications, for example, you can expect to see strange characters appearing in your window. Interactive connections like this are not the main point of Plink.
In order to connect with a different protocol, you can give the command line options
-ssh , -telnet , -rlogin or -raw . To make an SSH connection, for example:
If you have already set up a PuTTY saved session, then instead of supplying a host name, you can give the saved session name. This allows you to use public-key authentication, specify a user name, and use most of the other features of PuTTY:
7.2.2 Using Plink for automated connections
More typically Plink is used with the SSH protocol, to enable you to talk directly to a program running on the server. To do this you have to ensure Plink is using the SSH protocol. You can do this in several ways:
Usually Plink is not invoked directly by a user, but run automatically by another process. Therefore you typically do not want Plink to prompt you for a user name or a password.
To avoid being prompted for a user name, you can:
To avoid being prompted for a password, you should almost certainly set up public-key authentication. (See chapter 8 for a general introduction to public-key authentication.) Again, you can do this in two ways:
Once you have done all this, you should be able to run a remote command on the SSH server machine and have it execute automatically with no prompting:
Or, if you have set up a saved session with all the connection details:
Then you can set up other programs to run this Plink command and talk to it as if it were a process on the server machine.
7.2.3 Plink command line options
Plink accepts all the general command line options supported by the PuTTY tools. See section 3.7.3 for a description of these options.
In addition to this, Plink accepts one other option: the
-batch option. If you use the -batch option, Plink will never give an interactive prompt while establishing the connection. If the server's host key is invalid, for example (see section 2.2), then the connection will simply be abandoned instead of asking you what to do next.
This may help Plink's behaviour when it is used in automated scripts: using
-batch , if something goes wrong at connection time, the batch job will fail rather than hang.
7.3 Using Plink in batch files and scripts
Once you have set up Plink to be able to log in to a remote server without any interactive prompting (see section 7.2.2), you can use it for lots of scripting and batch purposes. For example, to start a backup on a remote machine, you might use a command like:
Or perhaps you want to fetch all system log lines relating to a particular web area:
Any non-interactive command you could usefully run on the server command line, you can run in a batch file using Plink in this way.
7.4 Using Plink with CVS
To use Plink with CVS, you need to set the environment variable
CVS_RSH to point to Plink:
You also need to arrange to be able to connect to a remote host without any interactive prompts, as described in section 7.2.2.
You should then be able to run CVS as follows:
If you specified a username in your saved session, you don't even need to specify the 'user' part of this, and you can just say:
7.5 Using Plink with WinCVS
Plink can also be used with WinCVS. Firstly, arrange for Plink to be able to connect to a remote host non-interactively, as described in section 7.2.2.
Then, in WinCVS, bring up the 'Preferences' dialogue box from the Admin menu, and switch to the 'Ports' tab. Tick the box there labelled 'Check for an alternate
rsh name' and in the text entry field to the right enter the full path to plink.exe . Select 'OK' on the 'Preferences' dialogue box.
Next, select 'Command Line' from the WinCVS 'Admin' menu, and type a CVS command as in section 7.4, for example:
or (if you're using a saved session):
Select the folder you want to check out to with the 'Change Folder' button, and click 'OK' to check out your module. Once you've got modules checked out, WinCVS will happily invoke plink from the GUI for CVS operations.
Previous | Contents | Next
Comments to [email protected][$Id: blurb.but,v 1.6 2002/02/24 15:17:10 simon Exp $][$Id: intro.but,v 1.4 2001/11/25 16:57:45 simon Exp $] [$Id: gs.but,v 1.6 2001/12/06 20:05:39 simon Exp $] [$Id: using.but,v 1.8 2002/09/11 17:30:36 jacob Exp $] [$Id: config.but,v 1.42 2002/09/26 18:37:33 simon Exp $] [$Id: pscp.but,v 1.22 2002/09/11 17:30:36 jacob Exp $] [$Id: psftp.but,v 1.5 2002/08/07 19:20:06 simon Exp $] [$Id: plink.but,v 1.17 2002/09/11 17:30:36 jacob Exp $] [$Id: pubkey.but,v 1.18 2002/09/11 17:30:36 jacob Exp $] Plink Command File[$Id: pageant.but,v 1.8 2002/09/11 17:30:36 jacob Exp $]How To Download And Use Plink On Mac OsHow To Download And Use Plink On Mac Windows 10[$Id: errors.but,v 1.1 2002/10/01 16:27:36 simon Exp $][$Id: faq.but,v 1.35 2002/09/14 10:24:27 jacob Exp $] [$Id: feedback.but,v 1.8 2002/08/12 14:08:55 simon Exp $] [$Id: licence.but,v 1.4 2002/03/27 21:09:16 simon Exp $] Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
December 2020
Categories |