After understanding the problem with using a password in the command line, I need to find a way of feeding a program with a password without it being a problem (without the password being recorded somewhere).
I have a bash script that automatically installs an entire LAMP server from source: Apache, FastCGI, PHP & MySQL. These installations require a password, especially MySQL.
How can I make the script fully automated without revealing the password?
Edit (9 June, 3:55 UTC):
I'm invoking mysql with a password on the command line, via root:
root@dor-desktop:/home/dor# PASS=`cat /home/dor/tmpf/pass` root@dor-desktop:/home/dor# mysql -u root -p"$PASS" Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 6
(PASS="p4ssw0rd" in our case)
And I execute
ps aux | grep mysql via my regular user (dor), which doesn't show me the password!
ps output is:
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 3562 0.0 0.0 34156 2864 pts/0 S+ 05:53 0:00 mysql -u root -px xxxxxx
How's that possible?