Extract FTP passwords from Plesk Server

Plesk servers (before version 11) store FTP usernames and passwords in cleartext in the database. I was looking for a method to get an overview of all FTP accounts to see if there were any weak passwords. If you have access to the command line you can use the following SQL query:

[root@Plesk /]# mysql -uadmin -p`cat /etc/psa/.psa.shadow` -e "use psa; select sys_users.home, sys_users.login, accounts.password from accounts INNER JOIN sys_users ON  accounts.id=sys_users.account_id;"

This will give you a nice overview of all usernames, passwords and the domain-name. Here’s what it looks like:

+------------------------------------------------------------+
| home                               | login    | password   |
+------------------------------------------------------------+
| /var/www/vhosts/domainname1.com    | mylogin  | mypass123  |
| /var/www/vhosts/mydomain.com       | myftp    | unsafe567  |
| /var/www/vhosts/anotherdomain.com  | ftpuser  | secret     |  
+------------------------------------------------------------+

A nice overview with all your domains, usernames and passwords for FTP. I hope this is useful to you!