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

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 – Sridhar Sarnobat Mar 20 '16 at 7:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.