Moein Hosseini
Moein Hosseini

Reputation: 4383

Can I set username and password on memcached like mysql?

I installed memcached and php-memcached on my ubuntu, I can connect to it by localhost on 11211 port. I can store data in it,but I wanna set username and password on it like when I connect to database. is it possible?how?

Upvotes: 2

Views: 13452

Answers (2)

Optimus Prime
Optimus Prime

Reputation: 6907

sasl_pwdb for more simple auth deployments

--enable-sasl-pwdb allows memcached to use it's own password file and verify a plaintext password. The file is specified with the environment variable MEMCACHED_SASL_PWDB, and is a plain text file with the following syntax:

username:password

Please note that you have to specify mech_list: plain in your sasl config file for this to work. Ex:

 echo "mech_list: plain" > memcached.conf
 echo "myname:mypass" > /tmp/memcached-sasl-db
 export MEMCACHED_SASL_PWDB=/tmp/memcached-sasl-db
 export SASL_CONF_PATH=`pwd`/memcached.conf
./memcached -S -v

and you should be able to use your favorite memcached client with sasl support to connect to the server. (Please note that not all SASL implementations support SASL_CB_GETCONF, so you may have to install the sasl config (memcached.conf) to the systemwide location)

Upvotes: 8

Amber
Amber

Reputation: 526813

Yes, via SASL: http://code.google.com/p/memcached/wiki/SASLAuthProtocol

Upvotes: 0

Related Questions