I'm trying to do a daily backup of my mongodb server (auth enabled) using the mongodump tool.
mongodump provides two parameters to set the credentials:
-u [ --username ] arg username
-p [ --password ] arg password
Unfortunately they don't provide any parameter to read the password from stdin. Therefore everytime I run this command, everyone on the server can read the password (e.g. by using ps aux).
The only workaround I have found is stopping the database and directly accessing the database files using the –dbpath parameter.
Is there any other solution which allows me to backup the mongodb database without stopping the server and without "publishing" my password?
I am using Debian squeeze 6.0.5 amd64 with mongodb 1.4.4-3.
Best Answer
Actually, since this request was implemented, the password on the command line is obscured (though there is a caveat about a short window before the obscuring code kicks in). Have you tried specifying an empty string as the password (
-p ""
), you should then be prompted for a password, which I think is the behavior you are looking for.