Try a lot of methods, the final choice to SSH remote login in the QEMU simulator to access the host, and SSHFS mount the host side of the file to the emulator, the emulator to access the host side of the code.
SSH sub-client openssh-client and Openssh-server
If you just want to log on to another machine SSH only need to install Openssh-client (Ubuntu has default installation, if not then sudo
Apt-get install openssh-client), if you want the native SSH service to be installed Openssh-server
sudo apt-get install Openssh-server
Here we install Openssh-server on the Ubuntu host side and install Openshh-client on the QEMU emulator side.
Then, on the host side, confirm that the Sshserver is started:
Ps-e |grep SSH
If you see sshd that means Ssh-server has been activated.
If not, you can start this way: sudo/etc/init.d/ssh start or service ssh start
The Ssh-server configuration file is located in/etc/ssh/sshd_config, where you can define the service port for SSH, the default port is 22, and you can define it yourself as a different port number, such as 222.
Then restart the SSH service:
Sudo
/etc/init.d/ssh stop
Sudo/etc/init.d/ssh start
Then use the following method to log in to SSH:
SSH [email protected] username for users on 192.168.1.112 machine, need to enter login password
But we can not use this IP address in the QEMU simulator, but instead change to 10.0.2.2, which is SSH [email protected], then enter the password
At this time the terminal in the simulator will prompt "Welcome to ..." to indicate that the login is successful and can access all directories in the remote. But our simulator has only one window, can only access the host side of the content, and can not copy the host side of the content, the following is how to copy the host side of the emulator side of the content, there are two ways
Execute exit to exit SSH login first.
1. SCP [email protected]:/home/username/work/training/test/test2.cpp./Copy the host-side test2.cpp to the current folder. And the second method is more convenient.
2. Install SSFS on the QEMU emulator side "Apt-get Install SSHFS", which is used to mount the contents of the host side to be accessed as a local folder, and then execute:
Create a new folder in the current directory mnt as the location of Mount, mkdir mnt
then SSHFS [email protected]:/home/test/./mnt/
After the password is entered successfully, the host-side/home/test/directory is attached to the./mnt/directory in the QEMU emulator and can be accessed directly as a local file.
Exit Mount execution: Fusermount-u./MNT (This is the path of MNT), then cancel the hang at this time with ls-l view found no files.
QEMU Mipis remote sharing of Ubuntu host files