++ed by:
6 non-PAUSE users
Author image Salvador Fandiño García


Net::SSH::Any::Backend::Plink_Cmd - Backend for PuTTY's plink


  use Net::SSH::Any;
  my $ssh = Net::SSH::Any->new($host, user => $user, password => $password,
                               backend => 'Plink_Cmd',
                               local_plink_cmd => 'C:\\PuTTY\\plink.exe');
  my $output = $ssh->capture("echo hello world");


This module implements a Net::SSH::Any backend using PuTTY's plink utility.

It is probably the easiest way to get a working, password authenticated SSH connection on Windows. Unfortunately, it is not completely secure as the password is passed to plink on the command line and anybody with access to the local computer may eavesdrop it.

Also, a new connection is established for every command run, so this backend is not particularly efficient when running several commands in the target host.

Public key authentication

When public key authentication is requested, the module looks first for the key in a file with the extension ppk.

In case that file does not exist, it looks for the private key in OpenSSH format and if found, it tries to convert it to PuTTY format using the companion utility puttygen.

For instance:

  $ssh = Net::SSH::Any->new($host, key_path => 'C:\\OpenSSH\\keys\\my_key',
                            backends => ['Plimk_Cmd']);
                            local_plink_cmd => 'C:\\PuTTY\\plink.exe',
                            local_puttygen_cmd => 'C:\\PuTTY\\puttygen.exe');

  # Looks for "C:\OpenSSH\keys\my_key.ppk". In case that file doesn't
  # exist, it looks for "C:\OpenSSH\keys\my_key" and tries to convert
  # it using the program "C:\PuTTY\puttygen.exe".


Copyright (C) 2011-2014 by Salvador Fandiño, <sfandino@yahoo.com>

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.12.4 or, at your option, any later version of Perl 5 you may have available.