Cannot login to WordPress Account hosted on LightSail

0

I have been locked out of my WordPress admin portal which is set up on a AWS LightSail instance. When I enter the password given to me by sshing into the instance and using the admin portal for the domain linked to the instance it tells me the information is incorrect. When I try to reset the password through the terminal it does not fix anything and still gives all the same errors. I have tried everything I can find to regain access to the site to no avail. I also noticed that all of the drafted pages not meant to be published quite yet have all been published.

asked 10 months ago591 views
2 Answers
1

Were you able to log in before?
In that case, it may be possible to restore and use a snapshot of LightSail, if one is left.

It is also possible to change the password of a WordPress user directly by executing SQL statements, if it is possible to access the database used by WordPress.
However, work with databases can be dangerous and should be done with caution.
A sample SQL statement is provided below.

UPDATE wp_users SET user_pass = MD5('New Password') WHERE user_login = 'WordPress Admin User';
profile picture
EXPERT
answered 10 months ago
  • I have been able to login before, the instance has been running for over half a year with no issues and only recently and suddenly stopped allowing me to login. How would I go about running from a snapshot without completely messing up my website as I do not wish to cause any damage to the site.

  • It is possible to create a new LightSail from a snapshot using the method in this document. https://lightsail.aws.amazon.com/ls/docs/en_us/articles/lightsail-how-to-create-instance-from-snapshot
    By the way, just to confirm, is the WordPress database running inside LightSail? In that case, you can restore LightSail from the snapshot, but if you have a WordPress database outside of LightSail using RDS or other means, you will need to restore the RDS from the snapshot.

  • It appears I do not have any snapshots to recover from as I never took a manual one and the automatic was turned off. Is there a way to fix my login without restarting the entire instance or remaking it from a backup?

  • If we can't modify the password from the WordPress screen, the only way is to change the database directly.

1

Hello,

You can modify the WordPress password through an SSH session and the use of the WordPress CLI. The Lightsail console provides a web-ssh client you can open in 1-click.

Once in the instance, you need to execute the following command:

Command:

sudo wp user update user --user_pass=YourNewPasswordGoesHere --skip-email

Expected output:

Success: Updated user 1.

If you have other user(s) and want to change their password, you need to supply the correct name. In that case, please replace "UserName" and "YourNewPasswordGoesHere" with their respective values.

sudo wp user update UserName --user_pass=YourNewPasswordGoesHere --skip-email

The above would literally change the password for your default user, which is named user. The new password would be "YourNewPasswordGoesHere" so please replace that with your chosen new password.

I hope this resolves your issues. Please advise if you are still blocked. -Andy

AWS
MODERATOR
answered 10 months ago
  • If you have additional wordpress user issues you may be able to address them through the wp cli. The relevant "wp user" command is documented here: https://developer.wordpress.org/cli/commands/user/

  • When I run the command, switching out the "YourNewPasswordGoesHere" for a new password, it seems to just run indefinitely without ever actually updating the password.

  • I have not encountered an issue with WP CLI hanging before so I can't speak to that. Have you tried using the "wp user..." commands to do other actions? You may want to try creating an entirely new admin user and see if that works. If it does, you could then delete other user(s).

    If you omit user_pass it'll generate a strong password for you automatically.

    wp user create newName newEmail@example.com --role=administrator --user_pass=YourNewPassword

    Success: Created user 2.

    At that point I'd also check your user list and see if you have extras to delete.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions