Kali guest can't write to shared folder

Discussions about using Linux guests in VirtualBox.
Post Reply
MoonwalkInsurance
Posts: 4
Joined: 21. Feb 2021, 17:47

Kali guest can't write to shared folder

Post by MoonwalkInsurance »

I'm having some trouble getting a shared folder set up within a Kali guest. (Ubuntu 20.04 host)

I can access the shared folder, read the contents, and open files, but I can't modify the files or copy new files into the folder from within the Kali guest. I can access the folder with no issues from host system.

This is a fresh import of the premade Kali 2021.1 VM from the offensive security website.

I've always used these premade VM's and never had a problem in the past. Only since updating to this newest version. Just for the hell of it, I also tried installing from the .iso, but I had the same problem.

Here's how I'm attempting to set up the shared folder:
1. After a fresh import, I boot the guest and go to Devices>Shared Folders>Shared Folder Settings>+Folder where I choose the folder on my host system, name the folder kalishared and check Mount Automatically and Make Permanent.
2. I insert the guest additions image, and run the script to update guest additions to the latest version, then reboot.
3. In the command line, I enter this command to add myself to the vboxsf group:
sudo usermod -aG vboxsf kali
4. I use this command to take ownership of the folder:
sudo chown -R kali:users /media/sf_kalishared
The command is accepted and there are no error messages, when I use "ls -al" I can see that the ownership of the folder hasn't changed.

In another Linux VM, where the shared folder works normally, I can see that the shared folder is owned by root, but is in the vboxsf group.

I also tried:
sudo chgrp -R vboxsf sf_kalishared
Again, same results. The command completes with no errors, but the group of the folder isn't changed.

At this point, I've spent many hours searching for solutions online, but no luck. Does anyone have any advice for me?
Last edited by MoonwalkInsurance on 11. Mar 2021, 19:30, edited 1 time in total.
Martin
Volunteer
Posts: 2561
Joined: 30. May 2007, 18:05
Primary OS: Fedora other
VBox Version: PUEL
Guest OSses: XP, Win7, Win10, Linux, OS/2

Re: Unable to take ownership of shared folder within Kali guest

Post by Martin »

VirtualBox Guest Additions Shared Folders don't support access control functions.
fth0
Volunteer
Posts: 5677
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: Unable to take ownership of shared folder within Kali guest

Post by fth0 »

Just for info: In Linux, adding a user to a group has an effect only after the next login of the user.
MoonwalkInsurance
Posts: 4
Joined: 21. Feb 2021, 17:47

Re: Unable to take ownership of shared folder within Kali guest

Post by MoonwalkInsurance »

fth0 wrote:Just for info: In Linux, adding a user to a group has an effect only after the next login of the user.
Thank you for the reply.

I've restarted the VM after each change, but no change. :(
MoonwalkInsurance
Posts: 4
Joined: 21. Feb 2021, 17:47

Re: Unable to take ownership of shared folder within Kali guest

Post by MoonwalkInsurance »

Martin wrote:VirtualBox Guest Additions Shared Folders don't support access control functions.
Interesting. By that, do you mean that once the folder is set up, the ownership and permissions can't be changed? Forgive me, I'm somewhat new to Linux.

What do you think about the fact that the shared folder in my Mint VM is owned by root:vboxsf, while the shared folder in my Kali VM is root:root? If the permissions and ownership can't be changed, is there a way to re.....I dunno what the right term would be....reinstall? remount? the shared folder with the correct permissions?
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Unable to take ownership of shared folder within Kali guest

Post by mpack »

GA shared folders are not true network shares, they only exist as a way to get files in and out of a VM. Don't expect them to do much else. In particular there is no Linux filesystem behind that list of files, so expecting complex permissions to apply would be incorrect.
MoonwalkInsurance
Posts: 4
Joined: 21. Feb 2021, 17:47

Re: Unable to take ownership of shared folder within Kali guest

Post by MoonwalkInsurance »

mpack wrote:GA shared folders are not true network shares, they only exist as a way to get files in and out of a VM. Don't expect them to do much else. In particular there is no Linux filesystem behind that list of files, so expecting complex permissions to apply would be incorrect.
I guess the title of my post isn't really conveying the problem I'm trying to solve. The issue I'm having is that I can't write to my shared folder from the Kali guest. I assumed that was because of the ownership and permissions of the folder, but maybe I'm wrong. If I could retitle my post, it would be "Can't write to Kali guest shared folder."

I was just doing some digging, and I found this post:
https://www.smarthomebeginner.com/mount ... ntu-linux/
It says that "You may encounter permissions issues when trying to access VirtualBox shared folder on Ubuntu (or other Linux distros). The shared folder is mounted with 770 permissions with root user and vboxsf as the group."

Do you think that the fact that my guest shared folder shows up as 750 and root:root might be related to why I can't write to it? If so, do you know how I could change it?
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Kali guest can't write to shared folder

Post by scottgus1 »

MoonwalkInsurance wrote:I guess the title of my post isn't really conveying the problem I'm trying to solve.
Could be, if you could clear up the kind of shared folder you're using.

If it is a 'shared folder' that is made in a Virtualbox dialog box or through vboxmanage commands, and you must have Guest Additions installed to see and use it, then Martin, fth0, and Mpack have arrived at the correct interpretation:

Virtualbox Shared Folders are not real shared folders. They do not require a network. They are a completely separate channel from real shared folders provided over a network by the host OS or LAN computers. Virtualbox Shared Folders are only for manual mouse-driven drag-n-drop copying of files from host to VM or back. Maybe command-line file copy as well. Virtualbox Shared Folders are not for opening, saving, databasing, permission-setting, playing, editing, all the other stuff a normal shared folder can do.

If you want to edit a file in a shared folder on the host without copying the file to the VM's disk first, then you must set up a real shared folder from the host OS and a Host-Only or Bridged network between the host and VM.
Post Reply