<pre>Q. So you have to be root to run your bash script?<br>A. The sudo part is only for the sinfp check.  I have keys for my own user on the systems.<br><br>Q. What does sudo do if you&#39;re already root?<br>A. Won&#39;t do anything because there is no root access to the remote host
<br><br>Q. What is that doing? Is it doing it locally?<br>A. It is doing it locally...once it determines which OS is running (we only have 2 different flavors being Solaris or linux) it will be told where sudo is located.  hmm.....may need to test my theory here for the Perl method.
<i><br></i><br>Q. So this is our goal, right? To create /etc/serialnumber on the remote host?<br>A. Absolutely<br><br>Q. Why does this work under bash? Do all your remote hosts have <br>/root/.ssh/authorized_keys files set up to trust root coming from your 
<br>local machine?<br><br>A. The initial sudo test is to get the sudo running (for sinfp checks) so I don&#39;t have to do it every time. (you&#39;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&#39;s taken care of your sudo session for a certain time.
<br>This is actually part 2 of the script...one part has my hosts list and the other has a csv file with the serialnumbers, asset, tags and other miscelaneous info, they get cross referenced becuase the list is mixed with Windows servers.  That script calls this one for every host.
<br><br>The functional part of the script runs entirely under my own account it ssh&#39;s to a box sending along the script it needs to run as part of the ssh command which includes the sudo commands that the remote host needs to run.
<br>I&#39;m thinking I should have included line numbers in the code so I could highlight certain aspects.<br><br>#-------------------------------------------------<br># Making the connections<br>#-------------------------------------------------
<br>if [ ${DEBUG} -eq 0 ]; then<br><br>Here&#39;s how this would initally read (run as me not sudo&#39;d locally):<br>   /usr/bin/ssh &quot;host&quot; &quot;echo -e [the string with all the information in it] to a serialnumber temp file. THEN &quot;remote sudo here&#39; move the temp file to /etc and change it&#39;s permissions&quot;
<br><br>    $SSHCMD ${SNFILE[${HOS}]} &quot;echo -e $STR &gt; /tmp/${SNFILE[${HOS}]}.sn<br>;$SUDO mv /tmp/${SNFILE[${HOS}]}.sn /etc/serialnumber; $SUDO chmod 660<br>/etc/serialnumber&quot;<br>    RESULT=$?<br>    if [ ${RESULT} -gt 0 ]; then
<br>        exit 22<br>    fi<br>else<br>    echo &quot;This is what would be sent to ${SNFILE[${HOS}]}!&quot;<br>    echo -e $STR<br>fi<br><br><br></pre>