Local install lost password

I’ve came across this.

require('/path/to/ghost/core/server/lib/security/password')
  .hash(process.argv[2])
  .then(console.log);

I’m trying to replace core/server/lib/security/password

I’m not seeing core/server/lib/security/password?

Where is this file?
I have DB Browser for SQLite running locally.
I’ve bcrypted a new password and I’ve updated it. But it does not work.

There is an unknown error.

Is there a local log?

The unknown error is not very helpful.
For example in frameworks like Rails, you get a print out of log data that you can use to debug locally.
Is there any similar available in ghost cli?

Is there ANY tooling available locally to help? A ghost console to add new Users, Posts etc… Or some kind of log tailing ability?

1 Like

Hey @stoplion! :wave:

That file was extracted to the @tryghost/security package, as you can see here: Utils/password.js at main · TryGhost/Utils · GitHub :slightly_smiling_face:

1 Like

We also have logging built into Ghost, and the Ghost-CLI docs for it are here: https://ghost.org/docs/api/v3/ghost-cli/log/

Mostly posting for myself to remember :joy: Thanks a lot for all the help here and in the previous topic.

  1. Copy this to a local file e.g. password.js
    Utils/password.js at main · TryGhost/Utils · GitHub

  2. Install npm requirements

npm install bluebird
npm install bcrypt
  1. Make make-password.js in the same directory as password.js
require('password')
  .hash(process.argv[2])
  .then(console.log);
  1. Generate password hash
node make-password.js "<your-new-password>"

On ghost:
From command line:

  1. Log into mysql
mysql -u root -p

To see password hash:

SELECT * FROM users;
  1. Update password hash
UPDATE users
  SET
    password = 'NEW_PASSWORD_HASH'
  WHERE id = 1;