Tuesday, 13 December 2011

Plesk + Retrieve EMAIL account password

FOR BOTH LINUX AND WINDOWS SERVERS:
In a shared server(both linux and windows), it is quite tedious to determine the email password for email accounts if you are not much familiar with MySQL. But you can use the following command to retrieve all the email password for a domain.

=======
SELECT mail.mail_name, accounts.password FROM domains LEFT JOIN mail ON domains.id = mail.dom_id LEFT JOIN accounts ON mail.account_id = accounts.id WHERE domains.name = 'yourdomain.com'
=======

Steps:
1. Login to MySQL prompt
[For Linux]
mysql -uadmin -p`cat /etc/psa/.psa.shadow`
[For Windows]
1. Retrieve the Plesk password [ cd %plesk_bin%, plesksrvclient.exe -get ]
1. Goto plesk directory [cd %plesk_dir%]
2. Goto the bin folder of the MySQL directory [cd Databases\MySQL\bin
mysql.exe -uadmin -penter_password_here -P8306

2. Use psa database;
use psa;

3. Execute the following query

======
SELECT mail.mail_name, accounts.password FROM domains LEFT JOIN mail ON domains.id = mail.dom_id LEFT JOIN accounts ON mail.account_id = accounts.id WHERE domains.name = 'domain.com';
======

===============

ONLY FOR LINUX SERVERS:

Alternatively, for Linux servers you can use the following command to retrieve the email password for a specific mail account.

==========
/usr/local/psa/admin/bin/mail_auth_view |grep name@domain.com
==========

No comments: