Reputation: 819
I have a script, written in C, which requires 3 parameters: host, name, password, like this:
./myscript 1.1.1.1 name mypassword
I call this using PHP exec command (need to, functionality not found in PHP).
exec('./myscript $host $name $password');
In linux, using ps command, I can see:
./myscript 1.1.1.1 name password.
How can I hide my password, that you can't see it on linux using ps?
Thank you.
Upvotes: 1
Views: 538
Reputation: 89
There are example out there which does something you like: http://www.lenzg.net/archives/256-Basic-MySQL-Security-Providing-passwords-on-the-command-line.html Remember, your password is still visible for a fraction of time.
Upvotes: 1
Reputation: 4529
Since you are in a running environment. I'd temporary store your password in an environment variable (SET
) and use this variable in your exec()
. This way your password won't show up in ps
.
Upvotes: 2
Reputation: 21
You could simply prompt the password after starting the executing of the C-script and forward the password via an pipe in PHP exec.
Upvotes: 1