Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to add documents into DB with user - "You are not a server admin"

Tags:

couchdb

I'm having issues with the users I've created being able to actually submit anything into the DB I've listed them under. I've followed the steps listed here (Creating regular users in CouchDB) and reviewed countless pages of documentation trying to sort this out. (Ex: http://wiki.apache.org/couchdb/Security_Features_Overview).

I'm using v1.5 and trying to set the user "testAdmin" as the admin for the "test" DB. superadmin, in this is my admin account created through the futon interface.

If I check the security document I can see my permissions there that should allow the testAdmin user to access the DB:

curl -X GET http://superadmin:1234@localhost:5984/test/_security

response:

   { 
      "admins": 
         { "names":["testAdmin"],
           "roles":[]
         },
      "readers":
         { "names":["testUser"],
           "roles":[]
         }
    }

Then if I run this, I get "You are not a server admin."

curl -X PUT http://testAdmin:5678@localhost:5984/test/ -d '{"abc": "def"}'

response:

{"error":"unauthorized","reason":"You are not a server admin."}

I've tried switching the user to a reader, I've also tried using the other user I've created that's currently listed as reader, and I keep encountering the same error.

Edit: I'm able to log in to Futon with the users I've created just fine, and their permissions all appear to be working fine within Futon, but I'm still unable to use curl successfully.

like image 795
user3488253 Avatar asked Apr 02 '14 08:04

user3488253


3 Answers

You're trying to create a database instead of creating a document. If you want to create document without predefined ID - use POST request instead.

like image 142
Kxepal Avatar answered Nov 04 '22 18:11

Kxepal


Using

curl

curl -u USER:PASS -X PUT "http://host:port/db_target" -d '{...}'

This may have been the resolution to the initial question.

like image 5
aphorise Avatar answered Nov 04 '22 18:11

aphorise


It's worth adding that Fauxton often "forgets" its authentication if you leave it open and doesn't realize it, failing in odd ways until you reload the page and it realizes you need to log in again.

Short story shorter I was having a similar problem and just needed to re-authenticate to resolve it.

like image 5
devios1 Avatar answered Nov 04 '22 19:11

devios1