BACK

Installing/Configuring Samba 2.0.9

This Page covers installing samba-2.0.9 and is dividied into five parts. 2.0.9 was the latest version of the 2.0 series when this page was created on 03 JUN 01 (it is a security update fix for 2.0.8), 2.2.0 is out at this time and compiles the same, the only significant changes would be to the smb.conf file as it has better support for being a PDC for windows clients.

  1. Compiling the source
  2. Configuring smb.conf
  3. Starting Samba
  4. Setting up SWAT
  5. SMBMOUNT
  1. Compiling Samba
    1. As usual obtain the source from samba.org or a mirror site first.
    2. Save the source in a convenient directory, I made a directory called samba in my user's home directory to hold the source.
         suse:~ # mkdir samba
         suse:~ # cd samba
         suse:~/samba/ #   
      
    3. Decompress and untar the source
         suse:~/samba/ # tar zxvf samba-2.0.9.tar.gz
      
    4. Change to the {$source}/source directory
         suse:~/samba # cd samba-2.0.9/source
         suse:~/samba/samba-2.0.9/source #
      
    5. Run the ./configure script with options if needed, neither of the options I used are necessary to install Samba. I used --with-smbmount to be able to mount windoze shares on my Linux box and the --prefix=/usr/local/samba is the default location for Samba to be installed anyway so it can be omitted.
       suse:~/samba/samba-2.0.9/source # ./configure --with-smbmount --prefix=/usr/local/samba
      
    6. Run make to compile the source into binaries
         suse:~/samba/samba-2.0.9/source # make
      
    7. Run make install to install the system binaries, man pages, etc. If you're installing in the same location as a previous install of Samba then all the old binaries will have .old extensions. You must be root to run make install and install the binaries.
         suse:~/samba/samba-2.0.9/source # su root
         password:
         suse:~/samba/samba-2.0.9/source # make install
      
    8. If the compile and install executed without a problem, you can now restart Samba if you already had it installed else you will have to create a file called smb.conf
    9. Back To Top
  2. Configuring smb.conf
    1. The smb.conf file is located in {$INSTALL_LOCATION}/lib/smb.conf and is not created when you install samba from source. Below is the command to copy the sample smb.conf file located in the {$source}/examples directory to the needed directory for Samba.
         suse:~/samba/samba-2.0.9/examples # cp smb.conf.default /usr/local/samba/lib/smb.conf
      
    2. You of course will have to edit the file to suit your needs or use the example below for a basic smb.conf to get you started.
         suse:~ # cd /usr/local/samba/lib
         suse:/usr/local/samba/lib # vi smb.conf
      
    3. A basic smb.conf file
         # Basic Samba configuration file
         # Created 03 JUN 01 
         [global]
            workgroup =  WORKGROUP1 
            comment = My Samba Server %v
            netbios name = SUSE 
      
         [homes]
            comment = Home
            browseable = no
            read only = no
            create mode = 0750
      
         [share]
            path = /share
            browseable = yes
            writable = yes
      
         [cdrom]
            comment = Linux CD-ROM
            path = /cdrom
            read only = yes
            locking = no
         # End configuration file   
      
      If the /share and /cdrom directories don't exist, you will have to create them and apply the correct permissions, I'm using full permissions (777) for testing purposes only. You will have to mount a CDROM before it can be shared and viewed by clients.
         suse/ # mkdir /share
         suse/ # chmod 777 /share
         
         suse/ # mount /cdrom
      
    4. Restart the server using one of the steps from the next section
    5. Samba server as seen in network neighborhood from a windoze 98 client
    6. Listing of the shares on Samba server as seen in network neighborhood from a windoze 98 client
    7. Back To Top
  3. Starting Samba
    (re)starting Samba, you have several options
    1. Use an existing script if Samba was previously installed in the same location, otherwise edit the script accordingly.
         suse:~ # /etc/rc.d/smb restart
      
    2. Start the Daemons from the Command Line.
         suse:~ # /usr/local/samba/bin/smbd -D
         suse:~ # /usr/local/samba/bin/nmbd -D
      
    3. If Samba was previously installed in the same location and starts automatically, you can simply reboot.
         suse:~ # /sbin/shutdown -r now
      
    4. If you need a script copy the following lines into a file called samba in the /etc/rc.d directory. And execute it explicitly from the command line (suse:~ #/etc/rc.d/samba).
         #!/bin/sh
         #Script for starting Samba 2.0.9
         #Created 03 JUN 01
      
         if [ -x /usr/local/samba/bin/smbd]; then
         echo -n " Starting Samba 2.0.9 "
            /usr/local/samba/bin/smbd -D
            /usr/local/samba/bin/nmbd -D
         fi
      
         #End of Script
      
    5. If you want to kill the Daemon manually use the following commands to first get the pids and then kill them.
         suse:~ # ps x | grep smbd
         9220 ?        S      0:00 /usr/local/samba/bin/smbd -D
         suse:~ # ps x | grep nmbd
         9216 ?        S      0:00 /usr/local/samba/bin/nmbd -D
         suse:~ #kill -9 9220
         suse:~ #kill -9 9216
      
    6. Back To Top
  4. Setting up the Samba Web Administration Tool.
    1. First edit the /etc/services file to add a line for the swat TCP port.
         suse:~ # vi /etc/services
      
      Add    swat      901/tcp       # Swat port
                             [file clipped for brevity]
      klogin          543/tcp                         # Kerberized `rlogin' (v5)
      kshell          544/tcp                         # Kerberized `rsh' (v5)
      kerberos-adm    749/tcp                         # Kerberos `kadmin' (v5)
      #
      webster         765/tcp                         # Network dictionary
      webster         765/udp
      swat            901/tcp                         # Swat port 
      
      ingreslock      1524/tcp
      ingreslock      1524/udp
                             [file clipped for brevity]
      
    2. Edit the /etc/inetd.conf file, and look for a reference to swat.
         suse:~ # vi /etc/inetd.conf
      
      Edit inetd.conf to use the newer version of swat.
                             [file clipped for brevity]
      # swat is the Samba Web Administration Tool
       swat   stream  tcp     nowait.400      root    /usr/local/samba/bin/swat       swat
      #
                             [file clipped for brevity]
      
    3. Connecting to swat
      Location Path in Browser
      Localhost http://localhost:901
      Remote host (with DNS) http://{Fully Qualified Domain Name}:901/
      Remote host (no DNS) http://{IP address}:901/
    4. When you connect you will be prompted with a verification box. Enter a valid user/password to access the swat web pages.
    5. Back To Top
  5. SMBMOUNT
    1. First you need to make sure that you have the smbfs supported in your kernel. If you haven't done it in a while, you might as well update your kernel while you're at it.
    2. Mounting a windows share with smbmount
      Syntax
         suse/ # smbmount //Windows_Computer/Share_Name  /Local_Mount_Point   -U Usernaem
      
      Example


BACK