在Linux虛擬機中實現資源共享可以通過多種方法,以下是一些常見的方法:
sudo apt-get update
sudo apt-get install samba
/etc/samba/smb.conf,添加共享目錄和相關設置。sudo vim /etc/samba/smb.conf
在文件尾部添加如下內容:
[shared]
path = /path/to/shared/directory
available = yes
valid users = Linux用戶名
read only = no
browsable = yes
public = yes
writable = yes
sudo systemctl restart smbd
smbclient 或 mount.cifs 等命令訪問。sudo apt-get update
sudo apt-get install nfs-kernel-server
/etc/exports,添加需要共享的目錄和允許訪問的主機。/path/to/shared/directory *(rw,sync,no_subtree_check)
sudo systemctl restart nfs-kernel-server
sudo mount server_ip:/path/to/shared/directory /local/mount/point
sudo mkdir /mnt/share
sudo mount -t vboxsf 共享文件夾名稱 /mnt/share
sudo mkdir /mnt/share
sudo mount -t vmhgfs .host:/共享文件夾名稱 /mnt/share
以上就是在Linux虛擬機中實現資源共享的幾種方法。