11.7. Sharing Files between Linux and Windows with Samba

Samba is the first choice for transferring files between Windows and Linux machines. These are the most common use cases for Samba:

Transferring Files from Linux to Windows

Do not configure a Linux server. Use the smb:/ scheme. For more information, see Section 11.6.2.1, “Accessing Shares with KDE and GNOME”. Make sure your workgroup is identical on both systems and that your directories are shared.

Transferring Files from Windows to Linux

Configure a Samba server on your Linux computer, see Setting up a Samba Server.

Transferring Files Between Linux and Windows

Configure a Samba server. See Setting up a Samba Server.

[Tip]Use Ready-Made Registry Entries for Your Windows System

Some Windows versions (95, 98) require a small change in the registry. Simplify this step by installing the samba-doc package and installing the appropriate registry file from /usr/share/doc/packages/samba/registry.

Procedure 11.2. Setting up a Samba Server

To set up a Samba server, do the following:

  1. Prepare the Samba server:

    1. Start YaST as root.

    2. Install the samba package.

    3. Create a directory, for example /srv/share.

  2. Create the server configuration:

    1. Select Network Services+Samba Server.

    2. Select one of the workgroups or enter a new one, for example Penguin.

    3. Check Primary Domain Controller (PDC)

    4. Set During Boot, if the Samba service is to be started every time your computer is booted. Otherwise set Manually.

    5. Activate Open Port in Firewall, if you use a firewall.

  3. Create your Windows share:

    1. Change to the Shares tab and click Add.

    2. Enter a name and description. The Share Name is used for accessing the share from your clients. Share Description describes the purpose of the share.

    3. Select your path, for example /src/share.

    4. Proceed with OK.

    5. Activate Allow Users to Share Their Directories.

  4. Provide a password for all users that are allowed to use this service:

    smbpasswd -a tux

    For easier configuration, just hit Enter to leave the password empty. Take into account that the usernames on your Windows and Linux computers are probably different. Configuring a consistent user base for both Windows and Linux is beyond the scope of this document.

  5. Start the Samba server:

    rcnmb start
    rcsmb start

To check if everything has been successfully configured, enter:

smbclient -L localhost

After you hit Enter you should get something like the following:

Anonymous login successful
Domain=[PENGUIN] OS=[Unix] Server=[Samba 3.0.22-11-SUSE-CODE10]
        
    Sharename       Type      Comment
    ---------       ----      -------
    share           Disk      Shared directory
    netlogon        Disk      Network Logon Service
    IPC$            IPC       IPC Service (Samba 3.0.22-11-SUSE-CODE10)
    ADMIN$          IPC       IPC Service (Samba 3.0.22-11-SUSE-CODE10)
Anonymous login successful
Domain=[PENGUIN] OS=[Unix] Server=[Samba 3.0.22-11-SUSE-CODE10]
        
    Server               Comment
    ---------            -------
    SUSE-DESKTOP         Samba 3.0.22-11-SUSE-CODE10
        
    Workgroup            Master
    ---------            -------
    TUX-NET              sun