93

I am using redis and trying to open CLI of redis using this:

$redis-cli -h 127.0.0.1 -p 6379 -a mysupersecretpassword

and getting and error :

(error) NOAUTH Authentication required

why so ?

keshaw
  • 1,215
  • 2
  • 10
  • 13
  • Are you using the correct password? What is your Redis and redis-cli versions? And I am I correct in assuming that the error is provided only after you actually try to type a command at the cli's prompt? – Itamar Haber Mar 02 '16 at 11:44
  • if I use $redis-cli -h 127.0.0.1 -p 6379 then if authenticate its working. And my redis version is 3.0.3 – keshaw Mar 02 '16 at 11:46
  • Is it possible that your super secret password is parsed by the shell, i.e. contains magic characters? – Itamar Haber Mar 02 '16 at 12:34

5 Answers5

95

My solution is put the password in single quotes like:

$redis-cli -h 127.0.0.1 -p 6379 -a 'thisizmy!PASS' 
Stephen Rauch
  • 47,830
  • 31
  • 106
  • 135
Vincente
  • 967
  • 1
  • 6
  • 5
23

If you have a '$' in your password then it won't work. So set the password without the "$".

Willi Mentzel
  • 27,862
  • 20
  • 113
  • 121
Keshaw_pathak
  • 604
  • 1
  • 6
  • 11
17

If you have '$' in your password, make sure to enclose the password with single quotes. Then it will work.

Shankar
  • 2,625
  • 3
  • 25
  • 49
3

Maybe this would usefull to someone. If you have already open the redis-cli console window, you can type the authentication like this:

auth 'your-password'

and then the console would response with OK

Dedy Chaidir
  • 767
  • 6
  • 15
0

If you're using Redis Access Control List - ACL (Redis 6 and above), you log in with --user and --pass:

redis-cli -h 127.0.0.1 -p 6379 --user redis_user --pass 'redis_password'

or if you are already in redis-cli console you can authenticate with:

auth redis_user 'redis_password'

duckoak
  • 40
  • 5