On 6/14/07, Chas Owens <[EMAIL PROTECTED]> wrote:
On 6/14/07, Clif Hudson <[EMAIL PROTECTED]> wrote:
> Could someone point me to a book or online reference that shows me how to
> create a SSH script from scratch. I know I could use the Net::SSH::Perl
> module, but I don't have access to the external resources needed to download
> the module because of the network restrictions.
>
> Sincerely,
> Clif Hudson
>
> [EMAIL PROTECTED]
There is always a way to download a module. You have ssh access to
the box (otherwise you wouldn't want the module), so download the
module to a local machine and scp it over. If the reason isn't really
network restrictions, but rather sysadmins who don't want new Perl
modules installed on "their" box, you can always install the module in
the directory of the user who is going to run the code. If this still
freaks out your sysadmins, well, you are stuck with puppet stringing
the ssh command through IPC::Open3* (which is part of core Perl, so
they can't complain).
* http://search.cpan.org/~nwclark/perl-5.8.8/lib/IPC/Open3.pm
My last statement about puppet stringing being your only option is
true if you need to do something complex that needs to respond ssh's
output. If all you need to do is run a command on a remote host then
my @host_files_in_tmp = qx(ssh [EMAIL PROTECTED] ls /tmp);
Will work just fine.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/