ps -ef|grep help !!!!

Hi ,
I m facing a problem like the following ..

I have a script a.sh which is calling an executable B by passing some command line arguments.

During the process if I do a ps -ef|grep of the process , it will display the command line arguments( which includes the passwd ) .
it would be great if some one can help me out in hiding the command line agruments from being displayed by grepping or any shuch commands

Thanks a lot in advace

Binu

I dont think grep or any such tools have that capability to change ps listing format.

I ran into something similiar, sometime back. Here are some possible approaches you could try.

  1. Blanking out passwords i.e. argv[n]
    http://groups.google.com/group/comp.unix.shell/browse_thread/thread/63f91ae14df39eb7/847044f4b8840dd6?lnk=st&q=mask\+password\+from\+ps\+listing&rnum=6\#847044f4b8840dd6

  2. A pstat solution available on HPUX

  3. setproctitle() system call available only on BSD'ish systems.

  4. And the legendary hide.c from Oracle. (Check for this source code on the net. This solution is fool-proof but no hack-proof).

  5. Yet another possible one is: assign the password to an env variable. Once the applications starts, exec your self by reading the values from those env variables. Ofcourse, you would need to clear the env variables.

  6. Or you could pick up the setproctitle implementation for linux. I dont have the link. But here is the documentation header to that file

/*
 * setproctitle implementation for linux.
 * Stolen from sendmail 8.7.4 and bashed around by David A. Holland
 */
/*
 * Copyright (c) 1983, 1995 Eric P. Allman
 * Copyright (c) 1988, 1993
 *	The Regents of the University of California.  All rights reserved.
 *
.
.
.
* From: @(#)conf.c	8.243 (Berkeley) 11/20/95
 */
char setproctitle_rcsid[] =
  "$Id: setproctitle.c,v 1.3 1997/05/19 12:58:15 dholland Exp $";

Check it up on the net. It is part of some ftp package.

-vino.