in reply to Re: Having trouble installing Module on Strawberry Perl
in thread Having trouble installing Module on Strawberry Perl

Thanks, that makes sense. That leads to another question. Does anyone know of another module that would allow me to ssh int a remote Linux PC, be able to su to another user, and be able to run commands as that user?
  • Comment on Re^2: Having trouble installing Module on Strawberry Perl

Replies are listed 'Best First'.
Re^3: Having trouble installing Module on Strawberry Perl
by Corion (Patriarch) on Jan 16, 2009 at 20:48 UTC

    Net::SSH::Perl and SSH or OpenSSH, or maybe just log in as the target user directly:

    open my $remote, '| ssh otheruser@remotehost' or die "Couldn't connect: $!"; print {$remote} "echo Test\n";

    But that way, you don't get much interactivity and this only works if you have passwordless keys set up or store the key in pageant or another ssh keyring.

      I can't log in as the target user, since the target user is root, and root logins are disallowed on the remote machine. I also need a fair amount of interactivity. What I am trying to do is login, switch to root, kill the dhcp process, grab the leases file, parse it and pull out specific leases for processing, delete some of the leases, and finally restart the dhcp process.

        Probably not what you wanted to hear, but if all else fails, you could find a minimal Linux distro, install it in a vmware image (or some such), run it on your Windows box, and then do your work from that virtual machine ;)

        On Win32 I find Expect, IO-Tty and Net-SSH-Expect all build straight out of the box (and pass all tests) using Cygwin - but I haven't tested whether Net-SSH-Expect provides the mileage you need for the task at hand.

        Cheers,
        Rob