If I use a password as a command-line parameter it’s public on the system using ps.
But if I’m in a bash shell script and I do something like:
...
{ somecommand -p mypassword }
...
is this still going to show up in the process list? Or is this safe?
- How about sub-processes: (…)? Unsafe right?
- coprocess?
Command lines will always be visible (if only through /proc).
So the only real solution is: don’t. You might supply it on stdin, or a dedicated fd:
with a script like (simplicity first)
(this sample would just dump a bad password to stdout)
Now all you need to be concerned with is: