- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: ps command (filtering)
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2012 11:59 PM
09-22-2012 11:59 PM
PS Command
Hi experts,
I need a small help ,
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 ,
(a) Move original ps process into ps-org
(b) Change the permission to ps-org using chmod 700 ps-org, so that no one else except root can run original ps
(c) Use above attached script as ps and change the owner and group for this customized ps as root/root.
(d) Do the setuid for the customized ps using chmod u+s ps, so that it can execute original ps but do the customized work.
Finally we will have following permissions:
-rwsr-sr-x 1 root root 358 Sep 22 20:26 ps
-rwx------ 1 root root 79004 Mar 30 2010 ps-org
This will be the new PS command
#!/usr/bin/perl -U
$arg = $ARGV[0];
# remove the possibility of any other command
$arg =~ s/;//g;
$arg =~ s/`//g;
$arg =~ s/\n//g;
$command = "ps-org $arg";
@result = `$command`;
foreach $line (@result){
if( $line =~ /(.*)xxxx_admin(.*)/ ){
# do not display the password
$line = "$1 xxx_admin -p *******\n";
}
print "$line";
}
Is there any harm in doing so? Will it affect the system perf or booting sequence.?
Thanks
Anoop
- Tags:
- PS
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-23-2012 01:58 AM
09-23-2012 01:58 AM
Re: ps command (filtering)
>-rwx------ 1 root root 79004 Mar 30 2010 ps-org
This shouldn't be writable.
>$command = "ps-org $arg";
This should have the absolute path.
>Will it affect the system perf or booting sequence?
Not sure, you'll have to try it. Does the filtering part work?
You do know that ps(1) isn't special and that a user can write a program to get this info.