Jonathan Mugan
Jonathan Mugan

Reputation: 662

Neo4j: Can't log in: Neo.ClientError.Security.Unauthorized: The client is unauthorized due to authentication failure

When I do :server connect with neo4j and neo4j I get Neo.ClientError.Security.Unauthorized: The client is unauthorized due to authentication failure..

I tried uncommenting the line dbms.security.auth_enabled=false in /etc/neo4j/neo4j.conf and restarting, but it still asks me to log in and still denies the login.

I can get in with /usr/bin/cypher-shell -u neo4j -p neo4j

I tried /usr/bin/neo4j-admin set-initial-password secret but it says command failed: The specified user 'neo4j' already exists.

I tried sudo rm /var/lib/neo4j/data/dbms/auth and restarting, but it gives the same result.

ubuntu 16.04

Installed with sudo apt-get install neo4j=1:3.5.0

Upvotes: 9

Views: 27906

Answers (5)

DaleD
DaleD

Reputation: 111

You may see this issue after upgrading neo4j from version 4 to version 5, if you use the set-initial-password option.

The version 4 syntax is:

neo4j-admin set-initial-password secret

The version 5 syntax is:

neo4j-admin dbms set-initial-password secret

If the command does not run successfully, the admin user will not be able to authenticate.

Upvotes: 0

ddaanniirroo
ddaanniirroo

Reputation: 1

I had the same issue for a long time and was able to fix it by setting a new password using the method described here.

Upvotes: 0

np10
np10

Reputation: 139

I faced the issue with the initial setup. Kept getting the same unauthorised message. The issue with me was I was trying to access it in firefox. Tried in Chrome and it worked and prompted me to change my password. Found one issue stating this: < connecting to Neo4j browser through Firefox >

Upvotes: 1

mabi.t
mabi.t

Reputation: 37

I disabled/uncomment authenitication in /etc/neo4j/neo4j.conf

To disable authentication, uncomment this line

dbms.security.auth_enabled=false

it worked for me.

Make sure to comment it back when you are done for security purposes

Upvotes: 2

Allen
Allen

Reputation: 2867

I had the same problem. I tried to set the initial password and it said The specified user 'neo4j' already exists. I had thought I had set the initial password earlier via the command line, but it didn't take because there were special characters in the password string.

What ended up working for me was opening up the Neo4j Browser and it prompted me for a password. I entered 'neo4j' and then it gave me the option to set a new password through the browser. Once I did that, it worked.

If you need to turn off auth_enabled to test something, make sure to remember to restart the server. sudo neo4j restart It can also take a few minutes to restart, so make sure it's fully up and running first. (And then, of course, don't forget to turn auth_enabled back on again.)

It also took me a few tries to get the configuration correct in the conf file at /etc/neo4j/neo4j.conf

I set dbms.connectors.default_listen_address=0.0.0.0

And dbms.connectors.default_advertised_address=your.webdomain.com

Also, this guide helped me with setting up a certificate for the neo4j browser endpoint. https://medium.com/neo4j/getting-certificates-for-neo4j-with-letsencrypt-a8d05c415bbd

Upvotes: 4

Related Questions