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"'
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top