<?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: sudo config question in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/sudo-config-question/m-p/3091796#M144992</link>
    <description>bob,&lt;BR /&gt; &lt;BR /&gt;You don't have to modify their code.  Just get "sudo" to run a script that checks the permissions and decide wether to allow the real program to run or not.&lt;BR /&gt; &lt;BR /&gt;Checking permission by the output of "ls -l" is annoying so I am attaching a little c program for you that can output the permission of the file as a number or as the rwxrwxrwx format.  It can tell you loads of other stuff too if you want.  You can put this in your checking script.&lt;BR /&gt; &lt;BR /&gt;compile the program with "cc -s -o mgstat mgstat.c" and run it as "mgstat -p octal filename" for the permision number or "mgstat -p string filename" for the string output.  The program must have an argument or it segfaults which I can't fix right now as I don't have a compiler.</description>
    <pubDate>Mon, 13 Oct 2003 14:54:33 GMT</pubDate>
    <dc:creator>Mark Grant</dc:creator>
    <dc:date>2003-10-13T14:54:33Z</dc:date>
    <item>
      <title>sudo config question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sudo-config-question/m-p/3091790#M144986</link>
      <description>Can sudo be configured to check ownership/permissions of /usr/local/bin/myscript before allowing a user to execute it?</description>
      <pubDate>Mon, 13 Oct 2003 09:01:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sudo-config-question/m-p/3091790#M144986</guid>
      <dc:creator>bob folsom</dc:creator>
      <dc:date>2003-10-13T09:01:17Z</dc:date>
    </item>
    <item>
      <title>Re: sudo config question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sudo-config-question/m-p/3091791#M144987</link>
      <description>I don't think this is an option with sudo.&lt;BR /&gt; &lt;BR /&gt;However, you could write a wrapper script that gets run from sudo and checks the permissions itself</description>
      <pubDate>Mon, 13 Oct 2003 09:04:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sudo-config-question/m-p/3091791#M144987</guid>
      <dc:creator>Mark Grant</dc:creator>
      <dc:date>2003-10-13T09:04:59Z</dc:date>
    </item>
    <item>
      <title>Re: sudo config question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sudo-config-question/m-p/3091792#M144988</link>
      <description>sudo allows you to run a script as a specified user.  So in theory yes.  You could setup a user, (usera) that is the only user allowed to run /usr/local/bin/myscript.  Then through sudo give userb and userc the ability to run myscript as usera.  Userb and userc would not be able to run the script as themselves but only through sudo.&lt;BR /&gt;&lt;BR /&gt;Does that answer your question?&lt;BR /&gt;&lt;BR /&gt;--Jim</description>
      <pubDate>Mon, 13 Oct 2003 13:12:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sudo-config-question/m-p/3091792#M144988</guid>
      <dc:creator>James Specht</dc:creator>
      <dc:date>2003-10-13T13:12:47Z</dc:date>
    </item>
    <item>
      <title>Re: sudo config question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sudo-config-question/m-p/3091793#M144989</link>
      <description>Jim - thanks for the answer, but it does not help my current problem.  I have an in-house script that needs to run as root, and as added security, I want sudo to be able to chekc that this file is root owned, with the correct perms.</description>
      <pubDate>Mon, 13 Oct 2003 13:44:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sudo-config-question/m-p/3091793#M144989</guid>
      <dc:creator>bob folsom</dc:creator>
      <dc:date>2003-10-13T13:44:45Z</dc:date>
    </item>
    <item>
      <title>Re: sudo config question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sudo-config-question/m-p/3091794#M144990</link>
      <description>You could have the script check the mode and ownership of itself before continuing.  Something like this would check for root as the owner and a file permission of -rwx------.  Place these two lines after your #!/usr/bin/sh and the script will check itself.&lt;BR /&gt;&lt;BR /&gt;[ "$(ls -l /usr/local/bin/myscript|tr -s ' '|cut -d ' ' -f1)" != "-rwx------" ] &amp;amp;&amp;amp; exit&lt;BR /&gt;[ "$(ls -l /usr/local/bin/myscript|tr -s ' '|cut -d ' ' -f3)" != "root" ] &amp;amp;&amp;amp; exit&lt;BR /&gt;&lt;BR /&gt;If you are actually worried about users changing the scripts in /usr/local/bin change the sticky bit on the directory so only the owner can change the files within.  chmod +t /user/local/bin I believe is correct syntax.&lt;BR /&gt;&lt;BR /&gt;--Jim</description>
      <pubDate>Mon, 13 Oct 2003 14:06:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sudo-config-question/m-p/3091794#M144990</guid>
      <dc:creator>James Specht</dc:creator>
      <dc:date>2003-10-13T14:06:18Z</dc:date>
    </item>
    <item>
      <title>Re: sudo config question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sudo-config-question/m-p/3091795#M144991</link>
      <description>Jim - I was hoping to avoid having to do this, but that is a path that would work (the script is not acutally in /usr/local/bin, but in a user owned dir, and I do not want to have to modify thier code, but will of I have to).</description>
      <pubDate>Mon, 13 Oct 2003 14:36:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sudo-config-question/m-p/3091795#M144991</guid>
      <dc:creator>bob folsom</dc:creator>
      <dc:date>2003-10-13T14:36:39Z</dc:date>
    </item>
    <item>
      <title>Re: sudo config question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sudo-config-question/m-p/3091796#M144992</link>
      <description>bob,&lt;BR /&gt; &lt;BR /&gt;You don't have to modify their code.  Just get "sudo" to run a script that checks the permissions and decide wether to allow the real program to run or not.&lt;BR /&gt; &lt;BR /&gt;Checking permission by the output of "ls -l" is annoying so I am attaching a little c program for you that can output the permission of the file as a number or as the rwxrwxrwx format.  It can tell you loads of other stuff too if you want.  You can put this in your checking script.&lt;BR /&gt; &lt;BR /&gt;compile the program with "cc -s -o mgstat mgstat.c" and run it as "mgstat -p octal filename" for the permision number or "mgstat -p string filename" for the string output.  The program must have an argument or it segfaults which I can't fix right now as I don't have a compiler.</description>
      <pubDate>Mon, 13 Oct 2003 14:54:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sudo-config-question/m-p/3091796#M144992</guid>
      <dc:creator>Mark Grant</dc:creator>
      <dc:date>2003-10-13T14:54:33Z</dc:date>
    </item>
  </channel>
</rss>

