Samba to create sharing folders between host and VM
環境 虛擬機:Virtual Box 主系統:Windows 10 子系統:Ubuntu 18.04 假設你網卡已經設定好且能在虛擬機利用主系統網路上網! 以下開始設定 Samba 共享資料夾! Part 1. 在子系統的 Ununtu 裡面 Step 1. 固定子系統的 IP ifconfig 找到 host-only 網路的那張網卡,設定固定 IP! 因為 host-only 預設網段是192.168.56.0, 因此 IP 設定上也要在同一個網段之下。 sudo gedit /etc/network/interfaces auto 網卡名稱 iface 網卡名稱 inet static address host-only網卡的IP netmask 255.255.255.0 network 192.168.56.0 reboot Step 2. 安裝與設定 Samba sudo apt-get install samba smbclien sudo gedit /etc/samba/smb.conf 加入以下設定 [Share] path = / public = yes writable = yes read only = no valid users = YOURNAME force create mode = 777 create mask = 0777 directory mask = 0777 delete readonly = yes guest ok = yes available = yes browseable = yes Step 3. 設定從 Windows 登入的密碼 sudo smbpasswd -a YOURNAME Step 4. 測試/etc/samba/smb.conf是否有問題 sudo testparm Step 5. 重啟Samba,使以上設定生效 sudo /etc/init.d/smbd restart
Part 2. 在主系統的 Windows Step 1. Ping 一下 Ubuntu ping host-only網卡的IP Step 2. 到本機點右鍵 連線到網路磁碟機,輸入 host-only網卡的IP 記得兩個勾勾都要勾哦! 讓它能用其他方式連線(程式自己會去找)
Last updated