Linux study notes (1) - Mounting shared folders in virtual machines

The current document is based on the kali system. Other systems may be slightly different, but the steps are the same.

vmtool is necessary. You can install it yourself after installing the virtual machine.

1. Create a new shared folder in the virtual machine, as shown in the figure after completion

The second step is to start the virtual machine and check whether the shared folder can be found.

Use the command: vmware-hgfsclient

As shown in the picture, you can see that the shared directory of the host machine has been identified.

In my screenshot, /mnt/share/linux has been entered . This is because I have mounted it once before and tested it. This does not need to be the same.

 The third step is to create a folder in Linux for mounting. I built a share, which is not under root permissions. You need to add sudo.

Create a new directory command: sudo mkdir /mnt/share

View directory command: ls /mnt

As shown in the picture, you can see that the directory has been created, and share is the name of my new directory.

The fourth step is to mount the host's linux to the linux share

Instructions to use: sudo vmhgfs-fuse .host:/ linux  /mnt/share -o subtype=vmhgfs-fuse,allow_other 

In the command, linux is the mount name. If not entered, all shared directories will be mounted.

As shown in the picture, if there is no error, it means the mounting is successful.

The fifth step is to create a file on the host machine and look at it in LINUX.

This is the new test.txt created in windows

This is the file seen in linux

The shared directory has been mounted successfully, but it is only temporarily mounted. After restarting, it will become invalid. We add it to the virtual hard disk table and it will be automatically mounted at boot.

Edit using command: sudo vim /etc/fstab

If you don’t have VIM installed, you can also use VI.

  

Enter the second line of content as shown above. There is a . (dot) at the front and cannot be lost. Please note that there is a: (semicolon) after the host.

.host:/linux /mnt/share  fuse.vmhgfs-fuse allow_other 0 0

 After completion, press ESC, then enter: wq, exit vim, the shared directory is completed, restart the virtual machine to verify

I did not enter the semicolon, which caused the mounting path to be incorrect and kali could not be started. Therefore, the repair process for the inability to start is attached below.

 Based on the Debian system, you can modify it like this. When you enter the startup option, you will enter the startup item. Press e on the startup item to enter the startup modification menu.

 

In the linux line, add at the endrw init=/bin/bash

 

Then press F10 to enter the bash interface , modify fstab, and the system can be restarted.

 

 This is the learning process of simply mounting a shared directory in kali.

 

 

 

Guess you like

Origin blog.csdn.net/yghq008/article/details/131620739
Recommended