mongo shell 3.4.2 works differently on windows and linux

213 views
Skip to first unread message

Rajinder Singh

unread,
Mar 7, 2017, 2:38:50 PM3/7/17
to mongodb-user
We have mongo community edition installed in Azure.
It is running on centos 7.3
Our server version is 3.4.2
It is a sharded environment with 2 routers.

Due to firewall restrictions we had to put load balancer in front of routers.
We are using internal load balancer.
Load balancer takes in requests over port 80 and maps them to router port 27017

On Ubuntu 16.04 VM we installed mongo shell 3.4.2
we use the command

mongo -u mymongoadmin -p xxxxxxxx --host LOADBALANCERIP --port 80 admin


We can connect successfully.


mongo --version

MongoDB shell version v3.4.2

git version: 3f76e40c105fc223b3e5aac3e20dcd026b83b38b

OpenSSL version: OpenSSL 1.0.2g  1 Mar 2016

allocator: tcmalloc

modules: none

build environment:

    distmod: ubuntu1604

    distarch: x86_64

    target_arch: x86_64



Windows have a windows 10 VM

It also has mongo shell 3.4.2 installed on it.


mongo --version returns


MongoDB shell version v3.4.2

git version: 3f76e40c105fc223b3e5aac3e20dcd026b83b38b

OpenSSL version: OpenSSL 1.0.1u-fips  22 Sep 2016

allocator: tcmalloc

modules: none

build environment:

    distmod: 2008plus-ssl

    distarch: x86_64

    target_arch: x86_64




mongo -u mymongoadmin -p xxxxxxxx --host LOADBALANCERIP --port 80 admin

MongoDB shell version v3.4.2

connecting to: mongodb://load_balancer_ip:80/admin

MongoDB server version: 3.4.2

2017-03-07T13:33:08.986-0600 E QUERY    [thread1] Error: Authentication failed. :

DB.prototype._authOrThrow@src/mongo/shell/db.js:1459:20

@(auth):6:1

@(auth):1:2

exception: login failed




I was wondering if anyone has run into this issue and if there is a fix for it.


Line 1459 where it fails is shown here:

if (params.mechanism == "GSSAPI" && params.serviceName == null &&
this._defaultGssapiServiceName != null) {
params.serviceName = this._defaultGssapiServiceName;
}

Rajinder Singh

unread,
Mar 8, 2017, 1:53:51 PM3/8/17
to mongodb-user
The problem was that we had a $ in the password for admin user.
mongo shell on Linux can handle $ in the password.

mongo shell on Windows cannot login if there is a $ in the password. I tried 'password$'  but single quotes don't help.

sharing this here in case somebody else has a similar issue.

Rhys Campbell

unread,
Mar 9, 2017, 3:15:29 AM3/9/17
to mongodb-user
Are you using the Powershell terminal? If so try escaping the dollar with a back-tick... `


It's probably a different character in the MSDOS shell. It's been a while so I forget which.
Reply all
Reply to author
Forward
0 new messages