Plesk Password retrieval via the command line (Linux / Windows)

Plesk Controlpanel has several tools to retrieve the ‘admin’ password to gain entrance to the Controlpanel. Up to version 10.2 these were just unencrypted text files (say what?) on the server. Since 10.2 you need to use a command to retrieve them in plain text (sounds better, doesn’t it?).

Linux#

For all versions lower than 10.2, just use the following at a shell:

# cat /etc/psa/.psa.shadow

For Plesk 10.2 up to (but not including) Onyx, use this:

# /usr/local/psa/bin/admin --show-password

In both cases, you’ll see the admin password in plain text.

As of Plesk Onyx, --show-password was removed for security reasons, and it’s gone in Obsidian too. There’s no longer any way to read back the plain-text admin password on a current Plesk. Instead, you generate a one-time login link (no password needed):

# plesk bin admin --get-login-link

That prints one or two URLs with a login token. Or, if you actually want to set a new password:

# plesk bin admin --set-admin-password -passwd 'YourNewPassword'

You can also use that password to log in directly to the MySQL shell.

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

That line still works in current Plesk too. On modern versions .psa.shadow holds an encrypted hash rather than the plain-text password, but MySQL accepts it as the admin user’s secret, so the command keeps working. Plesk also ships a shortcut for exactly this: plesk db drops you straight into the psa database as admin.

Windows#

On Windows, you can use one of the following.

> "%plesk_bin%\plesksrvclient" -get
> "%plesk_bin%\plesksrvclient" -get  -nogui