ghost: db password reset (sqlite setup)

ghost: db password reset (sqlite setup)

ghost: db password reset (sqlite setup)
Photo by benjamin lehman / Unsplash

In this instance we are running the ghost:alpine and have lost our login.

First we need to look inside the running container:

docker exec -it ghost /bin/bash

After some hunting around we find that the file - ghost-dev.db inside /var/lib/ghost/versions/5.14.2/content/data is the sqlite single file database.

sudo docker cp ghost:/var/lib/ghost/versions/5.14.2/content/data/ghost-dev.db ghost-dev.db

Using a local sqlite browser from here we can then activate a docker viewer to inspect it:

docker pull linuxserver/sqlitebrowser

It's default port is 3000, so we run it and it presents a complete sql-lite browser unsecured!

sudo docker run --name sqliteviewer -p 3000:3000 linuxserver/sqlitebrowser
learn.thinkmelt.com:3000 (unsecured)

Since it's running inside it's own container and does not seem to present a upload option (it's really for local operations only) we will copy the ghost-dev.db back inside the sqlite-browser:

sudo docker cp ghost-dev.db sqlitebrowser:/ghost-dev.db

We can see now that ghost-dev.db is now visible from inside the sqlitebrowser container.

Inside the users table will be the bcrypt hash of your password, you can generate a new one at any bcrypt hash generator and then paste the value inside it, save the file.

After that you will need to copy the file back across the containers, and restart it.

Linux Rocks Every Day