The host has a git repository /home/meisterluk/repo
and has VirtualBox
running a UNIX operating system. We want to provide the git repository as read-only folder to the guest. Test system as host and guest was xubuntu 14.04.
- Install
openssh-server
on your host system.ps aux | grep sshd
should return one line mentioning the running ssh daemon afterwards. - Install
sshfs
in your guest operating system. - Change VirtualBox’s
Configuration > Network > Adapter 1
fromAttached to: NAT
toAttached to: Bridged Adapter
.Name: wlan0
works for me because I am using the wlan0 device to connect to the internet. - Ask for the ip address of your host network device via
ip a
. For me this is192.168.1.112
. - Run
sshfs [host operating system username]@[IP address]:[repository path on host system] [mount point] -o allow_other,uid=33,gid=33
actually:sshfs meisterluk@192.168.1.112:/home/meisterluk/repo /var/www/html/repo -o allow_other,uid=33,gid=33
where 33 is the uid and gid of the user
www-data
. In order to setallow_other
I had to uncomment the lineuser_allow_other
in/etc/fuse.conf
.
If you savestate the VirtualBox instance and continue again, you need to remount it again (because apparently the SSH session stopped). You can always umount the sshfs using sudo fusermount -u /var/www/html/repo
.
Credits go to LSPE for his hints. Thanks!