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 with the SMB Scheme

In the easiest case you do not have to configure a Linux server. Use the smb:/ scheme. For more information, see Accessing Shares with KDE and GNOME. Make sure that your workgroup is identical on both systems and that your directories are shared.

Transferring Files from Windows to Linux Using a Server

Configure a Samba server on your Linux computer. See Setting Up a Samba Server.

HINT: Using Default Registry Entries for Your Windows System

Some Windows versions (95, 98) require a small change in the registry for enabling a different password authentication method. Simplify this step by installing the samba-doc package and copy the file /usr/share/doc/packages/samba/registry to your Windows drive. Start Windows and incorporate the changes by double-clicking on this file.

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 should be started every time your computer boots. 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              jupiter