Simple file exchange method for virtual machine and host under Linux

  
 

The virtual machine is considered a virtual machine, of course, it can not directly control the physical hardware, especially the access to the physical disk. File exchange between the virtual machine and the host, either as two different computer
, access through network sharing, or use both storage devices that can be accessed, such as U disk, indirect file exchange, the following text to be said, is through the network.

If you go online to check the information, then this situation under windows is generally accessed through the network neighborhood, and in Linux, it will be using Samba, I have not tried under Windows, and Samba It is indeed very "three eight", at least I find it difficult to get it.

When using QEMU virtual machine software under windows system, its Win shell QEMU Manager provides a good way ——FTP access, QEMU Manager comes with a small FTP service, dedicated to In the implementation of this function, so, under Linux, there is no QEMU Manager available, you have to simulate such a way.

Virtual machine and host file exchange method (the virtual machine specified in the following text is QEMU)

One, the host machine installs FTP service, you can use bftpd, this comparison is simple and fast, the installation is complete After the configuration file is in /etc/bftpd.conf, one of the configuration files is located when the ftp is accessed, and is located in the "home directory", so if your login user name on the host is host, then Add the user configuration of the configuration file:

user host {

ANONYMOUS_USER=”yes”

}

Of course, the user can also access the need Password, this can be set by yourself, after this setting, when logging in from the virtual machine ftp, the access directory will be your “home directory” on the host.

Second, virtual machine side ftp software, you can use lftp, install it, not used for any settings.

3. QEMU provides a fixed IP as the communication between the host and the virtual machine, 10.0.2.2. Therefore, when file exchange is required, as long as:

lftp 10.0. 2.2 -u host

After using the ls command, you can see that the file in the example is the file under the host's "home directory", and you can use the put or get command to exchange files.

Copyright © Windows knowledge All Rights Reserved