This is a simple script to remotely log onto another box using Perl.
Net::SSH::Perl module is needed (with whatever else it wants for your system. Use perl -MCPAN -e shell to install -it will prompt you.
I found this on the perl how-to site, and it has been useful to go get information off remote machines (frequently by running shell scripts I wrote to do various analytics).
#!/usr/bin/perl
use Net::SSH::Perl;
my $host = "perlhowto.com";
my $user = "user";
my $password = "password";
#-- set up a new connection
my $ssh = Net::SSH::Perl->new($host);
#-- authenticate
$ssh->login($user, $pass);
#-- execute the command
my($stdout, $stderr, $exit) = $ssh->cmd("ls -l /home/$user");
See:
http://www.perlhowto.com/execute_comman ... _using_ssh
Remote Info Gathering with Perl
Moderators: Developers, Moderators
Who is online
Users browsing this forum: No registered users and 4 guests