11.6 Sharing Files between Linux Computers

The following sections feature various methods for sharing data. Use one of these if you are looking for a permanent solution for data sharing.

11.6.1 Transferring Files with NFS

To configure the server, proceed as follows:

  1. Prepare the system:

    1. Open a shell, log in as root, and grant write permissions to all users:

      mkdir /srv/nfs
      chgrp users /srv/nfs
      chmod g+w /srv/nfs
    2. Make sure that your user name and user ID is known on the client as well as on the server. Refer to Section 5.0, Managing Users with YaST for detailed instructions about how to create and manage user accounts.

  2. Prepare the NFS server:

    1. Start YaST as root.

    2. Select Network Services > NFS Server.

    3. Enable NFS services with Start.

    4. Open the appropriate firewall port with Open Port in Firewall if you are using a firewall.

  3. Export the directories:

    1. Click Add directory and select /srv/nfs.

    2. Set the export options to:

      rw,root_squash,async
    3. Repeat these steps, if you need to export more than one directory.

  4. Apply your settings and leave YaST. Your NFS server is ready to use.

To manually start the NFS server, enter rcnfsserver start as root. To stop the server, enter rcnfsserver stop. By default, YaST takes care of starting this service at boot time.

To configure the client, proceed as follows:

  1. Prepare the NFS client:

    1. Start YaST as root.

    2. Select Network Services > NFS Client.

    3. Activate Open Port in Firewall if using a firewall.

  2. Import the remote file system:

    1. Click Add.

    2. Enter the name or IP address of the NFS server or click Choose to automatically scan the network for NFS servers.

    3. Enter the name of your remote file system or automatically choose it with Select.

    4. Enter an appropriate mount point, for example /mnt.

    5. Repeat these steps, if you need to import more than one external directory.

  3. Apply your settings and leave YaST. Your NFS client is ready to use.

To start the NFS client manually, enter rcnfs start.

NOTE: Consistent User Names

If your home network is used by just a small number of users, set up identical users manually on all machines. If, however, you need a larger consistent user base across a larger home network, consider using NIS or LDAP to manage user data. For further information, refer to Section 25.0, Using NIS, (↑ Reference ) and Section 26.0, LDAP—A Directory Service, (↑ Reference ).

11.6.2 Sharing Files with Samba

This sections introduces various methods to access files on a Samba server. Both KDE and GNOME ship with graphical tools for working with Samba shares. There is also a command line tool for accessing Samba servers.

Accessing Shares with KDE and GNOME

Both the KDE and GNOME desktops can access Samba shares through their file browsers. To access your share, proceed as follows:

  1. Press Alt+F2 and enter smb://jupiter.example.com/share.

    The syntax of this URL is smb://HOST/SHARENAME with HOST representing the hostname (jupiter.example.com) or IP address and SHARENAME representing the share. See Step 3.b.

  2. Log in with the username and password. The password is set in Step 4 or just hit Enter if no password is needed.

  3. Drag and drop any files or directories from or to your window.

If you do not know your workgroup, enter smb:/ to list all workgroups available in your network. The Smb4K tool (package smb4k) can also be used to display all workgroups in your network and mount them on demand.

Accessing Shares from the Command Line

If you prefer using the command line, use the smbclient command. To log in to your Samba server, run:

smbclient //jupiter/share -U tux

Omit the -U option if you are the current user tux. After logging in successfully, use some basic commands like ls (list contents), mkdir (create directory), get (download file), and put (upload file). Use help to display all commands. Refer to the manual page of smbclient for more information.