Samba Setup


After reading various guides and PDF's and manuals, I've found that there is really no simple setup guide for Samba.

This guide is an attempt to setup a few basic Samba shares.
Also, I could never get that pesky [X] Reconnect At Login option to work in Windows.
After severeal hours of evaluating the problem I figured out how.

Note: This document assumes you have Samba installed.


Instructions


Step 1 of 4 - We must setup /etc/samba/smb.conf


[global]
        # We want the workgroup set to WORKGROUP.
        workgroup = WORKGROUP
        # Set the server string to describe the machine. (%h is the $HOSTNAME of the computer)
        server string = %h - Pentium III 866MHZ
        # Set the security to user.
        security = user
        # Make sure encrypt passwords is on!
        encrypt passwords = yes
        # Increase overall throughput of samba.
        socket options = IPTOS_LOWDELAY TCP_NODELAY

[war]
   comment        = war
   path           = /home/war
   browseable     = yes
   writeable      = yes
   create mask    = 777
   read only      = no
   valid users    = war
   admin users    = war
   write list     = @staff
   directory mode = 777

[source]
   comment        = Kernel Source Tree
   path           = /usr/src/linux
   browseable     = yes
   writeable      = yes
   create mask    = 777
   read only      = no
   valid users    = war
   admin users    = war
   write list     = @staff
   directory mode = 777


Setup 2 of 4 - Create a password as root for the user(s) you wish to login for.


Note: The login and password must match the ones you have set on your Windows machine.
Also the user must be a valid user, meaning, they're in /etc/passwd.
What's the purpose for this step? It adds your password to Samba's passwd file.
Therefore when you try and login, the remote host will check the passwd file
and check to see if what it has matches what's inside the password file.

[root@war root]# smbpasswd -a war
New SMB password:
Retype new SMB password:
[root@war root]#


Step 3 of 4 - Make sure you have the following entires in your /etc/services file.


$ cat /etc/services | egrep '(137|139)'
netbios-ns      137/tcp                         # NETBIOS Name Service
netbios-ns      137/udp
netbios-ssn     139/tcp                         # NETBIOS session service
netbios-ssn     139/udp


Step 4 of 4 - Setup inetd or xinetd.


For inetd users, simply add these two lines in your /etc/inetd.conf.
netbios-ssn stream tcp  nowait  root    /usr/sbin/smbd smbd
netbios-ns   dgram udp  wait    root    /usr/sbin/nmbd nmbd

# Kill any old instances of Samba, and restart inetd.
killall -9 smbd nmbd
killall -HUP inetd


For xinetd users, we'll make two files in /etc/xinetd.d.
Note: When you copy and paste the lines below, they should look okay.

# This is file /etc/xinetd.d/netbios-ns
service netbios-ns
{
   disable = no
   port           = 137
   socket_type    = dgram
   protocol       = udp
   wait           = yes
   user           = root
   server         = /usr/sbin/nmbd
   server_args    = nmbd
}

# This is file /etc/xinetd.d/netbios-ssn
service netbios-ssn
{
   disable = no
   port           = 139
   socket_type    = stream
   protocol       = tcp
   wait           = no
   user           = root
   server         = /usr/sbin/smbd
   server_args    = smbd
}
 

# Kill any old instances of Samba, and enable Samba.
killall -9 smbd nmbd
# Turn it on.
chkconfig netbios-ns on
chkconfig netbios-ssn on


You're done!  Try and mount the shares you have created with Windows.
You can also run a quick check with the following:

smbclient -L 127.0.0.1

 
$ smbclient -L 127.0.0.1
added interface ip=192.168.168.12 bcast=192.168.168.255 nmask=255.255.255.0
Password:
Domain=[WORKGROUP] OS=[Unix] Server=[Samba 2.2.3a]

        Sharename      Type      Comment
        ---------      ----      -------
        war            Disk      war
        source          Disk      Kernel Source Tree
        IPC$           IPC       IPC Service (war - Pentium III 866MHZ)
        ADMIN$         Disk      IPC Service (war - Pentium III 866MHZ)

        Server               Comment
        ---------            -------
        WAR                  war - Pentium III 866MHZ
$


Problems?

If you had the Windows 2000 Plain Password registry entry installed, you must uninstall it using regedit in windows.
Rebooting is not necessary after deleting the registry entry.

Questions or comments?
<war@starband.net>