Windows host linux guest shared folder

How to access a shared folder in VirtualBox?

I followed the steps for sharing folders between Windows 7 and Ubuntu in VirtualBox. Despite that the folder appears with a X sign and gives me the following message when a try to open it:

On the system page, you have assigned more than 50% of your computer’s memory (2.93 GB) to the virtual machine.

10 Answers 10

Access to shared folders in Virtual Box

Command line

By default, VirtualBox shared folders are created with read/write permission for the guest. This can be done from the command line on the host with:

VBoxManage sharedfolder add "VM name" --name sharename --hostpath "C:\test" 

By adding the option —readonly we can restrict these for read-only access. Use the —transient option if you only want the shares to appear in the present session but not persistent for following sessions. There are some limitations for shared folders (see this question for details). If prerequisites are met we may mount these shared folders manually by running the following commands in the guest:

mkdir /home//vboxshare sudo mount -t vboxsf -o uid=1000,gid=1000 sharename /home//vboxshare 

Of course, we can also use different mount options to mount as read/only or mount with read access only to root.

Auto-Mount through Virtual Box Manager

In case we enabled auto-mounting on creating a shared folder from the Virtual Box Manager those shared folders will automatically be mounted in the guest with mount point /media/sf_ . To have access to these folders users in the guest need to be a member of the group vboxsf .

sudo usermod -aG vboxsf $USER 

The guest will need to restart to have the new group added.

Source and further reading: Virtual Box User Manual

i set a shared folder in the GUI and also set the Auto-Mount. restarted the VM, went to /media but still nothing there

This command, suggested by another answer here, seems clearer and has better output: sudo adduser your_username vboxsf

@JordanBrough: totally correct — all ways lead to Rome. You can even use a graphical frontend users-admin . The command was edited in by another user.

Thanks for your answer.. in the command you mentioned above sudo mount -t vboxsf -o uid=1000,gid=1000 share /home//vboxshare , I don’t see a mention of the sharename , which is used when creating the shared folder using VBoxManage sharedfolder add «VM name» —name «sharename» —hostpath «C:\test» . If there are multiple shared folders.. how does VirtualBox know which sharename to associate the folder vboxshare with? Or do you mean that sharename should be the same as vboxshare ?

Читайте также:  Alt linux office server

Actually there is an easy way to do that:

  1. Install the extension pack for VirtualBox.
  2. Restart your virtual machine
  3. Install Guest Additions in your guest Ubuntu
  • You can mount the ISO which is on /media or press Left Control + D
 sudo adduser your_vm_username vboxsf 

THIS. I wasn’t in the user group. Seems like that should have been automated by the gest additions or at least stated clearly.

@Atcold Logging out and in again adds the group to the current user (session) but did not trigger auto-mount of the shared folder in my case. Only a reboot did.

First, please make sure you have installed the Guest Additions

Insert Guest Additions CD image.

  1. Start your VM
  2. Devices > Insert Guest Additions CD image.
  3. Mount the CD:
sudo mount /dev/cdrom /media/cdrom 
sudo apt-get install make gcc linux-headers-$(uname -r) 
sudo /media/cdrom/VBoxLinuxAdditions.run 

Second, add your user to the group ‘vboxsf’:

~$ echo $USER; ahmed ~$ sudo usermod -a -G vboxsf ahmed 

Reboot

Know that the label of your shared folder is lpi (for example):

Edit shared folder

Prepend sf_ to the label. Then, you will find your shared folder under /media/sf_lpi

Finally, you can also create a link to your home. For example:

ln -s /media/sf_lpi /home/ahmed/lpi 

Can I use a shared folder from an Ubuntu VM without a harddisk image, but with only a Live CD image? Basically I am trying to add two CD drives, one holding the Ubuntu Live CD, and the other one holding the VBGuestAdditions.iso, and start the machine, then install VBGuestAdditions in the loopback root, and then I would like to be able to access a shared folder.

Also, is there a way to see the shared-folder before mounting, such as by using a command like lsblk or something?

When I try to do «sudo mount -t vboxsf mysharename mysharemountpoint», I always get: «/sbin/mount.vboxsf: mounting failed with the error: No such device»

Add the shared folder to the virtual machine using vBox graphical interface Make sure to select automount and make permanent

Login to the virtual machine using a root account

Check vboxsf group exists

~$ grep vboxsf /etc/group vboxsf:x:125: 

Check user is not already in vboxsf group

~$ id nilo uid=1000(nilo) gid=1000(nilo) groups=1000(nilo),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),109(lpadmin),124(sambashare) 

Add user nilo to vboxsf group

~$ sudo usermod -a -G vboxsf nilo 
~$ id nilo uid=1000(nilo) gid=1000(nilo) groups=1000(nilo),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),109(lpadmin),124(sambashare),125(vboxsf) 

Reboot and login as nilo

Shared folder is now accesible in /media/sf_dropbox (dropbox is the name I gave to the share)

Share a folder between Host OS-> Windows and Guest OS ->Ubuntu(Virtual box)

Step 1 Install install Guest Additions from VirtualBox’s menu go to Devices->Install Guest Additions This will mount a virtual CD on your /media/cdrom. As root user Open this /media/cdrom added folder using Open with terminal option(Right click with mouse).

Читайте также:  Zabbix статус сервиса linux

Step 2 Run the program VBoxLinuxAdditions.run. When the program completes reboot your VirtualBox.

$ sudo ./VBoxLinuxAdditions.run 

Step 3 Create a shared folder. From Virtual menu go to Devices->Shared Folders then add a new folder in the list, this folder should be the one in windows which you want to share with Ubuntu(Guest OS). Make this created folder auto-mount. Example -> Make a folder on Desktop with name Ubuntushare and add this folder.

Step 4 When done with you shared folder(s) specification, we mount folder from Ubuntu(Guest OS). Create a mountpoint, this a directory in Ubuntu that will share files with the shared folder from Windows. Run this to create a directory in Ubuntu

$ sudo mkdir ~/Desktop/windowsshare 

Step 5 With your mountpoint created you can now mount the shared folder. Run this command to share the folder:

$ sudo mount -t vboxsf Ubuntushare ~/Desktop/windowsshare 

Ubuntushare is the name of folder we add in VirtualBox Devices section this folder is in Windows(Host OS). ~/Desktop/windowsshare is the directory in Ubuntu(Guest OS)

CONGRATULATIONS-> Now you can share the files between Windows and Ubuntu. Try adding any file in windows(Host OS) Ubuntu share folder now check Ubuntu(Guest OS) windowsshare directory the file will be reflected.

Источник

How to create Virtualbox shared folder between Windows host and Ubuntu18.04 guest machine [closed]

Closed. This question is not about programming or software development. It is not currently accepting answers.

This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.

I’ve read docs and all questions about sharing folder from host machine to Virtualbox’s guest machine and still can’t get it working. In my case the host is Windows machine and guest is Ubuntu18.04 server machine. What is advised and what I’ve already tried: 1) In the VM’s menu I found ‘devices’ submenu and clicked ‘Insert Guest Additions CD image’ option after which the CD icon in the status bar was lit and shows that the CD is inserted and the path to iso is C:\Program Files\Oracle\VirtualBox\VBoxGuestAdditions.iso (I checked that file really exists there). 2) In the same ‘devices’ VM’s settings submenu I opened ‘Shared Folder Settings’ and added shared folder with name ‘test’ and path ‘D:\test’ which leads to the folder on my D: disk which contains test files. 3) I reboot my Ubuntu VM and look into /media directory expecting to find /media/cdrom directory or something like this with file VBoxLinuxAdditions.run in it, which should be run according to docs. But /media directory is empty so I have nothing to do with it. I looked for this file into other directories but had no success. After that I tried to install Virtualbox-guest-additions from repository as was advised on ubuntu forum:

sudo apt-get update sudo apt-get install virtualbox-guest-dkms 
mkdir -p /home/myusername/test sudo mount -t vboxsf test /home/myusername/test 
mount: /home/myusername/test: wrong fs type, bad option, bad superblock on /home/myusername/test, missing codepage or helper program or other error. 

I see there is no /sbin/mount.vboxsf link present, I’m not sure if this is a problem, also I tried add my user to ‘vboxsf’ group with:

sudo usermod -a -G vboxsf myusername 

Источник

Читайте также:  Libffmpeg so opera linux

Shared folder between QEMU Windows guest and Linux host

@CiroSantilli包子露宪六四事件法轮功 That question is tagged with Linux where -virtfs works great (see also this question), but I am not aware of a 9p driver for Windows.

3 Answers 3

QEMU’s built-in Samba service

The not-functioning -net user,smb option was caused by an incompatibility with newer Samba versions (>= 4). This is fixed in QEMU v2.2.0 and newer with these changes:

(Debian has backported the latter two patches to 2.1+dfsg-6 which is present in Jessie.)

Usage

You can export one folder as \\10.0.2.4\qemu when using User networking:

qemu-system-x86_64 \ -net user,smb=/absolute/path/to/folder \ -net nic,model=virtio \ . 

When QEMU is successfully started with these options, a new /tmp/qemu-smb.*-*/ directory will be created containing a smb.conf . If you are fast enough, then this file could be modified to make paths read-only or export more folders.

Mode of operation

The samba daemon is executed whenever ports 139 or 445 get accessed over a «user» network. Communication happens via standard input/output/error of the smbd process. This is the reason why newer daemons failed, it would write its error message to the pipe instead of protocol messages.

Due to this method of operation, the daemon will not listen on host ports, and therefore will only be accessible to the guest. So other clients in the network and even local users cannot gain access to folders using this daemon.

Since QEMU v2.2.0 printer sharing is completely disabled through the samba configuration, so another worry is gone here.

The speed depends on the network adapter, so it is recommended to use the virtio netkvm driver under Windows.

Also note that the daemon is executed by its absolute path (typically /usr/sbin/smbd ) as specified at compile time (using the —smbd option). Whenever you need to try a new binary or interpose smbd , you will need to modify the file at that path.

Other caveats

Executables ( *.exe ) must be executable on the host ( chmod +x FILE ) for the guest to have execute permissions. To allow execution of any file, add the acl allow execute always = True option to a share.

Example read-only smb.conf configuration which allows execution of any file (based on QEMU v2.2.0):

. [qemu] path=/home/peter/windows read only=yes guest ok=true force user=peter acl allow execute always = True 

Источник

Оцените статью
Adblock
detector