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

Jay Hannah jay at jays.net
Fri Dec 7 07:56:27 PST 2007


On Dec 6, 2007, at 6:03 PM, Anthony Simons wrote:
> A. The initial sudo test is to get the sudo running (for sinfp checks)
> so I don't have to do it every time. (you'll see why that is done
> after the next sentance)  Typically during a session you only have to
> run sudo once for something; then it's taken care of your sudo session
> for a certain time.

So your bash script has to be run manually? Do you have to enter a  
password manually? (But only once?) Isn't that bad? (Don't you want  
to be able to fully automate this task?)

> Here's how this would initally read (run as me not sudo'd locally):
>    /usr/bin/ssh "host" "echo -e [the string with all the information
> in it] to a serialnumber temp file. THEN "remote sudo here' move the
> temp file to /etc and change it's permissions"
>
>     $SSHCMD ${SNFILE[${HOS}]} "echo -e $STR > /tmp/${SNFILE[$ 
> {HOS}]}.sn
> ;$SUDO mv /tmp/${SNFILE[${HOS}]}.sn /etc/serialnumber; $SUDO chmod 660
> /etc/serialnumber"

So your username has sudo privileges on the remote server? sudo has  
the effect of running those mv and chmod commands as root on the  
remote host, right?

Are you saying that through manual sudo authentication locally the  
remote box now trusts the remote user to run things as root? (That  
sounds crazy, doesn't it?)

j

...waaaay off topic. But maybe we're building up to some Perl...   :)



More information about the Omaha-pm mailing list