Ghost blog by default uses the sqlite database. After installing the Ghost blog on Ubuntu , I forgot the password of user. Because of unsuccessful trial more than a limit, my user also get deactivated.
We have setup the self hosted ghost blog , hence it is quite easy to reset the password and activate the user from sqlite database.
Note: We recommend you to configure the mail settings because forgotten password you will receive in your registered mail account.
Install sqlite to access the database
Install sqlite on your system.
On Debian/Ubuntu system :
sudo apt-get install sqlite3
On CentOS/RHEL :
yum install sqlite
How to reset forgotten password of ghost blog user from sqlite
The ghost blog use the bcrypt to save the users password in sqlite database.
Generate bcrypt password
I am using online bcrypt generator. You can search in google/duckduckgo , will find many online generator.
http://bcrypthashgenerator.apphb.com/
I generated ‘password123’ its bcrypt formate is $2a$10$UvclXkN3qwFqEj7nT2uGBedStIdt4rshca5JSzsj9bygk3U/IA7F6
Resetting ghost blog user password
Go to GHOST_DIR/content/data
directory. Here, GHOST_DIR should replaced with absolute path where you have installed ghost.
Run the below given command from the directory GHOST_DIR/content/data
## On Debian/ Ubuntu sqlite3 ghost.db ## On RHEL/CentOS sqlite ghost.db
Use below given syntax, to reset ghost blog user password
UPDATE users SET password='' WHERE email = ' ';
For example, we have set our ghots blog user like this.
UPDATE users SET password='$2a$10$UvclXkN3qwFqEj7nT2uGBedStIdt4rshca5JSzsj9bygk3U/IA7F6' WHERE email = 'admin@sharadchhetri.com';
To exit from sqlite type –
.exit
How to activate / Unlock ghost user
Because of unsuccessful trial of wrong password while signing into ghost blog. Your user account will be deactivated or get locked.
To solve this issue, go to GHOST_DIR/content/data
directory. And run follow below given command.
## On Debian/ Ubuntu sqlite3 ghost.db ## On RHEL/CentOS sqlite ghost.db
Now update the database –
UPDATE users SET status='active' WHERE email = '';
For example, you can see below given command from our ghost server :
UPDATE users SET status='active' WHERE email = 'admin@sharadchhetri.com';
Now exit from sqlite database.
.exit
my database is mysql, how to reset password?