34
votes

Because this question was never answered, I was hoping someone could help me reset the password to connect to my neo4j password (at localhost:7474). Zachary wrote a post on solving this by someone restarting the service using:

sudo service neo4j-service restart

but I did not find this helpful. In the terminal, I ran bin/neo4j restart (which I think is the equivalent command), and was not able to reset my password.

5
In what way did you not find that helpful? What were you expecting? What actually happened? - GreenGiant
service is an unknown command. I think I did the equivalent (bin/neo4j restart) but it didn't help me reset password. - NumenorForLife
you can drop the file in $neo4j_directory/data/dbms/auth and restart the server - Christophe Willemsen
@ChristopheWillemsen Do you mean delete it? Will that erase the graph or will it simply reset the account info to neo4j/neo4j (for account name and password)? - NumenorForLife
no it will not touch your db, it will reset the password - Christophe Willemsen

5 Answers

69
votes

Depending on environment and installation type you need to look for a file named auth under directory dbms and remove it.

In MacOs, for dmg installations (adjust for custom locations):

/Users/xyz/Documents/Neo4j/default.graphdb/dbms/auth

or (homebrew install)

/usr/local/Cellar/neo4j/x.x.x/libexec/data/dbms/auth

Windows users should look for same file in the default.graphdb/dbms directory.

In Ubuntu

/var/lib/neo4j/data/dbms/auth

In docker containers

/var/lib/neo4j/data/dbms/auth

Alternatively, you might choose to disable auth in the configuration file, usually found in

MacOs:

/Users/xyz/Documents/Neo4j/.neo4j.conf

or

/usr/local/Cellar/neo4j/x.x.x/libexec/conf

and set this property to false

dbms.security.auth_enabled=false

After doing this, you need to restart the server for changes to make effect, you will be asked for a new password.

8
votes

In window machine, I deleted the auth file at following path :

Users\systemUser\Documents\Neo4j\default.graphdb\data\dbms and then I restarted the neo4j server.

Navigate to http://localhost:7474. It will ask you to enter the password for user neo4j. Enter default password (neo4j)

After this you will be navigated to change password screen. Change your password.

Note : for other operating systems auth file path may be different

4
votes

I am running version 4.0.7. Many answers I found on the internet state "Delete /data/dbms/auth". That does not work for 4.0.7, that file does not exist.

I followed these instructions, and they worked. https://neo4j.com/docs/operations-manual/current/configuration/password-and-user-recovery/

Mainly do this:

  1. Stop neo4j if its running

  2. edit /etc/neo4j/neo4j.conf, and uncomment dbms.security.auth_enabled=false

  3. connect to the database and run

    ALTER USER neo4j SET PASSWORD 'mynewpass'; :exit

  4. Stop neo4j

  5. comment out the dbms.security.auth_enabled=false

  6. start neo4j

2
votes

For the Mac, I had to remove ~/Documents/Neo4j/default.graphdb/data/dbms/auth

Then restart the server, and reset the password.

0
votes

In addition to deleting the auth file, sudo rm /data/dbms/auth, I also had to set up local port forwarding for the browser port 7474 and the bolt connector port 7687. This is due to the outbound firewall for browsers of the network I am using.