← Previous Change
Next Change →
side by side
lines around each change
Show the changes in full context
White space changes
04/18/07 17:08:48 (
Added a howto on sharing files without VBox shared folders
= Sharing files between guest and host without VirtualBox shared folders =
With the OSE version of VirtualBox you will not be able to use the Shared Folder facility offered by the version delivered as binary.
This paper is also applicable for the binary version as another way of sharing folders between guest(s) and host.
In order to share folders you must use the “Host Interface” networking facility. This allows you to use network file systems as NFS which are available on UNIX systems such as for example Solaris, the various BSD incarnation and Linux. NFS has the advantage of being easy to configure and the disadvantage that possibly insecure services are necessary. If your guests are Microsoft products, you must install an NFS driver on them or use CIFS (Windows file sharing) which is implemented by samba on UNIX systems.
Another way of sharing folders is available on modern Linux systems under Gnome or KDE: you can use SSHFS, which uses the SSH protocol to simulate a file system. This is a more secure way.
== NFS ==
Configuration of NFS is very easy. On the host you must install an NFS server and stat it. You can declare the folders which are to be exported in the file /etc/exports.
# Syntax: <folder> <guest-IP-or-name>(<options>)
If you need to add another share or modify an existing share, you can use the exportfs utility.
exportfs -r # delete all exported folder
exportfs -a # add all folder from /etc/exports
exportfs 10.1.1.2:/var/exports # add only given folder for the client with IP
exportfs # show which folder are shared
On the guest, you have to insert the share into the file /etc/fstab. For example:
10.1.1.1:/var/exports /mnt/shared nfs user,noauto,rw 0 0
With this line the user can mount the directory /var/exports from the host owning the IP 10.1.1.1.
You can also mount the share automatically at boot time. In this case the fstab entry should be:
10.1.1.1:/var/exports /mnt/shared nfs rw,auto,rw 0 0
The permissions for the shared files and directory are based on the user ID. If the host is running Fedora Core for example and the guest Ubuntu, the standard user will not have the same UID and therefore bob on the host is not the same user as bob on the guest. In order to overcome this you must make sure that the user IDs on both systems are the same.
Note: NFS has no support for IPv6
== CIFS / SAMBA ==
You must install a samba server for this and start it after you have configured it. You must also create a password for the users which are allowed to connect to the share.
Most current Linux distributions have tools for configuring Samba so we will not show the code for this here.
Don't forgot to set the password for the users - if you don't do this, you will not be able to mount the shared folder.
Permissions are based on the user name and you will have read/write access to the directories and files if your samba server is set up correctly.
If your system has no built in support for mounting the shares directly, you can use the utility xsmbrowser in order to find shared folders and mount them.
== SSH / SSHSF ==
SSHFS (Secure SHell FileSystem) [http://en.wikipedia.org/wiki/SSHFS] is a FUSE (File System in Userspace) to implement a virtual file system which allows operations such as browsing, copying, editing, etc. from a file manager such as Konqueror (KDE) or Nautilus (GNOME). You only need a working ssh daemon on the host. Most modern Linux distribution are configured so that you need only start the ssh service for this to work out of the box. If there are problems you should look at the files /etc/hosts.deny which should contain a line:
sshd : 10.1.1.0/255.255.255.0
This allow connections from all hosts with an IP in the range 10.1.1.1 to 10.1.1.254 via ssh.
If your guest don't support sshfs by default you must install fuse and sshfs. After this job is done you can mount the file system automatically or on request - see the sshfs FAQ page [http://fuse.sourceforge.net/wiki/index.php/SshfsFaq].