Linux – Allow Write Access for Regular User on CIFS Share

cifslinuxpermissionssmb

I want to mount one of my media folders of my Synology DiskStation (DS414J, DSM 6.2) on my laptop (Manjaro running on Kernel 4.17.18) via SMB/CIFS. I set up a DiskStation user called media that has read/write access to this specific folder. I mount the folder with the following /etc/fstab entry:

//{disk station IP}/{folder}/ /home/{user}/NAS/{folder} cifs auto,x-systemd.automount,cache=none,rsize=130048,wsize=57344,users,user=media,pass={the password},workgroup=WORKGROUP,ip={disk station IP} 0 0

Mounting and read access works (I can access the files and e.g. play them with VLC) with the regular user. However, when I try to perform any write operations, I get "Permission denied" error.

Output of ls -la on the share shows following:

drwxr-xr-x 2 root root    0 01. Jan 2018   .
drwxr-xr-x 2 root root    0 01. Jan 2018   ..
-rwxr-xr-x 1 root root 5,8M 01. Jan 2018  '01.file'
-rwxr-xr-x 1 root root 3,7M 01. Jan 2018  '02.file'
-rwxr-xr-x 1 root root 3,2M 01. Jan 2018  '03.file'

How do I configure my laptop to allow my regular user to have read/write access to the share?

Best Answer

Your share has world-read access, hence anyone who can access the mount point can read the contents. When your system mounts the share, it maps the share owner (which has r/w access) to root, hence your regular user can't perform any write operations.

You can change this mapping to set your regular user as the owner and group of the share by using uid= and gid= mount options. This should allow write access.

Related Question