this seems simple enough but I've search all over and I can't seem to be able to create server admin users in CouchDB. I can create regular users, but can't figure out how to create one from a script. Can someone demonstrate doing this with curl?
Just to clarify, by server admin user I mean a user who's info is store in the local.ini. In Futon you can login as an admin, click setup more admins, and then create them, but I can't figure out how to replicate this functionality. I've even stepped through what's happening in the jquery couch plugin when I create a new admin in Futon but I can't see what I'm doing wrong. All of the users I add via script just get put in _users table but not in the local.ini. Thanks!
According to the documentation, you can create a new admin via the REST API by working with the _config
endpoint.
By issuing a PUT
request against /_config/admins/:username
(where the request body is the password) a new admin will be created. (provided you have access to do so)
Futon is just using $.couch.config({...ajax options...}, "admins", username, password);
to accomplish this.
As per http://guide.couchdb.org/draft/security.html, you can use something like:
$ curl -X PUT localhost:5984/_config/admins/myusername -d '"mypassword"'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With