The most likely reason for this was that the mongod process was at some point started by the root user. Therefore, the socket file (/tmp/mongodb-27017.sock) belonged to the root user. The mongod process usually runs under its own dedicated user, and this user did not have permission to delete this file.
The solution, as you already found out, was to remove it. Then mongodb was able to recreate it with the correct permissions. This should be preserved after a reboot if mongodb is started using initialization scripts or under the correct user account.
SpooForBrains Feb 22 '16 at 16:21 2016-02-22 16:21
source share