Allow chmod on CIFS mount
I have a Windows 7 host, with a CentOS 6 guest under VirtualBox.
I have a Windows directory shared with the Linux guest using CIFS.
Everything worked fine so far, until I realized that all chmod
operations yield:
chmod: changing permissions of `x': Operation not permitted
This is understandable, but my problem is that some tools I have no control on, attempt to chmod
files for me, and fail as a result.
Is it possible to allow but ignore all chmod()
calls on a CIFS mount? Please note than these calls are made from a programming language and not from the command-line chmod
utility.
Edit: the manual for mount.cifs says (emphasize mine):
The core CIFS protocol does not provide unix ownership information or mode for files and directories. Because of this, files and directories will generally appear to be owned by whatever values the uid= or gid= options are set, and will have permissions set to the default file_mode and dir_mode for the mount. Attempting to change these values via chmod/chown will return success but have no effect.
That's exactly the behaviour I'm after then, so why is it not working for me?
Found it: the noperm
mount parameter does exactly this:
//192.168.56.1/www /mnt/www cifs noperm,username=www,password=xxx, ...
Note that mount -a
does not apply the parameter, you have to reboot to make it work.
It took me a lot of trial and error to figure this out.
Now chmod
works fine, the command does not yield any error, and is just ignored.