Vmware virtual machine Ubuntu file sharing, shared clipboard and automatic mounting

Table of contents

Problem Description

solution

1. Shared clipboard

2. Shared folders

3. Solve the problem that the shared folder fails after restarting


Problem Description

Running a program in a virtual machine wants to transfer the source code to the host, and there are also some files that I want to transfer from the host to the virtual machine. After the board cutting problem, I was not satisfied with the status quo, so I searched for content related to file sharing. The following is a set of solutions.

New issue: Shared folders disappear after restarting the virtual machine

solution

1. Shared clipboard

Step 1: Install vmware tools

Enter the following command in the terminal

sudo apt install open-vm-tools

sudo apt install open-vm-tools-desktop

Step 2: Restart the virtual machine

Note: At this point, the problem of sharing the clipboard has been solved

2. Shared folders

Step 3: Right-click the virtual machine in My Computer on the left, and click "Settings"

9ccf4479837844608713642e71ac0d1a.png

Step 4: Pay attention to the yellow part marked in the figure, change folder sharing to "always enable", click Add

4781f36540444853b3b95133ac6be56e.png

Step 5: Click Next, enter the location and name of the shared folder on the host, click Next, and click Finish

2029ac16f1244d39aff947783d45854b.png

5aee52d9d3ca43ddb18e033e985be90f.png

 ba8e763d8b4f42f4b581d1f5cbcb3bd0.png

Step 6: Open the terminal and enter ln -s /mnt/hgfs/shared file name~/Desktop/desktop shortcut name

ln -s /mnt/hgfs/共享文件名 ~/Desktop/桌面快捷名称

Next, put the files you want to share into the host/virtual machine shared folder

Note: The file sharing path is located in /mnt/hgfs/ and can be viewed

3. Solve the problem that the shared folder fails after restarting

Step 1: Remount the folder, terminal input:

sudo vmhgfs-fuse .host:/ /mnt/hgfs/ -o allow_other

If you still have virtual machine shared folders under /mnt/hgfs, skip this step

Step 2: Automatically mount the folder

Terminal input:

sudo su
vi /etc/fstab

Enter the letter i to modify

Add the red horizontal line code:

.host:/ /mnt/hgfs fuse.vmhgfs-fuse allow_other,defaults 0 0

As shown in the figure above, click Esc and enter: wq

This problem is solved.

Guess you like

Origin blog.csdn.net/weixin_63505616/article/details/126202925