Plesk - Retrieve FTP & Mail Details

I am often tasked with checking something out over FTP, or retrieving a customers mail details. The shared hosting servers I use all use Plesk, which makes it fairly easy!

Change to the Plesk Database

USE psa;

 

Check FTP Details

SELECT REPLACE(sys_users.home,'/var/www/vhosts/','') AS domain,
sys_users.login,accounts.password, sys_users.home AS home_directory
FROM sys_users
LEFT JOIN accounts on sys_users.account_id=accounts.id
ORDER BY sys_users.home ASC;

Check Mail Details

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

The mail details query will even show NULL for the mail_name & password if they don’t have any email accounts on their domain. Useful for checking when you are told that a mailbox exists that turns out to be on a different server!!!