Mysql Queries to retrieve FTP password in Linux Plesk server

Steps to find FTP accounts password:

 

♦ Login to the 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 login AS FTP_USER,password AS FTP_PASS,home AS DOMAIN_ROOT,accounts.id,sys_users.account_id FROM accounts, sys_users WHERE accounts.id=sys_users.account_id AND home=’/var/www/vhosts/DOMAIN_NAME’;

~~~~

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

EXAMPLE:
*******

===
SELECT login AS FTP_USER,password AS FTP_PASS,home AS DOMAIN_ROOT,accounts.id,sys_users.account_id FROM accounts, sys_users WHERE accounts.id=sys_users.account_id AND home=’/var/www/vhosts/example.com’;
+———-+————–+——————————–+—–+————+
| FTP_USER | FTP_PASS | DOMAIN_ROOT | id | account_id |
+———-+————–+——————————–+—–+————+
| ftpuser | ftppaswd!@ | /var/www/vhosts/example.com | 236 | 236 |
+———-+————–+——————————–+—–+————+
1 row in set (0.00 sec)
===

 

Revisions

There are no revisions for this post.

Tags: , , ,

No comments yet.

Leave a Reply