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.

2 Answers 2

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.

14
  • 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
    Commented Oct 28, 2014 at 12:03
  • @MikeH-R AFAIK NTFS has only a subset, but I don't know exactly which.
    – Anthon
    Commented Oct 28, 2014 at 12:05
  • hmmm... so no idea on how to get virtualbox to save to a different member of the subset?
    – Mike H-R
    Commented Oct 28, 2014 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
    Commented Oct 28, 2014 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
    Commented Oct 28, 2014 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.

You must log in to answer this question.

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