Witness:
$ ps f
PID TTY STAT TIME COMMAND
31509 pts/3 Ss 0:01 -bash
27266 pts/3 S+ 0:00 \_ mysql -uroot -p
25210 pts/10 Ss+ 0:00 /bin/bash
24444 pts/4 Ss 0:00 -bash
29111 pts/4 S+ 0:00 \_ tmux attach
4833 pts/5 Ss+ 0:00 -bash
9046 pts/6 Ss 0:00 -bash
17749 pts/6 R+ 0:00 \_ ps f
4748 pts/0 Ss 0:00 -bash
14635 pts/0 T 0:02 \_ mysql -uroot -px xxxxxxxxxxxxxxxx
16210 pts/0 S+ 0:01 \_ mysql -uroot -px xxxxxxxxxxxxxxxx
How did ps know to hide the mysql
passwords? Can I incorporate this into my own scripts to hide particular CLI attributes?
mysql
does the magic, notps
: “MySQL clients typically overwrite the command-line password argument with zeros during their initialization sequence.” – End-User Guidelines for Password Security