Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Databases and Redis

Redis answers NOAUTH Authentication required

ErrorNOAUTH Authentication required.

Short answer

NOAUTH means the Redis server needs a login and the connection did not send one. A password in redis.conf (requirepass) or a disabled default ACL user causes it. You may be talking to a different Redis than you think. Find out what the server enforces, then pass the password or user in the client's URL.

  • Applies to Redis 7, Redis 8, redis-cli
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Ask the server what it enforces. This works without logging in only if you pass the password, so try the config file first.

    redis-cli -h 127.0.0.1 -p 6379 ping
    sudo grep -E "^(requirepass|user |aclfile)" /etc/redis/redis.conf
  2. 2Match what you see, then jump to its fix

    1. 1The config grep shows a requirepass line, or ping fails with NOAUTH.requirepass is set, the client sends no passwordFix
    2. 2Your provider or admin gave you a username as well as a password.An ACL user is required (Redis 6 and later)Fix
    3. 3Your local Redis has no password, but the error appears from the app. The app's environment points at another host, or a password-protected container, instance or managed service.The app talks to a different Redis than the one you configuredFix

What does the error look like?

  • NOAUTH Authentication required.
  • (error) NOAUTH Authentication required.

Cause 1 of 3

requirepass is set, the client sends no password

1Check

With requirepass, Redis refuses every command until AUTH succeeds.

sudo grep -n requirepass /etc/redis/redis.conf

2Fix

Pass the password in the client. For redis-cli use -a or the REDISCLI_AUTH variable; in apps put it in the connection URL.

export REDISCLI_AUTH='your-password'
redis-cli ping
# app connection URL
REDIS_URL=redis://:your-password@127.0.0.1:6379/0

3Verify

Ping returns PONG.

redis-cli ping

Confirmed by redis.io

Did this fix it?

Cause 2 of 3

An ACL user is required (Redis 6 and later)

1Check

If the default user is off or has a password, new connections start unauthenticated. The two-argument form AUTH <username> <password> logs in as a named user.

redis-cli --user app_user --pass 'your-password' ACL WHOAMI

2Fix

Send both the username and password. In a URL that is redis://username:password@host:port.

REDIS_URL=redis://app_user:your-password@127.0.0.1:6379/0

3Verify

ACL WHOAMI prints the user name.

redis-cli --user app_user --pass 'your-password' ACL WHOAMI

Confirmed by redis.io

Did this fix it?

Cause 3 of 3

The app talks to a different Redis than the one you configured

1Check

Print the URL or host the app really uses, and compare with the instance you tested with redis-cli.

env | grep -i redis
redis-cli -u "$REDIS_URL" ping

2Fix

Use the password for that instance, or point the app at the unprotected local one for development.

REDIS_URL=redis://127.0.0.1:6379/0

3Verify

The same URL works in redis-cli and in the app.

redis-cli -u "$REDIS_URL" ping

Confirmed by redis.io

Did this fix it?

How do I stop it coming back?

  • Keep the Redis URL, with password, in one environment variable that the app and your tools both read.
  • Do not put the password on the command line in shared shells: use REDISCLI_AUTH.
  • Use a long password from ACL GENPASS.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Databases

node-redis throws ConnectionTimeoutError on connect

Redis Client Error ConnectionTimeoutError

node-redis raises ConnectionTimeoutError when the socket does not connect within socket.connectTimeout, which is 5000 ms by default.

3 causes, each with a fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.