I'm trying to use a shared folder from the host Windows machine as the root directory for lighttpd on the guest Ubuntu virtual machine. When I attempt to change the permissions, nothing happens. The permissions always remain the same (as shown below). lighttpd always returns a 403 error no matter the file type. How can I change the file permissions?


Research suggests adding my user to the vboxsf user group will allow me to change the permissions. When I attempt to add my user to the group using usermod, it seems to have worked but the changed are immediately overridden and rolled back. Other sources suggest I have to manually mount the disk with permissions I want. Despite my attempts at changing the owner, root still remains owner. This is despite my earlier explanation of attempting to use usermod to change the owner. Checking the group settings in the /etc/group file, I see my username is listed. However, virtualbox may be interferring.

As an alternative, I'm considering doing a network share from the guest to the host.

End Edit

/media/sf_Space.io$ ls -l
total 10
drwxrwx--- 1 root vboxsf    0 May 12 11:57  css
-rwxrwx--- 1 root vboxsf    8 May 12 12:27  index.html
drwxrwx--- 1 root vboxsf    0 May 12 11:57  js
drwxrwx--- 1 root vboxsf    0 May 12 11:57  PythonCGITest
-rwxrwx--- 1 root vboxsf 1181 May 12 11:57  README.md
drwxrwx--- 1 root vboxsf    0 May 12 11:57  sprites
-rwxrwx--- 1 root vboxsf  587 May 12 11:57  test.html
drwxrwx--- 1 root vboxsf 4096 May 12 11:57 'welcome page (sketch)'

2 Answers 2


After hours of work, I figured out my own solution. The permissions problem is related to how virtualbox mounts file systems from the host. My host file system is ntfs in this situation. Despite any commands attempting to alter the volume permissions, the permissions will remain with root as owner and permissions set to 770.

  • Install guest additions package in your virtual machine. Create a new shared folder with only "make permanent" checked. DO NOT check the auto-mount box. Also, not sure if this is necessary but also install the expansion package for virtualbox on your host operating system.

  • Create a directory on the guest machine (the operating system running within virtualbox).

  • Create a .sh file with the following bash script:

    sleep 1 echo '[your password]' | sudo -S mount -t vboxsf -o rw,uid=1000,gid=1000 [share name] [path to the directory created in the previous step]

  • Navigate to the "startup applications" manager and create a new startup with the command: xterm -e "/path/to/script/in/previous/step"

  • Set the file permission to executable: chmod +x [file name].

  • Install xterm sudo apt-get install xterm.

I realize the security risk of "entering" the sudo password. However, in this situation, I am the only one with access or desire to run this virtual machine. I deemed the risk low. Assess your situation before resorting to this solution. Also, I remember reading that adding a space before the command will prevent the command line from storing that command in the history list.

This solution worked for me on Ubuntu 18LTS. I am aware of rc.local and chron jobs but these vary among distribution versions and it seemed kind of hit or miss. rc.local doesn't even exist in my installation and creating the file manually accomplished nothing.

  • After this script mounts the folder on the new directory, do the files still appear as mode 770 owned by root group vboxsf? And why install xterm? Jun 12, 2019 at 14:59
  • what do you mean with: [share name]? Jan 17, 2020 at 17:21

In my case, nothing worked - and simply reinstalling virtual box guest additions did the job. I wish I had tried it earlier.

You must log in to answer this question.

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