[Omaha.pm] Net::SSH::Perl and sudo or su

Tony Simons webmaster at tvortex.net
Thu Dec 6 13:12:35 PST 2007


Here's the process I'm trying to follow.  I have this working with a
bash script btw, just thought I'd take an adventure into perl.  :)

I'm trying to get my perl script to populate a serialnumber file by
sshing to the host and writing a file by one of 2 methods. (either way
root is inaccessible via ssh)

Method 1: write the file to /tmp and move it to /etc.
Method 2: write to /etc.

Regardless of how I do this I need to get root (via 'su' or vi 'sudo')
to get the file into /etc
All the file work is done on the remote client after sshing to it while
providing the information needed.
my $cmd = "echo
\"HOST='$hos'\nASSET='$ass'\nSERIAL='$ser'\nMAKE='$mak'\nMODEL='$mod'\nFACILITY='$fac'\nRACK='$rac'\nUNITS='$uni'\"
> $tmpf; sudo mv $tmpf /etc";


Hope this helps with a few questions.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/omaha-pm/attachments/20071206/7b310480/attachment.html 


More information about the Omaha-pm mailing list