Under the Merkle Trees

Insights on the Relentless Pursuit of Patterns in the World Around Me

changing passwords in neo4j v2.2.0

After setting up neo4j I loaded the remote access console at a url simmilar to this one:

https://42.42.42.42:4848/browser/

As expected, I was prompted to change my password upon logging in. I got pulled into something else and a few days later set out to establish a connection my neo4j instance via the REST api from a node.js app. The instructions from neo4j were pretty clear. However, whenever I tried connecting I kept getting this response:

401 { errors: [ { message: 'Invalid username or password.', code: 'Neo.ClientError.Security.AuthorizationFailed' } ] }

or, from /var/log/neo4j/console.log

2015-04-08 21:11:20.767+0000 INFO [API] Failed authentication attempt for 'neo4j' from 127.0.0.1

I messed with the base64 of my 'user:password' encoding on my node app thinking that was the issue. Nope. Next, I tried to login to the remote neo4j browser to see if the password was correct. There's the problem!

After diggin into the neo4j manual I couldn't find a single thing about how to reset a password if you aren't already logged in or if it isn't the first time you're loggin in. So, here's what I eventually ended up figuring out.

On Debain the password file can be found here:

sudo nano /var/lib/neo4j/data/dbms/auth

I jumped on my local machine and copied the hash for my neo4j install to the above file:

nano /Users/nopslip/Downloads/neo4j-community-2.2.0/data/dbms/auth

neo4j:SHA-256,DB424205465ADBEA3A26DA1A621165FC5F54FBE21E335D39D21F03AC8BA57B0D,2A81D42EAD1BBC427420AF431D8CF2D6:

*Don't copy and paste this hash though as it's not the default password of 'neo4j' (or my actual hash). Just grab the auth file from a fresh install and copy it over to reset to default neo4j password

Then on my server:
sudo service neo4j-service restart

I ended up having to apt-get uninstall neo4j then apt-get install neo4j to get it working but at that point my node app was happy and authenticated into the neo4j REST API.

200 { username: 'neo4j', password_change: 'http://0.0.0.0:7878/user/neo4j/password', password_change_required: false }

I'm sure there is a better way to reset your neo4j passwords but figured i'd post this in the event that anyone ends up stuck like I was.

Comments

comments powered by Disqus

About the author

Zachary Wolff

http://zacharywolff.com