Version-Release number of selected component (if applicable): openshift v3.0.2.901-61-g568adb6 kubernetes v1.1.0-alpha.1-653-g86b4e77 rhscl/mongodb-26-rhel7 fead03cf7fc4 Description of problem: when login in mongodb26 in container, appears error "open for '//.mongorc.js' failed with errno:13 Permission denied" How reproducible: Always Steps to Reproduce: 1.Run the mongodb-26-centos7 image $ mkdir -p /home/user/database && chown -R 234523:998 /home/user/database $ docker run -d -u 234523 -e MONGODB_USER=user -e MONGODB_PASSWORD=pass -e MONGODB_DATABASE=test_db -e MONGODB_ADMIN_PASSWORD=pass -v /home/user/database:/var/lib/mongodb/data:Z registry.access.redhat.com/rhscl/mongodb-26-rhel7 2.Access into container $docker ps | grep mongo (to get the container id) $docker inspect <container_id> | grep IPAddress $docker exec -ti <container_id> scl enable rh-mongodb26 /bin/bash 3. Create SQL queries in container bash-4.2$ mongo test_db -u user -p pass MongoDB shell version: 2.6.9 connecting to: test_db Welcome to the MongoDB shell. For interactive help, type "help". For more comprehensive documentation, see http://docs.mongodb.org/ Questions? Try the support group http://groups.google.com/group/mongodb-user 2015-10-21T05:43:32.119-0400 In File::open(), ::open for '//.mongorc.js' failed with errno:13 Permission denied > show collections; > doc={"a":"test1"}; { "a" : "test1" } Actual results: when Login in mongodb26 in container, appear errors Expected results: login in successfully ,no errors
reproduced in ose openshift v3.0.2.902 kubernetes v1.2.0-alpha.1-1107-g4c8e6f4 rhscl/mongodb-26-rhel7 fead03cf7fc4 [root@openshift-154 ~]# docker run -d -u 234523 -e MONGODB_USER=user -e MONGODB_PASSWORD=pass -e MONGODB_DATABASE=test_db -e MONGODB_ADMIN_PASSWORD=pass -v /home/user/database:/var/lib/mongodb/data:Z registry.access.redhat.com/rhscl/mongodb-26-rhel7 de8b2f8760aebb25796f7049df2761b123629c361b26e4851b8ca44eaeed89ef [root@openshift-154 ~]# docker exec -ti de8b2f8760aebb25796f7049df2761b123629c361b26e4851b8ca44eaeed89ef scl enable rh-mongodb26 /bin/bash bash-4.2$ mongo test_db -u user -p pass MongoDB shell version: 2.6.9 connecting to: test_db Welcome to the MongoDB shell. For interactive help, type "help". For more comprehensive documentation, see http://docs.mongodb.org/ Questions? Try the support group http://groups.google.com/group/mongodb-user 2015-10-22T03:41:11.714-0400 In File::open(), ::open for '//.mongorc.js' failed with errno:13 Permission denied > exit
sounds like the SCL team needs to update the published image. Honza can you make sure that happens and this bug gets moved to ON_QA once it does?
Yes, we will take care about that. Do I understand correctly that this is already fixed in github?
that's my impression since the image ci.dev.openshift.redhat.com:5000/rhscl/mongodb-26-rhel7 works and that's built from github.
*** Bug 1276259 has been marked as a duplicate of this bug. ***
verified in openshift v3.0.2.905 kubernetes v1.2.0-alpha.1-1107-g4c8e6f4 rhscl/mongodb-26-rhel7 c2edfb2c2498 [root@dhcp-128-91 templates]# oc rsh mongodb-1-q5ehd bash-4.2$ oc bash: oc: command not found bash-4.2$ bash-4.2$ mongo sampledb -u userY8K -paHctmTGt5mMOMoef MongoDB shell version: 2.6.9 connecting to: sampledb > show collections; > doc={"a":"test1"}; { "a" : "test1" } I have a question ,when I type "show dbs", the result as follow is correct? because user:userY8K has no permission ? > > show dbs; 2015-11-04T02:21:17.642-0500 listDatabases failed:{ "ok" : 0, "errmsg" : "not authorized on admin to execute command { listDatabases: 1.0 }", "code" : 13 } at src/mongo/shell/mongo.js:47
and verified in rhscl/mongodb-26-rhel7 c2edfb2c2498 root@openshift-127 ~]# mkdir -p /home/user/database && chown -R 234523:998 /home/user/database [root@openshift-127 ~]# docker run -d -u 234523 -e MONGODB_USER=user -e MONGODB_PASSWORD=pass -e MONGODB_DATABASE=test_db -e MONGODB_ADMIN_PASSWORD=pass -v /home/user/database:/var/lib/mongodb/data:Z registry.access.redhat.com/rhscl/mongodb-26-rhel7 9868bd8e38054fd352dfe50bc3da080a538de308b23d486ea1228d741a8025ce [root@openshift-127 ~]# docker exec -ti 9868bd8e3805 scl enable rh-mongodb26 /bin/bash bash-4.2$ mongo test_db -u user -p pass MongoDB shell version: 2.6.9 connecting to: test_db Welcome to the MongoDB shell. For interactive help, type "help". For more comprehensive documentation, see http://docs.mongodb.org/ Questions? Try the support group http://groups.google.com/group/mongodb-user > show collections; > doc={"a":"test1"}; { "a" : "test1" } >
(In reply to wewang from comment #9) > > I have a question ,when I type "show dbs", the result as follow is correct? > because user:userY8K has no permission ? > > > > show dbs; > 2015-11-04T02:21:17.642-0500 listDatabases failed:{ > "ok" : 0, > "errmsg" : "not authorized on admin to execute command { listDatabases: 1.0 > }", > "code" : 13 > } at src/mongo/shell/mongo.js:47 Yes, this is correct. MONGODB_USER have only permissions regarding MONGODB_DATABASE, so he doesn't have permission to show all database (stored in admin database). "The listDatabases must run against the admin database" (https://docs.mongodb.org/manual/reference/command/listDatabases/), so MONGODB_USER can't run it.
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://rhn.redhat.com/errata/RHBA-2015-2056.html