centos - Why can't I create a soft link in Oracle VirtualBox from my Macbook Pro?

07
2014-07
  • Saqib Ali

    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 [email protected] -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

  • Answers
  • davidbaumann

    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
  • ssice

    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.


  • Related Question

    osx - Why can't I route to some sites from my MacBook Pro that I can see from my iPad?
  • Robert Atkins

    Possible Duplicate:
    Mac OS X traceroute not even reaching router gateway

    I am on M1 Cable (residential) broadband in Singapore.

    I have an intermittent problem routing to some sites from my MacBook Pro—often Google-related sites (arduino.googlecode.com and ajax.googleapis.com right now, but sometimes even gmail.com.) This prevents StackExchange chat from working, for instance. Funny thing is, my iPad can route to those sites and they're on the same wireless network! I can ping the sites, but not traceroute to them which I find odd.

    That I can get through via the iPad implies the problem is with the MBP. In any case, calling M1 support is... not helpful.

    I get the same behaviour when I bypass the Airport Express entirely and plug the MBP directly into the cable modem. Can anybody explain a) how this is even possible and b) how to fix it?

    mella:~ ratkins$ ping ajax.googleapis.com
    PING googleapis.l.google.com (209.85.132.95): 56 data bytes
    64 bytes from 209.85.132.95: icmp_seq=0 ttl=50 time=11.488 ms
    64 bytes from 209.85.132.95: icmp_seq=1 ttl=53 time=13.012 ms
    64 bytes from 209.85.132.95: icmp_seq=2 ttl=53 time=13.048 ms
    ^C
    --- googleapis.l.google.com ping statistics ---
    3 packets transmitted, 3 packets received, 0.0% packet loss
    round-trip min/avg/max/stddev = 11.488/12.516/13.048/0.727 ms
    mella:~ ratkins$ traceroute ajax.googleapis.com
    traceroute to googleapis.l.google.com (209.85.132.95), 64 hops max, 52 byte packets
    traceroute: sendto: No route to host
     1 traceroute: wrote googleapis.l.google.com 52 chars, ret=-1
     *traceroute: sendto: No route to host
    traceroute: wrote googleapis.l.google.com 52 chars, ret=-1
    ^C
    mella:~ ratkins$
    

    The traceroute from the iPad goes (and I'm copying this by hand):

    10.0.1.1
    119.56.34.1
    172.20.8.222
    172.31.253.11
    202.65.245.1
    202.65.245.142
    209.85.243.156
    72.14.233.145
    209.85.132.82
    

    From the MBP, I can't traceroute to any of the IPs from 172.20.8.222 onwards.


  • Related Answers
  • RedGrittyBrick

    Firstly, the traceroute: sendto: No route to host message is your primary clue. Your MacBook Pro's network configuration isn't fully functional. Perhaps the MacBook is configured with some static settings that overide the settings that are obtainable by DHCP from your cable broadband modem or router?

    Secondly MacBooks and iPads run different operating systems. It is possible that this has some bearing on the problem. Either in the way these devices pick up wireless settings or in the way tracert/traceroute work (normally they use ICMP protocol but some variants use TCP - it is possible that ICMP is blocked at some router/firewall)

    On the Macbook Pro, can you get it to display it's network settings - chiefly default gateway and DNS servers? E.g. ifconfig -a

    If you can see the equivalent informatio on the iPad - look for differences.

  • Robert Atkins

    Turns out this was the answer (tl;dr, nuke Peerguardian from orbit.)