I'm trying to mount a NAS share using CIFS in Ubuntu 14.04. This is my personal share and I'd like to make sure that files are readable only by me and not by anyone else logged in. So ideally, I'd like to use something like a umask=... in my mount command to make sure that files and directories always show up with their group and other permissions set to 0.

Unfortunately, umask parameter is not supported by mount.cifs. The command offers two other arguments (file_mode and dir_mode) but those seem to only have effect on newly created files, as no matter what values I specify, the files and directories on my mounted share always show up with mode 0777.

Is there any trick to force specific permission on mounted files and directories (short of making the parent of mount directory mode 0700)?

2 Answers 2


One possibility is to mount the cifs share into a personal folder as ubuntu does for example. Set your rights for /media/user and then mount it on /media/user/share.

The other (and nicer) possibility is to use pam_mount. It's a user-based mount system which means the mounts don't appear in the fstab. Every user can set its own mounts. I really like this system. Then, in your personal (or global) configuration file, set the mount option dir_mode=0700 for your volume. It works fine for me, just tried it. Be sure to allow user-mounts and the dir_mode option in the global configuration file.

Good luck!

  • Just to make things easier for your: if you use the second option (what i would appreciate) here is a sample volume entry in my ~/.pam_mount.conf.xml: <volume fstype="cifs" server="" path="Multimedia" mountpoint="~/media/Multimedia" options="nosuid,nodev,dir_mode=0700,cred=/home/%(USER)/.mynas.cred" />
    – ju.kreber
    Apr 19, 2014 at 17:38

If you add cifsacl as an option to the cifs command (it must be defined earlier in the same file, pam_mount.conf.xml) you needn't specify dir_mode or file_mode: the mount will use 0700 as mask and will honour the remote ACLs of files and directories.

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.