Get MySQL Passwords from Plesk (bash/command line)

Quick bash script to grep out MySQL passwords from Plesk’s PSA database.


[code language=”bash”]#!/bin/bash


echo "Searching MySQL user tables for: $1";
mysql psa -uadmin -p`cat /etc/psa/.psa.shadow` -e ‘SELECT AS domain_name, AS database_name, db_users.login, accounts.password FROM data_bases, db_users, domains, accounts WHERE data_bases.dom_id = AND db_users.db_id = AND db_users.account_id = ORDER BY domain_name;’ | grep $1;


[code gutter=”false”][root@mail bin]# grepmysql test[/code]

Output (domain | db | user | pass):

[code gutter=”false”]Searching MySQL user tables for: test test p455 auser p4551 username passtest123
[root@mail bin]#

Leave a Reply

Your email address will not be published. Required fields are marked *