I'm trying to set up a debian server that will run several network-based services. These services need access to an external network drive to store their data. For security reasons, I have set up each service to run under it's own user. To allow them all to access the network share, I created a new group, driveaccess, with gip 1003

I then set up the network share by adding the following to /ets/fstab

// /media/Data cifs guest,rw,mand,gid=1003,forcegid,user=duckies%swordfish 0 0

After mounting the drive, the service accounts see the premissions as

-rwxr-xr-x 1 root driveaccess   1544704 Jun  1  2013 AppData1.dat

And the processes can read the data with no problems, but any attempt to write to the drive fails

touch: cannot touch `test.txt': Permission denied

What do I need to add to the fstab to let everything in the driveaccess group write to the share?

I already executed:

usermod -aG driveaccess serviceaccount1

2 Answers 2


You probably want to add explicit permissions to the mounted file system in the fstab entry:

<your other options>,file_mode=0770,dir_mode=0770

This will be on the safe side by allowing all group members to read, write and execute all files and prohibiting access to any other user of the system. If you still want read access for the others you will have to replace the 0 by an appropriate value. e.g.

<your other options>,file_mode=0775,dir_mode=0775

for read and execute rights.

  • Is this supposed to work on Mac too? I get mount_smbfs: -o file_mode: option not supported Commented Mar 20, 2016 at 7:31

In my case with Win 10, besides the permissions in gnu/linux side

 sudo mount -t cifs -o username=user1,file_mode=0777,dir_mode=0777 // ~/shared-d

I had to add permission to "everyone" for read/write in Windows side: properties -> sharing -> share...

  • Share permissions should almost always be set to give "Everyone" full access. From there you can use standard file permissions to restrict access as necessary.
    – Foxocube
    Commented Apr 23, 2021 at 10:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .