VirtualBox

Changes between Initial Version and Version 1 of Sharing_files_on_OSE


Ignore:
Timestamp:
Apr 18, 2007 5:08:48 PM (18 years ago)
Author:
Michael Thayer
Comment:

Added a howto on sharing files without VBox shared folders

Legend:

Unmodified
Added
Removed
Modified
  • Sharing_files_on_OSE

    v1 v1  
     1= Sharing files between guest and host without VirtualBox shared folders =
     2
     3With the OSE version of VirtualBox you will not be able to use the Shared Folder facility offered by the version delivered as binary.
     4
     5This paper is also applicable for the binary version as another way of sharing folders between guest(s) and host.
     6
     7In 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.
     8
     9Another 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.
     10
     11== NFS ==
     12Configuration 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.
     13
     14{{{
     15# /etc/exports
     16# Syntax: <folder>  <guest-IP-or-name>(<options>)
     17/var/exports 10.1.1.2(rw,sync)
     18}}}
     19
     20If you need to add another share or modify an existing share, you can use the exportfs utility.
     21
     22{{{
     23exportfs -r                     # delete all exported folder
     24exportfs -a                     # add all folder from /etc/exports
     25exportfs 10.1.1.2:/var/exports  # add only given folder for the client with IP
     26                                # 10.1.1.2
     27exportfs                        # show which folder are shared
     28}}}
     29
     30On the guest, you have to insert the share into the file /etc/fstab.  For example:
     31
     32{{{
     3310.1.1.1:/var/exports  /mnt/shared nfs user,noauto,rw 0 0
     34}}}
     35
     36With this line the user can mount the directory /var/exports from the host owning the IP 10.1.1.1.
     37
     38You can also mount the share automatically at boot time. In this case the fstab entry should be:
     39
     40{{{
     4110.1.1.1:/var/exports  /mnt/shared nfs rw,auto,rw 0 0
     42}}}
     43
     44'''Permissions Problems'''
     45
     46The 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.
     47
     48Note: NFS has no support for IPv6
     49
     50== CIFS / SAMBA ==
     51
     52You 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.
     53
     54Most current Linux distributions have tools for configuring Samba so we will not show the code for this here.
     55
     56Don'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.
     57
     58Permissions 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.
     59
     60If 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.
     61
     62== SSH / SSHSF ==
     63
     64SSHFS (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:
     65
     66{{{
     67sshd : 10.1.1.0/255.255.255.0
     68}}}
     69
     70This allow connections from all hosts with an IP in the range 10.1.1.1 to 10.1.1.254 via ssh.
     71
     72If 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].

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette