Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MongoDB - Permission denied for socket: /tmp/mongodb-27017.sock

I had an unclean shutdown of MongoDB on Ubuntu 10.04 LTS. Now when I login as root and run Mongodb via service mongodb start, I get below error-

Mon Dec 12 13:53:15 [initandlisten] ERROR: listen(): bind() failed errno:13 Permission denied for socket: /tmp/mongodb-27017.sock

When I run MongoDB manually via root, it works just fine.

I can confirm that there is no /tmp/mongodb-27017.sock file

root@devbox:~# ll /tmp/
total 16
drwxr-xr-x  4 root root 4096 2011-12-12 13:53 ./
drwxr-xr-x 25 root root 4096 2011-12-11 13:06 ../
drwxrwxrwt  2 root root 4096 2011-12-12 13:01 .ICE-unix/
drwxrwxrwt  2 root root 4096 2011-12-12 13:01 .X11-unix/

Where do I begin troubleshooting?

like image 998
user837208 Avatar asked Dec 12 '11 18:12

user837208


3 Answers

Try changing owner like this,

sudo chown mongodb:mongodb /tmp/mongodb-27017.sock
like image 194
Adil Abbasi Avatar answered Nov 01 '22 03:11

Adil Abbasi


What's are the file permissions on /tmp? Is it possible that they've been changed?

A

# ls -ld /tmp

will tell you.

If you're unsure try:

# chown root:root /tmp
# chmod 1777 /tmp

That might fix it.

like image 33
Dr Joe Avatar answered Nov 01 '22 05:11

Dr Joe


we use mac and install mongodb, usually do not need mongodb.conf, so, try this:

sudo chown -R your-username /tmp/

ps:your-username is your username in mac os, not root.if you don't know what is your username,there's a command:

whoami
like image 3
dream-blue Avatar answered Nov 01 '22 04:11

dream-blue