1

I've run into a strange permissions issue;

A shared folder shows one set of permissions in Windows, and totally different ones when accessed in Linux via VirtualBox.

The shared folder is my XAMPP htdocs/ directory, as I want the ability to work on the same repositories/sites from 2 different environments - so I can't move the folder.

My current setup

  • Windows 7 (Host), with Ubuntu running inside VirtualBox (Guest)
  • I've set up the folder as a Shared location, and can access it via Ubuntu's terminal under /media/sf_<myfolder>.
  • The shared folder is set to automount and be permanent in VirtualBox's settings.
  • My user is part of the vboxsf user group, and I've confirmed it via checking /etc/group.
  • I've installed vitrualbox-guest-additions-iso. Shared clipboards are working fine.
  • I'm using cygwin for my Windows terminal

How the permissions appear

Windows (from cygwin terminal), using $ ls -alF

me@my-server /cygdrive/c/xampp/htdocs/my-website$ ls -alF
total 61313
drwxrwxr-x+ 1 me Domain Users        0 Sep  6 12:12 ./
drwxrwx---+ 1 me Domain Users        0 Sep  8 16:22 ../
drwxrwxr-x+ 1 me Domain Users        0 Sep  8 15:57 .git/
drwxrwxr-x+ 1 me Domain Users        0 Sep  6 12:06 bal/
-rw-rw-r--+ 1 me Domain Users     1065 Sep  6 12:06 .csslintrc
-rw-rw-r--+ 1 me Domain Users      367 Sep  6 12:06 .editorconfig

Ubuntu terminal (VirtualBox), using $ ls -alF

me@my-server:/media/sf_htdocs/my-website$ ls -alF
total 61256
drwxrwx--- 1 root vboxsf    12288 Sep  6 12:12 ./
drwxrwx--- 1 root vboxsf     4096 Sep  8 16:22 ../
drwxrwx--- 1 root vboxsf     4096 Sep  8 15:57 .git/
drwxrwx--- 1 root vboxsf        0 Sep  6 12:06 bal/
-rwxrwx--- 1 root vboxsf     1065 Sep  6 12:06 .csslintrc*
-rwxrwx--- 1 root vboxsf      367 Sep  6 12:06 .editorconfig*

Windows, using $ stat

me@my-server /cygdrive/c/xampp/htdocs/my-website$ stat .csslintrc
  File: .csslintrc
  Size: 1065            Blocks: 4          IO Block: 65536  regular file
Device: bcd2ece6h/3167939814d   Inode: 4222124651673917  Links: 1
Access: (0664/-rw-rw-r--)  Uid: (1051198/me)   Gid: (1049089/Domain Users)
Access: 2017-09-06 12:06:15.578083600 +1000
Modify: 2017-09-06 12:06:15.578583700 +1000
Change: 2017-09-06 12:06:15.578583700 +1000
 Birth: 2017-09-06 12:06:15.578083600 +1000

Ubuntu, using $ stat

me@my-server:/media/sf_htdocs/my-website$ stat .csslintrc 
  File: '.csslintrc'
  Size: 1065        Blocks: 3          IO Block: 4096   regular file
Device: 29h/41d Inode: 14          Links: 1
Access: (0770/-rwxrwx---)  Uid: (    0/    root)   Gid: (  999/  vboxsf)
Access: 2017-09-06 12:06:15.578083600 +1000
Modify: 2017-09-06 12:06:15.578583700 +1000
Change: 2017-09-06 12:06:15.578583700 +1000
 Birth: -

I also created a file from both systems, to inspect the default permissions. I did the same with test directories, and both files + folders show exactly the same permissions.

Windows

-rwxrwxr-x+ 1 Administrators Domain Users        0 Sep 11 08:52 .test-from-linux-vm*
-rw-rw-r--+ 1 me      Domain Users        0 Sep 11 08:52 .test-from-windows

UbuntuVM

-rwxrwx--- 1 root vboxsf        0 Sep 11 08:52 .test-from-linux-vm*
-rwxrwx--- 1 root vboxsf        0 Sep 11 08:52 .test-from-windows*

What I've noticed

  • I cannot change file/folder permissions in Ubuntu, even with sudo chmod <permissions> <file>
  • While I can change permissions in Windows, those changes are not reflected in Ubuntu:

Windows; updated web.config from 664 to 755

-rwxr-xr-x+ 1 me      Domain Users     4555 Sep  6 12:06 web.config*

Ubuntu

-rwxrwx--- 1 root vboxsf     4555 Sep  6 12:06 web.config*

I've already tried...

  • Restarting the VM (many times ;D)
  • Confirming the shared directory is one and the same from both Windows and Linux, via creating test files in one and checking they appear in the other.
  • The suggestions suggestions in this question

My questions:

  • Why do the permission sets differ between systems?
  • Are they being assigned at an OS level, not a file level?

Any help would be awesome!

  • I don't see a question here. What are you trying to achieve? – fkraiem Sep 8 '17 at 7:40
  • 1
    Windows and Ubuntu have user naming conventions so I don't expect them to be the same – George Udosen Sep 8 '17 at 8:04
  • @fkraiem, Sorry for not being clearer, I've updated the question – Timmah Sep 10 '17 at 7:11
  • That's not much better. What exactly is it that you want to do but the current permissions won't let you? – fkraiem Sep 10 '17 at 8:07
  • Revised again; I haven't run into a specific issue with a program yet, but anticipate I might because of the permission differences. Happy to be wrong on that! – Timmah Sep 10 '17 at 23:16
1

Short answer: You are using incompatible environments and software; Windows, Cygwin and VirtualBox all implement non-backwards-compatible implementations of POSIX standards, hence why changes in one are not reflected in the others.

In general: storing a group and a user of a file as a string would be way too wasteful. Not only would it take a bunch of additional disk space, but would also require O(n) of processing time in the worst case to check whether you have permissions to a single file!

Instead those attributes are stored as a number, which would always require just O(1) to check permissions. You can see them using e.g. stat command:

$ stat r600_state_common.c 
  File: r600_state_common.c
  Size: 90718           Blocks: 184        IO Block: 4096   regular file
Device: 26h/38d Inode: 70588       Links: 1
Access: (0644/-rw-r--r--)  Uid: ( 1000/constantine)   Gid: ( 1000/constantine)
Access: 2017-09-08 00:18:26.243828226 +0300
Modify: 2017-09-07 10:52:33.387136858 +0300
Change: 2017-09-07 10:52:33.387136858 +0300
 Birth: -

So, in your system UID of the file matches user root. In the other system it's Domain.

In case of cross-working with Windows systems there's more to it. Despite that POSIX standard have not had any really fundamental changes, Microsoft programmers have always struggled with it. Over the course from Windows NT to Windows 10 there have been three non-backward compatible rewrites of the implementation. So for compatibility, Cygwin is using its own implementation of mapping Windows security descriptors to POSIX permissions.

On top of it you are trying to access a Windows file system through VirtualBox. VirtualBox of course have implemented its own mapping too, and this mapping doesn't work very well (as you can see by changing permissions through chmod, and not seeing the changes reflected).

So, right now, you have got 3 implementations on your system, incompatible with each other. This is the reason of you seeing the problems.

FTR: VirtualBox is open source, so if you're really feel keen to it, you could rewrite it to be compatible with Cygwin (as their implementation is the only back-compatible POSIX implementation on Windows as far as I know).

NB: using a system as a root is a very bad practice! Especially given you're a developer. Consider using a usual user instead.

  • Thanks for the response @Hi-Angel. I'm not using the VM as root, that's just how the existing files appear out of the box when I access the shared folder. I've updated my question to include stat, thanks. – Timmah Sep 10 '17 at 23:17
  • @Timmah I've updated the answer to your update, I hope it clears up your confusion. About the root — are you sure? I see in your update you created files in Ubuntu, and their owner is root. Have you created them on the shared directory of VB? Or somewhere else? – Hi-Angel Sep 11 '17 at 9:19
  • Thanks, that explains things much better. In this case, is there a known combination of Windows + VM software + Terminal that uses compatible POSIX implementations? – Timmah Sep 11 '17 at 22:44
  • @Timmah I'm not aware of, but I doubt so. That said, I think you can get very close to it by using Ubuntu-On-Windows of Windows 10. Note however that I've never used this one, and I'm aware that it's still buggy, but I think it might solve problems with POSIX permissions (but don't take my word for it). On the other hand: are you aware you're crippling your Ubuntu experience by using it as a guest. Why not just use Windows as a guest? – Hi-Angel Sep 12 '17 at 6:22
  • I'm running this in an office environment, so I don't get a call on my main OS :(, and I'm also relatively new to VM setups. I've heard about Ubuntu-on-windows, known as 'Windows Subsystem for Linux' or WLA, and it looks awesome so far. It's definitely got issues, but it at least Microsoft is doing something with them – Timmah Sep 12 '17 at 23:23

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.