web analytics

Monthly Archives May 2014

Fatal error: Uncaught exception ‘MongoCursorException’ with message ‘localhost:27017: not authorized for query on admin.system.namespaces’ – Moadmin error after enabling authentication in mongodb

If you enabled authentication for mongodb, then moadmin will fail to show the databases. This is because moadmin is  not authenticated to list the databases. You might get the following error.

Fatal error: Uncaught exception ‘MongoCursorException’ with message ‘localhost:27017: not authorized for query on admin.system.namespaces’

I am considering a scenario where I enabled authentication as said in the link here. In that case open your moadmin.php file and make the following change, so that it authenticates itself.

You need to edit MONGO_CONNECTION parameter.

root@abc:~# vi /home/abc/public_html/moadmin.php

#define(‘MONGO_CONNECTION’, ”);        // Comment out the old connection parameter
define(‘MONGO_CONNECTION’, ‘mongodb://admin:admin@127.0.0...

Read More

Authentication in mongodb

Mysql databases allow username and password. Similarly if you require to keep authentication for your mongodb database as well, please do the following. Suppose, I have a database named abc, and I need to create a user named abc with password abc123.

First, create an admin user.

root@abc:~# mongo
MongoDB shell version: 2.4.10
connecting to: test
> use admin
> db.addUser("admin", "admin")

> use abc                   (Switch to the database abc)

> db.addUser("abc", "abc123")

Quit the mongoshell and stop mongo

root@abc:~# /etc/init.d/mongodb stop

root@abc:~# vi /etc/mongodb.conf    and make the following change

auth = true

root@abc:~#/etc/init.d/mongodb start

Now we need to test if authentication works...

Read More

Accessing Gmail with Roundcube

Requirement : I want to access my gmail under my own domain with the help of webmail.

Say my domain name is abc.com , I want to access it as http://abc.com/mail

Suppose I am on a cpanel server. Download and install Roundcube as follows.

root@me [/home/abc/public_html]# wget http://downloads.sourceforge.net/project/roundcubemail/roundcubemail/1.0.0/roundcubemail-1.0.0.tar.gz

root@me [/home/abc/public_html]# tar -xzvf roundcubemail-1.0.0.tar.gz

root@me [/home/abc/public_html]# mv roundcubemail-1.0.0 mail

root@me [/home/abc/public_html]# chown -R abc:abc mail

root@me [/home/abc/public_html]# cd mail

Now login to your cpanel and create a database for roundcube installation, create a database user and assign privileges. This can all be done from cpanel.

Once done, go to the installer link as ...

Read More

Migrating emails from mailenable to exim

I wanted to transfer my entire sites from my Windows Plesk server to Linux Cpanel server. I could simply create the new accounts in the new server and copy the files. The main issue was with emails. My windows server was using mail enable, where as the the cpanel server uses exim.

I realized I will have to create all email accounts manually in the new server. A simple tool which will do everything in a click was not available. Losing email was not something I could let happen, so I decided to go ahead with creating accounts and then copying emails. I used imapcopy for it. If anybody wants to do it, you can do it as follows. I am copying the email account test@abc.com to new server. Its password is test123c on both servers.

root@abc [~]# cd /usr/local/src/

root@abc [/usr/local/src]#  wget ...

Read More