<?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: Limiting &amp;quot;sudo kill&amp;quot; to killing only user processes in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/limiting-quot-sudo-kill-quot-to-killing-only-user-processes/m-p/4833947#M641702</link>
    <description>Shalom,&lt;BR /&gt;&lt;BR /&gt;The default properties of the OS protect system protect system processes from kill. I recommend a wrapper script as Patrick suggests.&lt;BR /&gt;&lt;BR /&gt;Give sudo rights to the wrapper script not kill. Set the permissions very carefully on the script.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;SEP</description>
    <pubDate>Wed, 20 Jul 2011 14:23:58 GMT</pubDate>
    <dc:creator>Steven E. Protter</dc:creator>
    <dc:date>2011-07-20T14:23:58Z</dc:date>
    <item>
      <title>Limiting "sudo kill" to killing only user processes</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/limiting-quot-sudo-kill-quot-to-killing-only-user-processes/m-p/4795050#M641690</link>
      <description>Hey gang,&lt;BR /&gt;&lt;BR /&gt;Has anyone come up with a way to allow a user to sudo kill but restricting it so it cannot kill system processes, etc?  Basically I want the user to be able to kill only user processes.&lt;BR /&gt;&lt;BR /&gt;Thanks</description>
      <pubDate>Fri, 03 Jun 2011 02:09:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/limiting-quot-sudo-kill-quot-to-killing-only-user-processes/m-p/4795050#M641690</guid>
      <dc:creator>TheJuiceman</dc:creator>
      <dc:date>2011-06-03T02:09:43Z</dc:date>
    </item>
    <item>
      <title>Re: Limiting "sudo kill" to killing only user processes</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/limiting-quot-sudo-kill-quot-to-killing-only-user-processes/m-p/4795051#M641691</link>
      <description>You would have to write a wrapper script for kill. The script would take the pid that you provide and make sure that it is allowed to be killed.</description>
      <pubDate>Fri, 03 Jun 2011 02:21:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/limiting-quot-sudo-kill-quot-to-killing-only-user-processes/m-p/4795051#M641691</guid>
      <dc:creator>Patrick Wallek</dc:creator>
      <dc:date>2011-06-03T02:21:21Z</dc:date>
    </item>
    <item>
      <title>Re: Limiting "sudo kill" to killing only user processes</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/limiting-quot-sudo-kill-quot-to-killing-only-user-processes/m-p/4795052#M641692</link>
      <description>Agreed.  How would be the best way to write a script like that?  Thanks</description>
      <pubDate>Fri, 03 Jun 2011 02:23:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/limiting-quot-sudo-kill-quot-to-killing-only-user-processes/m-p/4795052#M641692</guid>
      <dc:creator>TheJuiceman</dc:creator>
      <dc:date>2011-06-03T02:23:13Z</dc:date>
    </item>
    <item>
      <title>Re: Limiting "sudo kill" to killing only user processes</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/limiting-quot-sudo-kill-quot-to-killing-only-user-processes/m-p/4795053#M641693</link>
      <description>And it doesn't have to be "kill" per se.  I could have them run a different script called, say, "killuser" to perform the task.  I'm just not sure how to put in all the "safety guards" to make sure the script works without accidents or loopholes.  Thanks.</description>
      <pubDate>Fri, 03 Jun 2011 02:26:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/limiting-quot-sudo-kill-quot-to-killing-only-user-processes/m-p/4795053#M641693</guid>
      <dc:creator>TheJuiceman</dc:creator>
      <dc:date>2011-06-03T02:26:00Z</dc:date>
    </item>
    <item>
      <title>Re: Limiting "sudo kill" to killing only user processes</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/limiting-quot-sudo-kill-quot-to-killing-only-user-processes/m-p/4795054#M641694</link>
      <description>Shalom,&lt;BR /&gt;&lt;BR /&gt;The OS is set up to only let users kill processes they would have permissions to. Their own, stuff launched by their own group.&lt;BR /&gt;&lt;BR /&gt;Give sudo kill they can of course do anything.&lt;BR /&gt;&lt;BR /&gt;To have a granular kill, you need a script to take care of the decision to kill or not to kill.&lt;BR /&gt;&lt;BR /&gt;Someone may want to write that script for you, but its a project and if I can't write the script in a few minutes, or have it in inventory, I usually refer you to a consultant (sometimes me).&lt;BR /&gt;&lt;BR /&gt;I would in such a script check the process table and kill based on characteristics I find there.&lt;BR /&gt;&lt;BR /&gt;I mean if you only want to kill user scripts a simple way is to check for root and other system users, those are system, and any other user have at it.&lt;BR /&gt;&lt;BR /&gt;Give your users this power and they will crash something important. I can almost give you a warranty on that.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Fri, 03 Jun 2011 05:01:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/limiting-quot-sudo-kill-quot-to-killing-only-user-processes/m-p/4795054#M641694</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2011-06-03T05:01:57Z</dc:date>
    </item>
    <item>
      <title>Re: Limiting "sudo kill" to killing only user processes</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/limiting-quot-sudo-kill-quot-to-killing-only-user-processes/m-p/4795055#M641695</link>
      <description>&lt;!--!*#--&gt;&amp;gt;I want the user to be able to kill only user processes.&lt;BR /&gt;&lt;BR /&gt;What's your definition of a user process?  Anyone that isn't root, lp or sfmdb?&lt;BR /&gt;Or a UID &amp;lt; 1000?&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;# Kill a list of PIDs and skip ones for users&lt;BR /&gt;# with UID &amp;lt; 1000&lt;BR /&gt;&lt;BR /&gt;for pid in $*; do&lt;BR /&gt;   uid=$(UNIX95=EXTENDED_PS ps -p $pid -ouid=)&lt;BR /&gt;   if [ $uid &amp;lt; 1000 ]; then&lt;BR /&gt;      echo "skip system process" 2&amp;gt;&amp;amp;1&lt;BR /&gt;      continue&lt;BR /&gt;   fi&lt;BR /&gt;   kill $pid&lt;BR /&gt;done</description>
      <pubDate>Fri, 03 Jun 2011 05:55:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/limiting-quot-sudo-kill-quot-to-killing-only-user-processes/m-p/4795055#M641695</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2011-06-03T05:55:21Z</dc:date>
    </item>
    <item>
      <title>Re: Limiting "sudo kill" to killing only user processes</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/limiting-quot-sudo-kill-quot-to-killing-only-user-processes/m-p/4795056#M641696</link>
      <description>Thanks Dennis.  That is closer to what I am looking for.  Just need to put in "safe guards" to eliminate possible mistakes or work-arounds.  Any suggestions?</description>
      <pubDate>Mon, 13 Jun 2011 13:10:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/limiting-quot-sudo-kill-quot-to-killing-only-user-processes/m-p/4795056#M641696</guid>
      <dc:creator>TheJuiceman</dc:creator>
      <dc:date>2011-06-13T13:10:45Z</dc:date>
    </item>
    <item>
      <title>Re: Limiting "sudo kill" to killing only user processes</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/limiting-quot-sudo-kill-quot-to-killing-only-user-processes/m-p/4795057#M641697</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;&amp;gt; Just need to put in "safe guards" to eliminate possible mistakes or work-arounds.&lt;BR /&gt;&lt;BR /&gt;By setting UNIX95 (XPG4) behavior you have the ability to create custom 'ps' queries as the manpages document.  As Dennis suggested, you could limit candidates to those whose UID is in an acceptable range.  You might want to evaluate based on elapsed runtime and or combinations of parameters (e.g. uid, etime and command name).&lt;BR /&gt;&lt;BR /&gt;WIth the 'UNIX95' behavior, selection by command name can be made "exactly" with the '-C' option:&lt;BR /&gt;&lt;BR /&gt;# UNIX95= ps -C sh -opid -ouid= -oetime=&lt;BR /&gt;&lt;BR /&gt;...which would return a list of 'sh' processes where the list consists of the 'pid', 'uid' and elapsed time without a heading (which is what the "=" suppresses.  You could then further parse this output to collect a subset of pids to kill.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Mon, 13 Jun 2011 14:03:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/limiting-quot-sudo-kill-quot-to-killing-only-user-processes/m-p/4795057#M641697</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2011-06-13T14:03:44Z</dc:date>
    </item>
    <item>
      <title>Re: Limiting "sudo kill" to killing only user processes</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/limiting-quot-sudo-kill-quot-to-killing-only-user-processes/m-p/4833737#M641698</link>
      <description>&lt;P&gt;Thank you for the responses.&amp;nbsp; Would there be an easy way to limit the processes being killed to those being started by someone/something in a particular group (ie. only processes started by someone in group "users")?&amp;nbsp; This would be a better (and safer) solution for me than limiting UID's to under 1000, etc.&amp;nbsp; Thanks!!!!&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jul 2011 13:07:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/limiting-quot-sudo-kill-quot-to-killing-only-user-processes/m-p/4833737#M641698</guid>
      <dc:creator>TheJuiceman</dc:creator>
      <dc:date>2011-07-20T13:07:03Z</dc:date>
    </item>
    <item>
      <title>Re: Limiting "sudo kill" to killing only user processes</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/limiting-quot-sudo-kill-quot-to-killing-only-user-processes/m-p/4833777#M641699</link>
      <description>errr.....I mean UID &amp;gt; 1000.....you know what I mean ha</description>
      <pubDate>Wed, 20 Jul 2011 13:22:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/limiting-quot-sudo-kill-quot-to-killing-only-user-processes/m-p/4833777#M641699</guid>
      <dc:creator>TheJuiceman</dc:creator>
      <dc:date>2011-07-20T13:22:49Z</dc:date>
    </item>
    <item>
      <title>Re: Limiting "sudo kill" to killing only user processes</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/limiting-quot-sudo-kill-quot-to-killing-only-user-processes/m-p/4833779#M641700</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE&gt;&lt;a href="https://community.hpe.com/t5/user/viewprofilepage/user-id/609803"&gt;@TheJuiceman&lt;/a&gt; wrote:&lt;/BLOCKQUOTE&gt;&lt;BLOCKQUOTE&gt;Would there be an easy way to limit the processes being killed to those being started by someone/something in a particular group (ie. only processes started by someone in group "users")?&lt;/BLOCKQUOTE&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Well, again, using the UNIX95 behavior allows you to collect various views of *group* information.&amp;nbsp; For that matter, the 'ps' can specify group numbers or names given in a 'gidlist' argument ('-G gidlist).﻿&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You should really look at the manpages for 'ps(1)'.&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;</description>
      <pubDate>Wed, 20 Jul 2011 13:23:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/limiting-quot-sudo-kill-quot-to-killing-only-user-processes/m-p/4833779#M641700</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2011-07-20T13:23:12Z</dc:date>
    </item>
    <item>
      <title>Re: Limiting "sudo kill" to killing only user processes</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/limiting-quot-sudo-kill-quot-to-killing-only-user-processes/m-p/4833785#M641701</link>
      <description>&lt;P&gt;The man pages are your friend.&amp;nbsp; Looking at "man (1) ps", you will see the "-G &lt;U&gt;gidlist&lt;/U&gt;" option, which will "Select processes whose real groupd ID numbers or group names are given in &lt;U&gt;gidlist&lt;/U&gt;"&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jul 2011 13:24:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/limiting-quot-sudo-kill-quot-to-killing-only-user-processes/m-p/4833785#M641701</guid>
      <dc:creator>Pete Randall</dc:creator>
      <dc:date>2011-07-20T13:24:30Z</dc:date>
    </item>
    <item>
      <title>Re: Limiting "sudo kill" to killing only user processes</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/limiting-quot-sudo-kill-quot-to-killing-only-user-processes/m-p/4833947#M641702</link>
      <description>Shalom,&lt;BR /&gt;&lt;BR /&gt;The default properties of the OS protect system protect system processes from kill. I recommend a wrapper script as Patrick suggests.&lt;BR /&gt;&lt;BR /&gt;Give sudo rights to the wrapper script not kill. Set the permissions very carefully on the script.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Wed, 20 Jul 2011 14:23:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/limiting-quot-sudo-kill-quot-to-killing-only-user-processes/m-p/4833947#M641702</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2011-07-20T14:23:58Z</dc:date>
    </item>
    <item>
      <title>Re: Limiting "sudo kill" to killing only user processes</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/limiting-quot-sudo-kill-quot-to-killing-only-user-processes/m-p/4834099#M641703</link>
      <description>&lt;P&gt;Thanks.&amp;nbsp; It looks like the "UNIX95= ps -G &amp;lt;group&amp;gt;" route may be the way to go for me.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How could I best write a "wrapper" so that when someone calls my "kill" script via sudo such as....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;sudo kill 123 456 789 12345 ... ...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;that the script will determine that processes "123", "456",&amp;nbsp;etc &amp;nbsp;are GID of the group I am allowing kill access and allow the kill?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you again for your help.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jul 2011 15:40:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/limiting-quot-sudo-kill-quot-to-killing-only-user-processes/m-p/4834099#M641703</guid>
      <dc:creator>TheJuiceman</dc:creator>
      <dc:date>2011-07-20T15:40:29Z</dc:date>
    </item>
    <item>
      <title>Re: Limiting "sudo kill" to killing only user processes</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/limiting-quot-sudo-kill-quot-to-killing-only-user-processes/m-p/4834109#M641704</link>
      <description>the "sudo kill" would not be for the actual "kill" command. I was just using that to demonstrate what I wish to do. Thanks!!!</description>
      <pubDate>Wed, 20 Jul 2011 15:46:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/limiting-quot-sudo-kill-quot-to-killing-only-user-processes/m-p/4834109#M641704</guid>
      <dc:creator>TheJuiceman</dc:creator>
      <dc:date>2011-07-20T15:46:00Z</dc:date>
    </item>
    <item>
      <title>Re: Limiting "sudo kill" to killing only user processes</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/limiting-quot-sudo-kill-quot-to-killing-only-user-processes/m-p/4834137#M641705</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://community.hpe.com/t5/user/viewprofilepage/user-id/609803"&gt;@TheJuiceman&lt;/a&gt; wrote:&lt;BR /&gt;&lt;P&gt;Thanks.&amp;nbsp; It looks like the "UNIX95= ps -G &amp;lt;group&amp;gt;" route may be the way to go for me.&lt;/P&gt;&lt;P&gt;How could I best write a "wrapper" so that when someone calls my "kill" script via sudo such as....&lt;/P&gt;&lt;P&gt;sudo kill 123 456 789 12345 ... ...&lt;/P&gt;&lt;P&gt;that the script will determine that processes "123", "456",&amp;nbsp;etc &amp;nbsp;are GID of the group I am allowing kill access and allow the kill?&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Hi:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Why do you need another script to call your script?&amp;nbsp; I assume that you simply need an argument&amp;nbsp; that denotes the GID of processes you want to kill.&amp;nbsp; All you need do is collect the PIDs that match your criteria and issue a 'kill' for that list.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For that matter, if you are running 11.31, have a look at 'pkill(1)'.&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;</description>
      <pubDate>Wed, 20 Jul 2011 16:02:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/limiting-quot-sudo-kill-quot-to-killing-only-user-processes/m-p/4834137#M641705</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2011-07-20T16:02:46Z</dc:date>
    </item>
    <item>
      <title>Re: Limiting "sudo kill" to killing only user processes</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/limiting-quot-sudo-kill-quot-to-killing-only-user-processes/m-p/4834215#M641706</link>
      <description>&lt;P&gt;Unfortunately, this is a 11.23 box.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You are correct.&amp;nbsp; I just need a way to limit the kill command to executing against PID's that fit my GID criteria.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Example:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;sudo scriptkill 123 456 7890&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-&amp;nbsp; Do these EXACT processes 123, 456, and 7890 exist?&lt;/P&gt;&lt;P&gt;-&amp;nbsp; If so, do they meet the GID requirement?&lt;/P&gt;&lt;P&gt;-&amp;nbsp; If so, perform a kill on these EXACT PID's, no wildcards or partial returns (ie. allow a kill on process "123" but not "1234" or "2123" ).&lt;/P&gt;&lt;P&gt;-&amp;nbsp; If the criterias are not met, do not allow a kill.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jul 2011 16:35:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/limiting-quot-sudo-kill-quot-to-killing-only-user-processes/m-p/4834215#M641706</guid>
      <dc:creator>TheJuiceman</dc:creator>
      <dc:date>2011-07-20T16:35:02Z</dc:date>
    </item>
    <item>
      <title>Re: Limiting "sudo kill" to killing only user processes</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/limiting-quot-sudo-kill-quot-to-killing-only-user-processes/m-p/4834257#M641707</link>
      <description>&lt;P&gt;Hi (again):&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://community.hpe.com/t5/user/viewprofilepage/user-id/609803"&gt;@TheJuiceman&lt;/a&gt; wrote:&lt;BR /&gt;&lt;P&gt;You are correct.&amp;nbsp; I just need a way to limit the kill command to executing against PID's that fit my GID criteria.&lt;BR /&gt;Example:&lt;/P&gt;&lt;P&gt;sudo scriptkill 123 456 7890&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-&amp;nbsp; Do these EXACT processes 123, 456, and 7890 exist?&lt;/P&gt;&lt;P&gt;-&amp;nbsp; If so, do they meet the GID requirement?&lt;/P&gt;&lt;P&gt;-&amp;nbsp; If so, perform a kill on these EXACT PID's, no wildcards or partial returns (ie. allow a kill on process "123" but not "1234" or "2123" ).-&amp;nbsp; If the criterias are not met, do not allow a kill&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;BLOCKQUOTE&gt;Leveraging the '-p PID' argument to first find candidates:&lt;/BLOCKQUOTE&gt;&lt;BLOCKQUOTE&gt;# ps -p &amp;lt;PID&amp;gt; -o pid= -o gid=&lt;/BLOCKQUOTE&gt;&lt;BLOCKQUOTE&gt;This gives you a list (in two columns) of PIDs and GIDs.&amp;nbsp; If you like, you can fetch a list of processes like:&lt;/BLOCKQUOTE&gt;&lt;BLOCKQUOTE&gt;# ps -p 123,456,7890 -o pid= -o gid=&lt;/BLOCKQUOTE&gt;&lt;BLOCKQUOTE&gt;The "=" sign after each specification suppresses the header line making further parsing of the list easier.&lt;/BLOCKQUOTE&gt;&lt;BLOCKQUOTE&gt;Add any additional columns as necessary; walk the list; match what you want; extract the first field (column) for a PID to kill()'&lt;/BLOCKQUOTE&gt;&lt;BLOCKQUOTE&gt;Regards!&lt;/BLOCKQUOTE&gt;&lt;BLOCKQUOTE&gt;...JRF...&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Wed, 20 Jul 2011 16:58:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/limiting-quot-sudo-kill-quot-to-killing-only-user-processes/m-p/4834257#M641707</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2011-07-20T16:58:57Z</dc:date>
    </item>
    <item>
      <title>Re: Limiting "sudo kill" to killing only user processes</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/limiting-quot-sudo-kill-quot-to-killing-only-user-processes/m-p/4834317#M641708</link>
      <description>&lt;P&gt;&amp;gt;-&amp;nbsp; If so, do they meet the GID requirement?﻿&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Just take my script above and use "-ogid=" and then check for equality:&lt;/P&gt;&lt;P&gt;gid=$(UNIX95=EXTENDED_PS ps -p $pid -ogid=)&lt;BR /&gt;if [ "$gid" != some-magic-gid ]; then&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo "skip wrong group process" 2&amp;gt;&amp;amp;1&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; continue﻿&lt;/P&gt;&lt;P&gt;fi&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jul 2011 19:08:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/limiting-quot-sudo-kill-quot-to-killing-only-user-processes/m-p/4834317#M641708</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2011-07-20T19:08:30Z</dc:date>
    </item>
    <item>
      <title>Re: Limiting "sudo kill" to killing only user processes</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/limiting-quot-sudo-kill-quot-to-killing-only-user-processes/m-p/4835699#M641709</link>
      <description>&lt;P&gt;You guys are the best!!!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is really close now.&amp;nbsp; Just one last piece.....is there a way to prevent wildcards?&amp;nbsp; I would like to prevent someone from executing something like "sudo scriptkill * " or "sudo scriptkill abcd".&amp;nbsp; The latter returns a nasty message.&amp;nbsp; The wildcard, however, is returning a lot of "interesting" possiblities....yikes!!!&amp;nbsp; Is there a way to restrict the input to accept only numerical entries and no wildcards?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again!!!&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jul 2011 15:58:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/limiting-quot-sudo-kill-quot-to-killing-only-user-processes/m-p/4835699#M641709</guid>
      <dc:creator>TheJuiceman</dc:creator>
      <dc:date>2011-07-21T15:58:25Z</dc:date>
    </item>
  </channel>
</rss>

