<?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: run script as root in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/run-script-as-root/m-p/2567461#M30144</link>
    <description>Hi Jim,&lt;BR /&gt;&lt;BR /&gt;you can use "sudo". You can set it up such that regular users can run scripts/commands as other users/root without having suid/sgid scripts and also it logs all the commands run.&lt;BR /&gt;&lt;BR /&gt;You can download the source from &lt;BR /&gt;&lt;A href="ftp://ftp.courtesan.com/pub/sudo" target="_blank"&gt;ftp://ftp.courtesan.com/pub/sudo&lt;/A&gt;&lt;BR /&gt;or download sudo in swinstall format from&lt;BR /&gt;&lt;A href="http://hpux.cs.utah.edu/hppd/hpux/Sysadmin/sudo-1.6.2b1/" target="_blank"&gt;http://hpux.cs.utah.edu/hppd/hpux/Sysadmin/sudo-1.6.2b1/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;-HTH&lt;BR /&gt;Ramesh&lt;BR /&gt;</description>
    <pubDate>Mon, 20 Aug 2001 19:29:43 GMT</pubDate>
    <dc:creator>linuxfan</dc:creator>
    <dc:date>2001-08-20T19:29:43Z</dc:date>
    <item>
      <title>run script as root</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/run-script-as-root/m-p/2567458#M30141</link>
      <description>I have a script that my users can use to move their completed job files to an online archive area for holding.  We were having trouble with some of the files being moved due to priveleges, so I added a command to change the priv of all the files in the directory.  Now the problem is not all the files belong to the same user, so unless the person running the script owns all the files, they can't change the priv. settings.  Is there any way to set up the script so that it runs as if it was being run by root, but so that any user can run the script?</description>
      <pubDate>Mon, 20 Aug 2001 19:10:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/run-script-as-root/m-p/2567458#M30141</guid>
      <dc:creator>Jim Mickens</dc:creator>
      <dc:date>2001-08-20T19:10:57Z</dc:date>
    </item>
    <item>
      <title>Re: run script as root</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/run-script-as-root/m-p/2567459#M30142</link>
      <description>You can use SUID on the script, so that any user can run it as the owner. For example,&lt;BR /&gt;&lt;BR /&gt;# ll  test&lt;BR /&gt;-rwxr-xr-x  1  root  sys      ...   test&lt;BR /&gt;&lt;BR /&gt;# chmod 4755  test&lt;BR /&gt;# ll  test&lt;BR /&gt;-rwsr-xr-x  1  root  sys      ...   test&lt;BR /&gt;&lt;BR /&gt;Hope it helps.</description>
      <pubDate>Mon, 20 Aug 2001 19:24:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/run-script-as-root/m-p/2567459#M30142</guid>
      <dc:creator>Jerry Zhang</dc:creator>
      <dc:date>2001-08-20T19:24:38Z</dc:date>
    </item>
    <item>
      <title>Re: run script as root</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/run-script-as-root/m-p/2567460#M30143</link>
      <description>Hi Jim,&lt;BR /&gt;&lt;BR /&gt;If it is acceptable to your users, I would set up a cron job by root that would run your script at certain times on a regular basis.&lt;BR /&gt;&lt;BR /&gt;Regards ...   Mladen</description>
      <pubDate>Mon, 20 Aug 2001 19:28:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/run-script-as-root/m-p/2567460#M30143</guid>
      <dc:creator>Mladen Despic</dc:creator>
      <dc:date>2001-08-20T19:28:04Z</dc:date>
    </item>
    <item>
      <title>Re: run script as root</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/run-script-as-root/m-p/2567461#M30144</link>
      <description>Hi Jim,&lt;BR /&gt;&lt;BR /&gt;you can use "sudo". You can set it up such that regular users can run scripts/commands as other users/root without having suid/sgid scripts and also it logs all the commands run.&lt;BR /&gt;&lt;BR /&gt;You can download the source from &lt;BR /&gt;&lt;A href="ftp://ftp.courtesan.com/pub/sudo" target="_blank"&gt;ftp://ftp.courtesan.com/pub/sudo&lt;/A&gt;&lt;BR /&gt;or download sudo in swinstall format from&lt;BR /&gt;&lt;A href="http://hpux.cs.utah.edu/hppd/hpux/Sysadmin/sudo-1.6.2b1/" target="_blank"&gt;http://hpux.cs.utah.edu/hppd/hpux/Sysadmin/sudo-1.6.2b1/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;-HTH&lt;BR /&gt;Ramesh&lt;BR /&gt;</description>
      <pubDate>Mon, 20 Aug 2001 19:29:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/run-script-as-root/m-p/2567461#M30144</guid>
      <dc:creator>linuxfan</dc:creator>
      <dc:date>2001-08-20T19:29:43Z</dc:date>
    </item>
    <item>
      <title>Re: run script as root</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/run-script-as-root/m-p/2567462#M30145</link>
      <description>The SUID did the trick.  I think the script used to be that way, but somehow got turned off recently.  My users started reporting that the script didn't work a couple of weeks ago.  Lord knows how long it didn't work before they started telling me.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 20 Aug 2001 19:32:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/run-script-as-root/m-p/2567462#M30145</guid>
      <dc:creator>Jim Mickens</dc:creator>
      <dc:date>2001-08-20T19:32:59Z</dc:date>
    </item>
    <item>
      <title>Re: run script as root</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/run-script-as-root/m-p/2567463#M30146</link>
      <description>hi,&lt;BR /&gt;&lt;BR /&gt;chmod u+s has NO effect on shell scripts !!&lt;BR /&gt;&lt;BR /&gt;so, other options:&lt;BR /&gt;- write a little C-program to do your stuff (possibly by only using host commands) and "chmod u+s" the executable file.&lt;BR /&gt;- use sudo&lt;BR /&gt;- launch the script from root's crontab every n minutes&lt;BR /&gt;- ...&lt;BR /&gt;&lt;BR /&gt;good luck,&lt;BR /&gt;Thierry.</description>
      <pubDate>Mon, 20 Aug 2001 19:33:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/run-script-as-root/m-p/2567463#M30146</guid>
      <dc:creator>Thierry Poels_1</dc:creator>
      <dc:date>2001-08-20T19:33:16Z</dc:date>
    </item>
    <item>
      <title>Re: run script as root</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/run-script-as-root/m-p/2567464#M30147</link>
      <description>Hi&lt;BR /&gt;Try setting SUID bit on the script to be run as root or other user id.&lt;BR /&gt;-rws-r-xr-x 1 root  users     18667 Aug 26  2000 check-lg-space.ksh&lt;BR /&gt;Everybody will be able to run above script as root.&lt;BR /&gt;&lt;BR /&gt;-rws-r-xr-- 1 dmcapp1  users     18667 Aug 26  2000 start-dm-app.ksh&lt;BR /&gt;Members of users group will be able to run above script as user dmcapp1.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Prashant.</description>
      <pubDate>Mon, 20 Aug 2001 19:33:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/run-script-as-root/m-p/2567464#M30147</guid>
      <dc:creator>Deshpande Prashant</dc:creator>
      <dc:date>2001-08-20T19:33:26Z</dc:date>
    </item>
    <item>
      <title>Re: run script as root</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/run-script-as-root/m-p/2567465#M30148</link>
      <description>I wonder suid bit will work for the scripts. You can write a small c program and embed the script in it.&lt;BR /&gt;&lt;BR /&gt;main ()&lt;BR /&gt;{&lt;BR /&gt;system ("your_script_name");&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;Compile and give suid to the executable.&lt;BR /&gt;&lt;BR /&gt;SUID on script won't work.&lt;BR /&gt;&lt;BR /&gt;-Sri</description>
      <pubDate>Tue, 21 Aug 2001 01:47:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/run-script-as-root/m-p/2567465#M30148</guid>
      <dc:creator>Sridhar Bhaskarla</dc:creator>
      <dc:date>2001-08-21T01:47:12Z</dc:date>
    </item>
    <item>
      <title>Re: run script as root</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/run-script-as-root/m-p/2567466#M30149</link>
      <description>hi,&lt;BR /&gt;however you can actually execute "chmod +s" on any file, and see its result with ll : "rws------" : a shell script will NOT be influenced by the set owner bit, it will still be executed by the executing user, not by the owner of the file.  I agree with Sridhar on this.&lt;BR /&gt;regards,&lt;BR /&gt;Thierry.</description>
      <pubDate>Tue, 21 Aug 2001 06:02:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/run-script-as-root/m-p/2567466#M30149</guid>
      <dc:creator>Thierry Poels_1</dc:creator>
      <dc:date>2001-08-21T06:02:14Z</dc:date>
    </item>
    <item>
      <title>Re: run script as root</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/run-script-as-root/m-p/2567467#M30150</link>
      <description>First, be very careful with suid programs and scripts!  They can work well but there's a number of security issues involved.  If set up without locking down the perms on the files and directories involved, you could leave the system wide open for all kinds of mischievousness as well as for accidental mistakes by your users.&lt;BR /&gt;&lt;BR /&gt;As others have said, suid on a script doesn't work (though I seen different results on different flavors of UNIX).  I've included a C program you can modify to call a script and run it as root.  The executable will need to be suid but the script itself could have 0 perms.&lt;BR /&gt;&lt;BR /&gt;Also, notice I use setuid(0) within the program.  That's because I've had some programs called from a script that didn't work without it even though the suid bit was on the executable.&lt;BR /&gt;&lt;BR /&gt;Though I don't use this anymore, here's how I set it up:&lt;BR /&gt;&lt;BR /&gt;Assuming mis group needs to run "script"&lt;BR /&gt;&lt;BR /&gt;/var/adm/local                550  root:mis&lt;BR /&gt;/var/adm/local/src            000  root:sys&lt;BR /&gt;/var/adm/local/src/runner.c   000  root:sys&lt;BR /&gt;/var/adm/local/bin            010  root:mis&lt;BR /&gt;/var/adm/local/bin/runner    4010  root:mis&lt;BR /&gt;/var/adm/local/scripts        000  root:sys&lt;BR /&gt;/var/adm/local/scripts/script 000  root:sys&lt;BR /&gt;&lt;BR /&gt;As always, use at your own risk.&lt;BR /&gt;&lt;BR /&gt;Darrell</description>
      <pubDate>Tue, 21 Aug 2001 13:43:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/run-script-as-root/m-p/2567467#M30150</guid>
      <dc:creator>Darrell Allen</dc:creator>
      <dc:date>2001-08-21T13:43:11Z</dc:date>
    </item>
    <item>
      <title>Re: run script as root</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/run-script-as-root/m-p/2567468#M30151</link>
      <description>Occasionally SUID DOES work on scripts..it has worked for me recently, and it apparently worked in this case as well..However, I also have had times when it does NOT work..I don't know the difference, I just know that sometimes it DOES work..</description>
      <pubDate>Tue, 21 Aug 2001 14:17:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/run-script-as-root/m-p/2567468#M30151</guid>
      <dc:creator>Kevin Wright</dc:creator>
      <dc:date>2001-08-21T14:17:47Z</dc:date>
    </item>
    <item>
      <title>Re: run script as root</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/run-script-as-root/m-p/2567469#M30152</link>
      <description>Hello Jim,&lt;BR /&gt;&lt;BR /&gt;well, SUID really *does* work on Scripts, BUT you have&lt;BR /&gt;to write your scripts in a slighty different way (you &lt;BR /&gt;should do all your scripts that way):&lt;BR /&gt;&lt;BR /&gt;- the first line MUST contain the interpreter-path, e.g.:&lt;BR /&gt;  #!/bin/sh&lt;BR /&gt;&lt;BR /&gt;- the next lines should set the $PATH to *trusted* dirs&lt;BR /&gt;  only, or you call all commands with absolute paths&lt;BR /&gt;&lt;BR /&gt;- the script should NOT have read-permissions for the&lt;BR /&gt;  group NOR for the world, but only for the owner&lt;BR /&gt;&lt;BR /&gt;- the script MUST have read and execute and SUID&lt;BR /&gt;  permission for the owner, but ONLY execute permission&lt;BR /&gt;  for group and world&lt;BR /&gt;&lt;BR /&gt;HTH,&lt;BR /&gt;   Wodisch</description>
      <pubDate>Tue, 21 Aug 2001 22:57:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/run-script-as-root/m-p/2567469#M30152</guid>
      <dc:creator>Wodisch</dc:creator>
      <dc:date>2001-08-21T22:57:25Z</dc:date>
    </item>
  </channel>
</rss>

