0

I have setup a VirtualBox (version 4.3.12) running on my MacBook Pro (OS X 10.9). This VirtualBox is running CentOS 6.5. I can successfully SSH from the Macbook to the CentOS VM by doing ssh saqib@127.0.0.1 -p 3005

Now I want to be able to access and edit the files on the (Guest) CentOS VM (under the /var/www directory) using the nice editors and tools I have installed natively on my (Host) MacBook. But I'm having trouble doing so.

I successfully followed the instructions here. Now I have a directory on the Guest OS called /mnt/my_share_name from which I can access files on the Host OS's file system. Great! But what I really need is the opposite. I want to be able to access files in the Guest OS's /var/www directory from the Host OS. How Can I do that?? I tried inserting a link in /mnt/my_share_name as shown below. But it didn't work.

# From the CentOS VirtualBox
% cd /mnt/my_share_name
% ls
% sudo touch me
me
5 sudo ln -s me you
ln: creating symbolic link `you': Read-only file system

It seems I'm not the only person that has had this problem. People have talked about it int he VirtualBox forums. What is the solution here? How to use native GUI tools on my Host OS to manipulate files on the Guest OS?

Just in case anyone is interested, here is a screenshot of my VirtualBox Manager application: Screenshot of my VirtualBox Manager

2
  • What does it have a "soft link" to do with accessing your files in a virtual machine from the host?
    – ssice
    Jun 16, 2014 at 15:31
  • Do you have any further questions or want to set something as solution? May 10, 2018 at 8:33

2 Answers 2

0

I would do it the way you will do it later, in production use.
Mostly it's best to use sftp, as it's supported by ssh, and ssh will be running anyways.
I guess you look for a client here

Advantages:

  • Runs anyway
  • Mostly very secure
  • Encryption
  • Clients for almost any platform
0
0

You can use a variety of choices for sharing your documents between host and VM.

I'd recommend you sshfs, which is a quite small userspace tool that runs only on the client, meaning that on your Mac (host) you just do:

mkdir /Volumes/guest_www
sshfs user@host:/var/www /Volumes/guest_www

And you're done. You can get it with homebrew on the Mac.

The client (which is the host in this case) installs this app and in the host (which is your vm in this case) just needs to have the SSH port open. FUSE does the rest.

Anyways, the problem can be reduced to use any filesharing tool as you'd normally use if it were a real machine and not a virtual one. To name a few, you can configure NFS, Samba and/or FTP to listen there.

For added convenience and security, you can add a second network card to your virtual machine in a host-only connection and configure the services to use that internal IP only to ensure those NFS/Samba exports are not propagated via your real adapter to the network.

3
  • sshfs -o debug -p 3005 saqib@localhost:/var/www /Volumes/guest_www the OSXFUSE file system is not available (-1) the OSXFUSE file system is not available (1) The SSH port is open on the Guest OS because I can ssh to it.
    – Saqib Ali
    Jun 17, 2014 at 4:08
  • Have you created the directory? (mkdir /Volumes/guest_www). The sshfs wrapper won't do it for you.
    – ssice
    Jun 17, 2014 at 9:42
  • This may be related: apple.stackexchange.com/questions/119360/…, in short, maybe osxfuse is not correctly installed. Try issuing brew info osxfuse and manually kext_load the fuse extension in the running kernel. See also medium.com/dev-tricks/…
    – ssice
    Jun 17, 2014 at 9:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.