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-serveron your host system.ps aux | grep sshdshould return one line mentioning the running ssh daemon afterwards. - Install
sshfsin your guest operating system. - Change VirtualBox’s
Configuration > Network > Adapter 1fromAttached to: NATtoAttached to: Bridged Adapter.Name: wlan0works 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=33where 33 is the uid and gid of the user
www-data. In order to setallow_otherI had to uncomment the lineuser_allow_otherin/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!