Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

Re^2: Catching die in Net::SFTP / Net::SSH::Perl:

by salva (Canon)
on Jul 15, 2010 at 08:48 UTC ( #849727=note: print w/replies, xml ) Need Help??

in reply to Re: Catching die in Net::SFTP / Net::SSH::Perl:
in thread Catching die in Net::SFTP / Net::SSH::Perl:

Net::SFTP::Foreign (...) does require an SSH client of some sort. What client would that probably be and how would I interface with it?

If the box running your script has Linux or some other Unix installed, Net::SFTP::Foreign will just use the SSH client in your system (as long as it is named ssh and is in the PATH). You can also install OpenSSH in a custom location and tell the module to use it with the ssh_cmd option. As it seems that you are using password authentication you will also have to install Expect.

If you want to run the script under Windows, your best option may probably be to use the Net::SSH2 backend Net::SFTP::Foreign::Backend::Net_SSH2. The default backend does not support password authentication under Windows because of Expect not working there. Alternatively, you could use plink (read the FAQ section from the module documentation for the details).

Examples of how to connect to a remote server are included in the docs. Usually, this will do:

my $sftp = Net::SFTP::Foreign->new($host, user => $user, passwd => $pa +sswd); $sftp->error and die "SFTP connection failed: " . $sftp->error;

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://849727]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (2)
As of 2022-01-23 13:28 GMT
Find Nodes?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:

    Results (63 votes). Check out past polls.