<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to run a command as root using sudo (indicating the password)  from a script. in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-run-a-command-as-root-using-sudo-indicating-the-password/m-p/5289795#M474936</link>
    <description>&lt;P&gt;&amp;gt;the user myuser1 has privileges to use "sudo su -"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then he can do any root command.&amp;nbsp; Unless you tell sudo that he can only do lpshut and lpsched.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;gt;Could you please let me know how I can to run the commands lpshut and lpsched using myuser1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The user will have to type the password in for each of those commands.&amp;nbsp; Unless you can combine them together in one script.﻿&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 03 Aug 2011 08:03:41 GMT</pubDate>
    <dc:creator>Dennis Handly</dc:creator>
    <dc:date>2011-08-03T08:03:41Z</dc:date>
    <item>
      <title>How to run a command as root using sudo (indicating the password)  from a script.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-run-a-command-as-root-using-sudo-indicating-the-password/m-p/5289435#M474921</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;let me tell you what i have:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;HP-UX B.11&lt;/P&gt;&lt;P&gt;my userid is :&amp;nbsp; myuser1&lt;/P&gt;&lt;P&gt;this user has to run /usr/sbin/lpshut and &amp;nbsp;/usr/sbin/lpsched.&lt;/P&gt;&lt;P&gt;the user myuser1 has privileges to use "sudo su -" , when myuser1&amp;nbsp;has&amp;nbsp;privileges to use &amp;nbsp;"sudo su -" the password is required (pass of myuser1 to use sudo, i have the password of myuser1, it is "secret") , this a rule for the company for using the sudo.&lt;/P&gt;&lt;P&gt;when myuser1 uses sudo su - , then i can run lpshut and lpsched.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i am bulding a script in &amp;nbsp;which has to shutdown (/usr/sbin/lpshut) &amp;nbsp;the scheduler and then start it (/usr/sbin/lpsched.)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you please let me know how i can to run the comands lpshut and lpsched using myuser1 knowing it has sudo privileges and i have to enter the password?&lt;/P&gt;&lt;P&gt;how can i code that in a script?&lt;/P&gt;&lt;P&gt;Thank you in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Aug 2011 23:01:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-run-a-command-as-root-using-sudo-indicating-the-password/m-p/5289435#M474921</guid>
      <dc:creator>psalm139</dc:creator>
      <dc:date>2011-08-02T23:01:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to run a command as root using sudo (indicating the password)  from a script.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-run-a-command-as-root-using-sudo-indicating-the-password/m-p/5289709#M474933</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;gt; How to run a command as root using sudo (indicating the password)&amp;nbsp; from a script.&lt;/P&gt;&lt;P&gt;# cat script.sh&lt;/P&gt;&lt;P&gt;ssh &lt;A target="_blank" href="mailto:myuser1@localhost"&gt;myuser1@localhost&lt;/A&gt; sudo /usr/sbin/lpshut&lt;/P&gt;&lt;P&gt;ssh &lt;A target="_blank" href="mailto:myuser1@localhost"&gt;myuser1@localhost&lt;/A&gt; sudo /usr/sbin/lpsched&lt;/P&gt;&lt;P&gt;#---End of script&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This will ask you to enter password of myuser1 &amp;amp; then as myuser1 is having password-less rights to access sudo, it will directly execute lpshut &amp;amp; lpsched commands without asking for root user passwords.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope this is&amp;nbsp;what u wants....Cheers....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Aug 2011 06:40:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-run-a-command-as-root-using-sudo-indicating-the-password/m-p/5289709#M474933</guid>
      <dc:creator>Hiren N Dave</dc:creator>
      <dc:date>2011-08-03T06:40:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to run a command as root using sudo (indicating the password)  from a script.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-run-a-command-as-root-using-sudo-indicating-the-password/m-p/5289795#M474936</link>
      <description>&lt;P&gt;&amp;gt;the user myuser1 has privileges to use "sudo su -"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then he can do any root command.&amp;nbsp; Unless you tell sudo that he can only do lpshut and lpsched.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;gt;Could you please let me know how I can to run the commands lpshut and lpsched using myuser1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The user will have to type the password in for each of those commands.&amp;nbsp; Unless you can combine them together in one script.﻿&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Aug 2011 08:03:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-run-a-command-as-root-using-sudo-indicating-the-password/m-p/5289795#M474936</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2011-08-03T08:03:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to run a command as root using sudo (indicating the password)  from a script.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-run-a-command-as-root-using-sudo-indicating-the-password/m-p/5290117#M474942</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You should be able to do something like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;myaccount ALL=(ALL) NOPASSWD:/usr/sbin/lpshut NOPASSWD:/usr/sbin/lpsched&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The documentation on the 'sudo' home is your best source of information:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;xhttp://&lt;A target="_blank" href="http://www.gratisoft.us/sudo/man/1.8.1/sudoers.man.html" rel="nofollow"&gt;www.gratisoft.us/sudo/man/1.8.1/sudoers.man.html&lt;/A&gt;﻿&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The idea of using SUDO is to provide accountability and often to confer privilege in a granular way.&amp;nbsp; Defining users who can run *anything* as root when the user needs only a specific function is making swiss cheeze of security.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;...JRF...&lt;/P&gt;&lt;P&gt;﻿&lt;/P&gt;</description>
      <pubDate>Wed, 03 Aug 2011 12:23:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-run-a-command-as-root-using-sudo-indicating-the-password/m-p/5290117#M474942</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2011-08-03T12:23:07Z</dc:date>
    </item>
  </channel>
</rss>

