DaveRaj
Contributor
Contributor

Sharing hidden folders in VMware Fusion

Jump to solution

Hi,

Has anyone managed to share a hidden folder (ie. a directory starting with a ".") in VMware Fusion? For example I want to share my ~/.ssh directory with my linux vm client.

When I try to add a folder in the gui it pops up a finder dialog box but doesn't display hidden folders. I can't find any option to show these folders. If not is there a command line tool that I will allow me to do this?

Cheers,

Dave

0 Kudos
1 Solution

Accepted Solutions
WoodyZ
Immortal
Immortal

Even if you expose Hidden Folders in Finder this will not enable you to see them in Virtual Machine > Settings... > Sharing nor will you be able to see them displayed by default in the Guest OS via "\\vmware-host\Shared Folders" unless you modify the settings to see hidden folders with the Guest OSes controls however here is a workaround.

Using your need to see the hidden ~/.ssh folder here is what I did.

The following was done with the target Virtual Machine shutdown from within the Guest OS, not suspended by VMware Fusion.

In my Home Folder I temporarily made a folder named: dotssh

In my Virtual Machine's Settings under Sharing I added a Shared Folder selecting the dotssh Folder and then closed VMware Fusion and then deleted the ~/dotssh folder.

Next I edited the Virtual Machine's .vmx configuration file.

When I added the dotssh Shared Folder it added several lines of parameters to the Virtual Machine's .vmx configuration file and two in particular that I then manually edited.

sharedFolder0.hostPath = "~/dotssh"
sharedFolder0.guestName = "dotssh"

I then changed them to:

sharedFolder0.hostPath = "~/.ssh"
sharedFolder0.guestName = ".ssh"

Next I opened VMware Fusion and started the Virtual Machine and once at the Windows Desktop I double-clicked the "VMware Shared Folders" shortcut and it opened Windows Explorer to "\\vmware-host\Shared Folders" and of course this folder appeared to be empty as I had no other normal folders shared nor was the Guest OS configured to show hidden folders however adding "\.ssh" to the "\\vmware-host\Shared Folders" in the Address bar enabled me to see the contents of the .ssh folder within my Home Folder on the Mac.

Next I made a new shortcut on the Desktop pointing to "\\vmware-host\Shared Folders\.ssh" to use instead of the default "VMware Shared Folders" shortcut however I could also enable seeing hidden folders from within the Guest OS and then would see the .ssh folder without typing anything into the Address bar or creating a new shortcut, it's your choice.

View solution in original post

0 Kudos
4 Replies
WoodyZ
Immortal
Immortal

Even if you expose Hidden Folders in Finder this will not enable you to see them in Virtual Machine > Settings... > Sharing nor will you be able to see them displayed by default in the Guest OS via "\\vmware-host\Shared Folders" unless you modify the settings to see hidden folders with the Guest OSes controls however here is a workaround.

Using your need to see the hidden ~/.ssh folder here is what I did.

The following was done with the target Virtual Machine shutdown from within the Guest OS, not suspended by VMware Fusion.

In my Home Folder I temporarily made a folder named: dotssh

In my Virtual Machine's Settings under Sharing I added a Shared Folder selecting the dotssh Folder and then closed VMware Fusion and then deleted the ~/dotssh folder.

Next I edited the Virtual Machine's .vmx configuration file.

When I added the dotssh Shared Folder it added several lines of parameters to the Virtual Machine's .vmx configuration file and two in particular that I then manually edited.

sharedFolder0.hostPath = "~/dotssh"
sharedFolder0.guestName = "dotssh"

I then changed them to:

sharedFolder0.hostPath = "~/.ssh"
sharedFolder0.guestName = ".ssh"

Next I opened VMware Fusion and started the Virtual Machine and once at the Windows Desktop I double-clicked the "VMware Shared Folders" shortcut and it opened Windows Explorer to "\\vmware-host\Shared Folders" and of course this folder appeared to be empty as I had no other normal folders shared nor was the Guest OS configured to show hidden folders however adding "\.ssh" to the "\\vmware-host\Shared Folders" in the Address bar enabled me to see the contents of the .ssh folder within my Home Folder on the Mac.

Next I made a new shortcut on the Desktop pointing to "\\vmware-host\Shared Folders\.ssh" to use instead of the default "VMware Shared Folders" shortcut however I could also enable seeing hidden folders from within the Guest OS and then would see the .ssh folder without typing anything into the Address bar or creating a new shortcut, it's your choice.

0 Kudos
DaveRaj
Contributor
Contributor

Thanks very much WoodyZ.

It's working perfectly now.

I didn't realise the vmx configuration file was just a text file; probably should have looked instead of wasting so much time searching google to see if someone else has had the same problem.

Anyway, thanks to your suggestions I simply added a bunch of new sharedFolderX entries. In the linux guest OS the shared folders appear (by default) under /mnt/hgfs. However using the mount command with the --bind option (which I think is linux specific) I simply re-mounted /mnt/hgfs/.ssh/ as ~/.ssh/. I use this re-mounting to "mirror" all my important directories: ~/Documents, ~/Public, ~/Downloads, ~/tmp ~/.ssh. Works very nicely Smiley Happy.

Cheers,

Dave

0 Kudos
Rasenderhase
Contributor
Contributor

You may also create a symbolic link:

ln -sf .ssh/ dot.ssh

And then add the symbolic link to the shared folders. Automatically the original folder (.ssh) will appear in the folder list and inside the VM.

0 Kudos
vmxmr
Expert
Expert

WoodyZ responded with a good answer. I would like to add a few notes of my own:

* You can expose any directory (folder) in the finder using the Terminal. The command is "open" and the pathname of the directory you want. Example:

open ~/.ssh will open the folder that DaveRaj wants.

* You can drag and drop the tiny folder icon at the top of the window into any Open or Save dialog box. It works even with those hidden folders.

* You can rename the share name in the Sharing setting in VMware. Just click on the name, wave the mouse on it to get an edit field, and change the name. The new name will appear in the virtual machine.

IMPORTANT - The tricks above are very useful to know for general use, but they did not work for me for VMware Sharing:

I tried the tricks above with a test folder (~/.testshared) and VMware Folder Sharing. It looked like it should have worked, but it did not work, and I cannot explain why. My .vmx file matches WoodyZ's edits (without editing it), but the shared folder does not appear in the guest virtual machine itself, even after rebooting the guest.

Here are the steps I performed that did not work as expected:

1. Created a ~/.testshared directory using Terminal

2. Created mytestfile.txt in the new .testshared directory, using cat > mytestfile.txt, typing a couple lines, and then CTRL-D.

3. Opened the ~/.testshared directory in Terminal using the command, "open ~/.testshared". The window opened in the Finder.

4. Opened mytestfile.txt by double-clicking it in the Finder. It displayed my text.

5. Opened the Sharing setting for one of my guest VMs.

6. Clicked the + sign, and added the share by dragging the tiny icon from the top of the .testshared window to the dialog box. Everything seemed to work okay. The new share appeared in the Sharing setting.

7. Tried to find the share in the guest VM. FAILED.

8. Renamed the share in Sharing setting to a name without a "."

9. Tried again. FAILED.

10. Rebooted guest VM. No change. FAILED.

11. Inspected the .vmx file in the guest VM. It matches WoodyZ's edits, so I cannot explain why my share did not appear.

0 Kudos