CIFS-Share mounted in Ubuntu: Can't symlink - Can't chown ("Permission denied")

Forum for questions and support relating to the 1.29.x releases only.
Locked
janw
Posts: 9
Joined: Thu Mar 24, 2016 12:30 pm

CIFS-Share mounted in Ubuntu: Can't symlink - Can't chown ("Permission denied")

Post by janw »

Hi!

I am new to Zoneminder. Before I used Synology Surveillance Station, but with 3+ Foscams the NAS is being brought to it's limits.

So I created a Ubunto vm and now I want to store my ZM recordings on my Synology NAS (ds212+).

Mounted a CIFS-Share to my Ubuntu-Zoneminder-VM with the following fstab-entry:

Code: Select all

//192.168.2.101/sec/zm /media/zm cifs sec=ntlmv2,credentials=/home/user/.smbcredentials,iocharset=utf8,noperm,auto,dev,rw,exec,suid,async,_netdev,dir_mode=0777,file_mode=0777,uid=33,gid=33 0 0
www-data has uid 33 / gid 33.

ll /media/zm shows:

Code: Select all

drwxrwxrwx 5 www-data www-data    0 Mar 22 15:35 ./
drwxr-xr-x 4 root     root     4096 Mar 22 15:26 ../
drwxrwxrwx 5 www-data www-data    0 Mar 23 13:34 events/
drwxrwxrwx 2 www-data www-data    0 Mar 24 09:42 images/
drwxrwxrwx 2 www-data www-data    0 Mar 22 15:35 temp/
Mounted events and images dirs like so:

Code: Select all

/media/zm/images /var/cache/zoneminder/images none defaults,bind  0 2
/media/zm/events /var/cache/zoneminder/events none defaults,bind 0 2
I can mount and access the share just fine, however Zoneminder says: "Can't symlink events/5/16/03/23/.774 -> events/5/16/03/23/12/21/16: Permission denied". I have read, that to solve this, one has to change the owner of those folders to the apache user "www-data", however when I try to

Code: Select all

chown www-data:www-data /media/zm/events
on the Ubuntu system, I too get "Permission denied".

Also, this might help:

Code: Select all

user@[system]:~$ ps -ef | grep zoneminder
www-data  1699  1534  3 13:26 ?        00:00:21 /usr/lib/zoneminder/cgi-bin/nph-zms
www-data  1712  1514  2 13:26 ?        00:00:16 /usr/lib/zoneminder/cgi-bin/nph-zms
www-data  1713  1532  2 13:26 ?        00:00:16 /usr/lib/zoneminder/cgi-bin/nph-zms
user      2120  1696  0 13:37 pts/0    00:00:00 grep --color=auto zoneminder
Any help?

Thanks!
mikb
Posts: 602
Joined: Mon Mar 25, 2013 12:34 pm

Re: CIFS-Share mounted in Ubuntu: Can't symlink - Can't chown ("Permission denied")

Post by mikb »

Does your "CIFS-Share" (and underlying filesystem) understand advanced concepts such as symlinks?

What if you go into the CIFS share and do

Code: Select all

touch testfile
ln -s testfile linkyfile
If the first works, you have permission to make files. If the second fails, then sounds like links are not understood.

Have had this problem before with FAT filesystems/CIFS shares e.g. just tested it ...

Code: Select all

perkin (/mnt/nas02/Public) > touch a-file 
perkin (/mnt/nas02/Public) > ln -s a-file another-file
ln: failed to create symbolic link `another-file': Operation not supported
"Ownership" is a foggy concept too. Users and groups: Not well represented in FAT fs. I can chmod, but nothing actually changes :(
janw
Posts: 9
Joined: Thu Mar 24, 2016 12:30 pm

Re: CIFS-Share mounted in Ubuntu: Can't symlink - Can't chown ("Permission denied")

Post by janw »

Thanks for your reply, mikb!

With your help I could figure out the real problem did not lie within CIFS permissions. Instead it was the rather obvious option "Allow symbolic links within shared folders" in the CIFS settings on the NAS. It now works, thank you.

(Topic can be closed)
Locked