我已經使用xdissent/ievms在我的Mac上的VirtualBox中設置了多個Windows客戶操作系統。如何將主機文件複製到VirtualBox中的Windows guest操作系統?
我想將條目添加到每個Windows VM的hosts
文件。我可以從Windows客戶機操作系統hosts
文件成功複製到我的Mac這樣的:
VBoxManage guestcontrol "IE9 - Win7" copyfrom "C:\\Windows\\system32\\drivers\\etc\\hosts" ~/Desktop/hosts --username IEUser --password Passw0rd\!
我的Mac上我也能成功添加條目使用echo -e "blah blah\r\n" >> hosts
複製的文件。
但是我無法將修改後的文件複製回Windows客戶機操作系統上的正確位置。我可以把它複製到Windows桌面,但如果我嘗試將它複製到正確的文件夾中,我得到:
VBoxManage guestcontrol "IE9 - Win7" copyto ~/Desktop/hosts "C:\\Windows\\system32\\drivers\\etc\\hosts" --username IEUser --password Passw0rd\! --verbose
Opening guest session as user 'IEUser' ...
Waiting for guest session to start ...
Guest session (ID 1) has been started
Copying from host to guest ...
Directory "." already exists
Source: /Users/andy/Desktop/hosts
Copying "/Users/andy/Desktop/hosts" to "./C:\Windows\system32\drivers\etc\hosts" ...
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...
Progress state: VBOX_E_IPRT_ERROR
VBoxManage: error: Copying file "/Users/andy/Desktop/hosts" failed with status 500, exit code 1.
VBoxManage: error: Error processing "/Users/andy/Desktop/hosts", rc=VERR_GENERAL_FAILURE
Closing guest session ...
接下來我試着動我成功複製到Windows桌面到正確的文件夾中的文件:
VBoxManage guestcontrol "IE9 - Win7" mv "/Documents and Settings/IEUser/Desktop/hosts" "/Windows/System32/drivers/etc/hosts2" --username IEUser --password Passw0rd\! --verbose
Opening guest session as user 'IEUser' ...
Waiting for guest session to start ...
Guest session (ID 1) has been started
Renaming 1 entry ...
Renaming file "/Documents and Settings/IEUser/Desktop/hosts" to "/Windows/System32/drivers/etc/hosts2" ...
VBoxManage: error: Renaming guest file failed: VERR_ACCESS_DENIED
VBoxManage: error: Details: code VBOX_E_IPRT_ERROR (0x80bb0005), component GuestSession, interface IGuestSession, callee nsISupports
VBoxManage: error: Context: "FileRename(Bstr(strCurSource).raw(), Bstr(strCurDest).raw(), ComSafeArrayAsInParam(aRenameFlags))" at line 3015 of file VBoxManageGuestCtrl.cpp
Warning: Not all sources were renamed
Closing guest session ...
線索似乎是VERR_ACCESS_DENIED
,即權限問題。
IEUser
用戶設置爲管理員,所以我不明白爲什麼它不能寫入etc
目錄。有任何想法嗎?
成功複製我只是想你的寶石(18個月後......) - 這是夢幻般的。它直接解決了我的問題。謝謝 :) – 2017-03-27 15:30:42