Link to home
Start Free TrialLog in
Avatar of jon_pincott
jon_pincott

asked on

Hiding command line parameters from ps -ef

How do I stop the parameters passed to a job from showing up in the ps -ef listing?
Avatar of NTIVER
NTIVER

you could try using "cut" depending on your scenario.  

Example:

If you always saw this in your ps -ef:

root  1609     1    1   Jun 20 ?        4:37 bin/usd /usr/spool/uv -t

Purely for example.

You could use cut to grab just the output that you want.  Suppose I wanted just everything before the first ":" in the above line I'd use:

ps -ef | cut -d":" -f1

-d":" is the delimiter of :
-f1 is the occurence of the output (i.e 1)

The above would yield:

root  1609     1    1   Jun 20 ?        4

So, it MAY work depending on what parameters are passed and whether there's always a generic characcter you can use for the delimiter.

Neil
Avatar of jon_pincott

ASKER

Thanks Neil, but that's not quite what I'm after.  I need to stop the parameters from appearing in the ps output at all, e.g. to stop other users from snooping at my command line input.

Example:
Somewhere in a script there is a call to a custom C program, and a username and password are passed as parameters.  The problem is that this C program and its parameters are visible in the ps -ef listing, so anyone can snoop around and grab the username and password.

Unfortunatly messing with the C is not an option, so I need a general solution.
ASKER CERTIFIED SOLUTION
Avatar of tfewster
tfewster
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks.  Found another solution but this deals with the remaining cases.