4

On my Ubuntu machine I am mounting a CIFS share by having the following in my /etc/fstab

//netgear0/photos /media/netgear0-photos  cifs  credentials=/home/bob/passwd/netgear0-smb-cred,iocharset=utf8,uid=1000,gid=1000,rw  0  0

This mounts the share correctly and appears like this:

drwxr-xr-x  1 bob  bob    0 2011-10-10 07:25 netgear0-photos

However I would like to alter the permissions on just the mount point directory to 700 so that only bob can see the files in the mount point. I have tried setting the permissions on the directory before mounting but this gets replaced during mount. I can find options for altering the permissions inside the mount point, but not for altering the mount point its self.

2 Answers 2

6

If your Samba server allows CIFS Unix extensions, you might need to add nounix to micke's answer: ,dir_mode=0700,file_mode=0700,nounix

This is because with the CIFS Unix extensions the mode can't be overriden by the client. Although it is not extremely clear, there's a reference on the mount.cifs man page saying:

   If the uid's and gid's being used do not match on the client and
   server, the forceuid and forcegid options may be helpful. Note however,
   that there is no corresponding option to override the mode. Permissions
   assigned to a file when forceuid or forcegid are in effect may not
   reflect the the real permissions.
4

Add ,dir_mode=0700,file_mode=0700 to the options field (after rw).

You must log in to answer this question.

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