Mysql Queries to retrieve email account password in Linux Plesk server

Steps to find email accounts password:

♦ Login to the linux server via SSH.

♦ Login to Mysql prompt using the command the given below.

mysql -u admin -p`cat /etc/psa/.psa.shadow`

~~~~
-bash-3.2# mysql -u admin -p`cat /etc/psa/.psa.shadow`
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 2338614
Server version: 5.0.77 Source distribution

Type ‘help;’ or ‘h’ for help. Type ‘c’ to clear the buffer.

mysql> use psa;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql>
~~~~

♣ Switch to psa database.

~~~
mysql> use psa;
Database changed
mysql>
~~~

♣ Now execute the following query to retrieve all the email accounts password in a domain.

~~~~
SELECT accounts.id, mail.mail_name, accounts.password, domains.name, domains.id, mail.dom_id, mail.account_id FROM domains, mail, accounts Where domains.id = mail.dom_id and mail.account_id = accounts.id and domains.name =’DOMAIN_NAME’;
~~~~

Where DOMAIN_NAME should be replaced by the actual domain name for which you need to find the password.

EXAMPLE:
*********

====
mysql> SELECT accounts.id, mail.mail_name, accounts.password, domains.name, domains.id, mail.dom_id, mail.account_id FROM domains, mail, accounts Where domains.id = mail.dom_id and mail.account_id = accounts.id and domains.name =’example.com’;
+—–+———–+———-+—————-+—-+——–+————+
| id | mail_name | password | name | id | dom_id | account_id |
+—–+———–+———-+—————-+—-+——–+————+
| 238 | mail1 | passwd1 | example.com | 50 | 50 | 238 |
| 239 | mail2 | passwd2 | example.com | 50 | 50 | 239 |
| 240 | mail3 | passwd3 | example.com | 50 | 50 | 240 |
| 241 | mail4 | passwd4 | example.com | 50 | 50 | 241 |
| 242 | mail5 | passwd5 | example.com | 50 | 50 | 242 |
+—–+———–+———-+—————-+—-+——–+————+
5 rows in set (0.00 sec)
====

Revisions

There are no revisions for this post.

Tags: , , ,

No comments yet.

Leave a Reply