How to protect my passwords list (in different databases for example) in a UNIX environment where most of the users have sudo
access to other user IDs?
I have a script (main.sh
) with the following content in my $HOME
:
$ cat main.sh
mysql --skip-column-names -hmysql_host -umy_user -pmy_password -ADmysql_db << EOF >> /home/my_user/mysql.log
select current_date;
EOF
when another user (another_user
) tries sudo su - my_user
, then he/she is able to see my passwords for the MySQL database.
Even if I put the password in .bashrc
and access it through some variable in my script, he/she will be able to see my password in the .bashrc
file.
How can I protect my MySQL password from that user another_user
?