Unlock Your Locked Ghost Account

2 minute read

I setup Ghost a little over a week ago, thinking my first post would be about the setup. Tonight, tired but not wanting to go to bed, I decided to work on the “How to setup Ghost” blog post. Foolishly, I had forgotten my password, having only really logged in once. After five attempts at logging in I am locked out. And of course I did not setup the email functionality, so there is no hope in resetting that way.

So here I am, locked out of my new blog, wanting to blog. If you have found yourself in a similar situation then you can follow theses steps to unlock your account so you can enter the correct password after drinking some coffee. (If you don’t remember your password, coffee or not, this likely won’t help you much.)

First we will need to install sqlite3, in case you don’t already have it (I didn’t):

$ sudo apt-get install sqlite3

You will then want to navigate to your installation directory, typical locations include /var/www/ghost/, from there you want ./content/data, so let’s go there:

$ cd /var/www/ghost/content/data/

Here you’ll find ghost.db and README.md. We are going to be changing some values in the database with sqlite3. (Surprise, surprise.) Let’s fire up the database, making sure to login as root (with sudo), else we’ll be unable to change anything, as it’ll be readonly:

$ sudo sqlite3 ghost.db

We then can check our users and see that we really are locked out:

sqlite> select * from users;

This will display a single long line, likely with a value of "locked" somewhere in it. That is what we’ve come here to change. We want to set it to the value "active", to do so run:

sqlite> update users set status = "active";

We can check that we were successful with another:

sqlite> select * from users;

After confirmation, exit sqlite3 with:

sqlite> .exit

Now, navigate back your sign in page, take another sip of that coffee, and enter your password correctly this time. Now that you’ve hopefully logged in, it’s time to actually setup that mailing functionality! (Or if you’re anything like me, not worry about it, since you now know how to unlock yourself in the event of further stupidity lack of coffee…)

EDIT (2014-05-23): I have since added email functionality using MailGun. I’d write up how it’s done, but it’s already thouroughly documented in the Ghost documentation, you can find it here.

Tags:

Updated:

Leave a Comment