3

I have a virtualbox VM with arch Linux running on my windows PC (which I unfortunately have to use for work). I use this to work on my windows PC with a Linux environment as an alternative to Cygwin.

I have set up a Virtualbox shared folder which shares my C:\ drive with my Linux VM but I seem to be unable to change the file permissions within any of the folders. This is a problem as now git thinks all of my files permissions have changed.

» ll README.txt
-rwxrwx--- 1 root vboxsf 4.5K Oct 28 10:42 README.txt
» chmod 644 README.txt
» ll README.txt
-rwxrwx--- 1 root vboxsf 4.5K Oct 28 10:42 README.txt
» sudo chmod 644 README.txt
» ll README.txt
-rwxrwx--- 1 root vboxsf 4.5K Oct 28 10:42 README.txt
» git diff README.txt | cat
diff --git a/README.txt b/README.txt
old mode 100644
new mode 100755

How do I fix this?

The folder was mounted using Automount from the VirtualBox Manager on windows.

3

This will not work as it unlikely that your hosts mapped in filesystem (i.e. Windows C: drive, so most likely NTFS) supports the full range of permission bits that Linux git expects.

In a similar situation I have exported a Linux directory via Samba and used that from Windows and Linux without problems. This however has the disadvantage that you cannot access the data when the VM is not running.

| improve this answer | |
  • hmmm... that is very annoying. do you have any idea why, when I edit a file in the VM and save it, the permissions in cygwin have changed to 755 (from the previous 644)? surely NTFS must support filesystem permissions to the point where it will modify it, which is what I need? – Mike H-R Oct 28 '14 at 12:03
  • @MikeH-R AFAIK NTFS has only a subset, but I don't know exactly which. – Anthon Oct 28 '14 at 12:05
  • hmmm... so no idea on how to get virtualbox to save to a different member of the subset? – Mike H-R Oct 28 '14 at 12:06
  • @MikeH-R Sorry, no. If you don't want or cannot go the Samba route I suggested, you should bite the bullet and tell git these are the new file permissions, and handle resetting them during installation if necessary. – Anthon Oct 28 '14 at 12:11
  • I was afraid that might be the only option. I guess samba is probably the way to go. I don't suppose you have a link to any documentation on setting up samba between a guest linux OS and windows host? (or anything similar) – Mike H-R Oct 28 '14 at 12:13
2

To Linux, the file system mounted to the host is to a foreign machine, so it does not have any control over the permissions of the files in that system. That control belongs to the host. So you need to adjust the permissions in a part of the drive that you can constrol.

I link my Virtual Box to a subdirectory of my Documents folder. That way I can open up the permissions without worrying about hurting the host systems OS files.

| 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.