I have shared a folder from Windows on to my virtual machine. The shared folder is being mounted correctly, and I am able to read write within the folder, but unable to change permissions of any file within the shared folder.

Below are the mount options of the shared folder

myVM on /media/sf_myVM type vboxsf (rw,nodev,relatime,ttl=0,iocharset=utf8,uid=0,gid=999,dmode=0770,fmode=0770,tag=VBoxAutomounter)

user is already part of vboxsf group

uid=1000(vmuser) gid=1000(vmuser) groups=1000(vmuser),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),116(lpadmin),126(sambashare),999(vboxsf),1001(sftp)

Below error is thrown when try to change permissions using chmod for any files inside shared folder.

chmod: changing permissions of 'perm.txt': Operation not permitted

File mode information is stored in the filesystem metadata. Linux filesystems have this metadata, Windows filesystems do not (at least not the same metadata). Even though you're accessing the filesystem from the Linux virtual machine, the actual files are being written to the Windows filesystem via the shared folder. Notice the dmode=0770 and fmode=0770 mount options. Since Windows doesn't have this metadata, that tells Linux to "make it look like directories have mode 0700 and files have mode 0770".

The mode information that you're trying to change does not exist in the first place.

| improve this answer | |
  • chmod works if run with sudo, also this used to work in my last VM setup for same windows share. – DarkKnight Oct 27 '19 at 16:17
  • @DarkKnight When you run chmod with sudo, do you see the mode change reflected? – Andy Dalton Oct 27 '19 at 18:01
  • with sudo, chmod runs successfully but mode change is not reflected. Basically I am trying to do some git clone, which is failing due to this error where git internally tries chmod on .git/config.lock, but running it with sudo works, normally I expect if user is part of vboxsf group which has the permissions, the error should not be thrown. – DarkKnight Oct 28 '19 at 15:21
  • The answer here might enable you to work around the problem: stackoverflow.com/questions/21752726/… – Andy Dalton Oct 28 '19 at 17:22
  • I have already tried that, adding filemode in gitconfig to false. Error still remains the same. – DarkKnight Oct 29 '19 at 7:45

I can't remember it MS-Windows can do this, but let us assume that it can. The mount options have different uid/gid than that of the active user. This will probably stop it working, in a way that is explained with sudo making it work.

| improve this answer | |

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.