VM Share Folder Broken? Web server Workaround
While utilizing a Kali VM to perform some testing, I was gathering my findings and realized that VMwareTools was not installed which prevented me from moving my testing results over to my host. A quick spot check led me to realize there was something wrong with VMware tools as it was not installed and I did not have the option to pull it into my VM. Rather than deal with Broadcom's mess they made with VMware, its links and documentation, I turned to a trick I used during my CEH Practical exam.
- Start a web server on the VM in the folder you wan to share
cd /path/to/your/files
Start Pythons built-in web server on a specific port
python3 -m http.server 8000
- Look Up The VM IP
ip addr
- Look for the inet address typically listed as eth0
- Access the Files on Host
On your host computer, open a browser and go to
http://<VM-IP>:<Port, examplehttp://192.168.1.10:8000
Possible Troubleshooting Steps
You may need to open ports on your Linux guest VM depending how it's configured. If using IP tables, try adding in the following rule
sudo iptables -A INPUT -p tcp --dport 8000 -j ACCEPT.I was having issues getting the URL to load in chrome, switching to Safari worked. It may have been a caching issue.
Another challenge I encountered was when trying to transfer my output.txt file from my VM to my host with drag n drop, the file inexplicably moved to a different location in the VM. Below are some steps used to discover and recover the file.
- System-wide Search
sudo find / -iname "output.txt" 2>/dev/null
If you know the name of the file you are looking for, this command searches the entire filesystem for the name, with -iname making the search case-insensitive. If a path is output from the command, that provides the location of the file and you can move it back to, say your desktop with: mv /tmp/somefolder/output.txt ~/Desktop/.
- Search Recently Modified Files
If there is no output from the first command, use the following to view recently modified files in the home directory. This will search for .txt files modified in the last 60 minutes, even if accidentally renamed.
find /home/John/ -type f -mmin -60 -name ".txt" 2>/dev/null