<?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 PS Command in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/ps-command/m-p/5811249#M481916</link>
    <description>&lt;P&gt;Hi experts,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I&amp;nbsp;need a small help ,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We had a recent requirement from apps team to replace the default PS command to their custom script ,This is to filter the password which is displaying in the PS command output .The action plan is ,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(a)&amp;nbsp;&amp;nbsp;&amp;nbsp; Move original &lt;STRONG&gt;ps &lt;/STRONG&gt;process into&lt;STRONG&gt; ps-org&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;(b)&amp;nbsp;&amp;nbsp; Change the permission to &lt;STRONG&gt;ps-org&lt;/STRONG&gt; &amp;nbsp;using &lt;STRONG&gt;chmod 700 ps-org, &amp;nbsp;&lt;/STRONG&gt;so that no one else except root can run original ps&lt;/P&gt;&lt;P&gt;(c)&amp;nbsp;&amp;nbsp;&amp;nbsp; Use above attached script as &lt;STRONG&gt;ps &lt;/STRONG&gt;and change the owner and group for this customized ps as root/root.&lt;/P&gt;&lt;P&gt;(d)&amp;nbsp;&amp;nbsp; Do the &lt;STRONG&gt;setuid&lt;/STRONG&gt; for the customized &lt;STRONG&gt;ps&lt;/STRONG&gt; using &lt;STRONG&gt;chmod &amp;nbsp;u+s ps, &amp;nbsp;&lt;/STRONG&gt;so that it can execute original ps but do the customized work.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Finally we will have following permissions:&lt;/P&gt;&lt;P&gt;-rwsr-sr-x &amp;nbsp;1 root root&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;358 &amp;nbsp;&amp;nbsp;Sep &amp;nbsp;22 &amp;nbsp;20:26&amp;nbsp; &amp;nbsp;ps&lt;/P&gt;&lt;P&gt;-rwx------ &amp;nbsp;&amp;nbsp;1 root root 79004 &amp;nbsp;&amp;nbsp;Mar 30&amp;nbsp; 2010 &amp;nbsp;&amp;nbsp;&amp;nbsp;ps-org&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This will be the new PS command&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;#!/usr/bin/perl -U&lt;/P&gt;&lt;P&gt;$arg = $ARGV[0];&lt;/P&gt;&lt;P&gt;# remove the possibility of any other command&lt;BR /&gt;$arg =~ s/;//g;&lt;BR /&gt;$arg =~ s/`//g;&lt;BR /&gt;$arg =~ s/\n//g;&lt;/P&gt;&lt;P&gt;$command = "ps-org $arg";&lt;/P&gt;&lt;P&gt;@result = `$command`;&lt;/P&gt;&lt;P&gt;foreach $line (@result){&lt;BR /&gt;&amp;nbsp;&amp;nbsp; if( $line =~ /(.*)xxxx_admin(.*)/ ){&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # do not display the password&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $line = "$1 xxx_admin -p *******\n";&lt;BR /&gt;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp;&amp;nbsp; print "$line";&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there any harm in doing so? Will it affect the system perf or booting sequence.?&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Anoop&lt;/P&gt;</description>
    <pubDate>Sun, 23 Sep 2012 06:59:50 GMT</pubDate>
    <dc:creator>Anoopkumarp</dc:creator>
    <dc:date>2012-09-23T06:59:50Z</dc:date>
    <item>
      <title>PS Command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ps-command/m-p/5811249#M481916</link>
      <description>&lt;P&gt;Hi experts,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I&amp;nbsp;need a small help ,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We had a recent requirement from apps team to replace the default PS command to their custom script ,This is to filter the password which is displaying in the PS command output .The action plan is ,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(a)&amp;nbsp;&amp;nbsp;&amp;nbsp; Move original &lt;STRONG&gt;ps &lt;/STRONG&gt;process into&lt;STRONG&gt; ps-org&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;(b)&amp;nbsp;&amp;nbsp; Change the permission to &lt;STRONG&gt;ps-org&lt;/STRONG&gt; &amp;nbsp;using &lt;STRONG&gt;chmod 700 ps-org, &amp;nbsp;&lt;/STRONG&gt;so that no one else except root can run original ps&lt;/P&gt;&lt;P&gt;(c)&amp;nbsp;&amp;nbsp;&amp;nbsp; Use above attached script as &lt;STRONG&gt;ps &lt;/STRONG&gt;and change the owner and group for this customized ps as root/root.&lt;/P&gt;&lt;P&gt;(d)&amp;nbsp;&amp;nbsp; Do the &lt;STRONG&gt;setuid&lt;/STRONG&gt; for the customized &lt;STRONG&gt;ps&lt;/STRONG&gt; using &lt;STRONG&gt;chmod &amp;nbsp;u+s ps, &amp;nbsp;&lt;/STRONG&gt;so that it can execute original ps but do the customized work.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Finally we will have following permissions:&lt;/P&gt;&lt;P&gt;-rwsr-sr-x &amp;nbsp;1 root root&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;358 &amp;nbsp;&amp;nbsp;Sep &amp;nbsp;22 &amp;nbsp;20:26&amp;nbsp; &amp;nbsp;ps&lt;/P&gt;&lt;P&gt;-rwx------ &amp;nbsp;&amp;nbsp;1 root root 79004 &amp;nbsp;&amp;nbsp;Mar 30&amp;nbsp; 2010 &amp;nbsp;&amp;nbsp;&amp;nbsp;ps-org&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This will be the new PS command&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;#!/usr/bin/perl -U&lt;/P&gt;&lt;P&gt;$arg = $ARGV[0];&lt;/P&gt;&lt;P&gt;# remove the possibility of any other command&lt;BR /&gt;$arg =~ s/;//g;&lt;BR /&gt;$arg =~ s/`//g;&lt;BR /&gt;$arg =~ s/\n//g;&lt;/P&gt;&lt;P&gt;$command = "ps-org $arg";&lt;/P&gt;&lt;P&gt;@result = `$command`;&lt;/P&gt;&lt;P&gt;foreach $line (@result){&lt;BR /&gt;&amp;nbsp;&amp;nbsp; if( $line =~ /(.*)xxxx_admin(.*)/ ){&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # do not display the password&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $line = "$1 xxx_admin -p *******\n";&lt;BR /&gt;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp;&amp;nbsp; print "$line";&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there any harm in doing so? Will it affect the system perf or booting sequence.?&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Anoop&lt;/P&gt;</description>
      <pubDate>Sun, 23 Sep 2012 06:59:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ps-command/m-p/5811249#M481916</guid>
      <dc:creator>Anoopkumarp</dc:creator>
      <dc:date>2012-09-23T06:59:50Z</dc:date>
    </item>
    <item>
      <title>Re: ps command (filtering)</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ps-command/m-p/5811271#M481917</link>
      <description>&lt;P&gt;&amp;gt;-rwx------&amp;nbsp;&amp;nbsp; 1 root root 79004&amp;nbsp;&amp;nbsp; Mar 30&amp;nbsp; 2010&amp;nbsp;&amp;nbsp;&amp;nbsp; ps-org&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This shouldn't be writable.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;gt;$command = "ps-org $arg";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This should have the absolute path.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;gt;Will it affect the system perf or booting sequence?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Not sure, you'll have to try it.&amp;nbsp;&amp;nbsp; Does the filtering part work?&lt;/P&gt;&lt;P&gt;You do know that ps(1) isn't special and that a user can write a program to get this info.&lt;/P&gt;</description>
      <pubDate>Sun, 23 Sep 2012 08:58:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ps-command/m-p/5811271#M481917</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2012-09-23T08:58:23Z</dc:date>
    </item>
  </channel>
</rss>

