Monthly Archives: August 2008

Recover plesk access

Here's a scenario: you're locked out of plesk admin, you forgot the password and can't recover cause your email address is not set in the contact details.

Still have ssh access as root (ssh keys or can still remember password for root ) ? Most of the time I use dsa keys for ssh authentication.
If you do then you can change the password for admin.

Plesk keeps it's password in the psa mysql database so you just have to change it in the psa.accounts table . But to have access to it you need access as root in mysql.
If you don't have the password for root ( most likely on plesk servers ) you'll have to stop mysql and start it without privilege verification.

  1.  
  2. /etc/init.d/mysql stop # stop mysql
  3. /usr/sbin/mysqld --skip-grant-tables & # start without privilege verification
  4. mysql -u root # log into mysql using the mysql client
  5.  

That would work on most linux distros , on some the stop script would be /etc/init.d/mysqld and on others the path to the mysql server might be /usr/libexec/mysqld .
use psa

Once you're logged in run this sql to change the password:

  1.  
  2. USE psa;
  3. UPDATE accounts SET password=md5('newpasswordhere') WHERE id=1 ;
  4.  

Now get out of the mysql client ( CTRL+C) and restart mysql to have privilege verification back or else everyone would be able to do what you just did:

  1.  
  2. killall -9 mysqld
  3. /etc/init.d/mysql start
  4.  

Now you can login to plesk with the new password.