I found a special case that causes symlinks to appear to fail:
I did a standard enterprise install of mongodb but changed the /var/lib/mongodb to a symlink as I wanted to use an XFS filesystem for my database folder and a third filesystem for the log folder.
$sudo systemctl start mongod (fails with a message no permission to write to mongodb.log).. but it succceded if I started with the same configuration file:
.. as the owner of the external drives (ziggy) I was able to start
$mongod --config /etc/mongodb.conf --fork
I eventually discovered that .. the symlinks pointed to a different filesystem and the mongodb (user) did not have permission to browse the folder that the symlink referred. Both the symlinks and the folders the symlinks referred had expansive rights to the mongod user so it made no sense?
/var/log/mongodb was changed (from the std ent install) to a symlink AND I had checked before:
$ ll /var/log/mongodb
lrwxrwxrwx 1 mongodb mongodb 38 Oct 28 21:58 /var/log/mongodb -> /media/ziggy/XFS_DB/mongodb/log/
$ ll -d /media/ziggy/Ext4DataBase/mongodb/log
drwxrwxrwx 2 mongodb mongodb 4096 Nov 1 12:05 /media/ashley/XFS_DB/mongodb/log/
.. But so it seemed to make no sense.. of course user mongodb had rwx access to the link, the folder and to the file mongodb.log .. but it couldnt find it via the symlink because the BASE folder of the media couldnt be searched by mongodb.
SO.. I EVENTUALLY DID THIS:
$ ll /media/ziggy/
.
.
drwx------ 5 ziggy ziggy 4096 Oct 28 21:49 XFS_DB/
and found the offending missing x permissions..
$chmod a+x /media/ziggy/XFS_DB solved the problem
Seems stupid in hindsight but no searches turned up anything useful.
sudo chmod o+rx /media
for example if your mount point ismedia
. The r+x needs to be available for the 'other' groups and users from the first mount point. – Masterson