tonywhitmore.co.uk  

      blog : gallery : wiki : articles : projects : shell scripts : wallpaper : cv : links :
 Project Homepage

Samba 3.0.2
Samba

Preparation

  1. Download the Samba source code from www.samba.org.
    • Visit www.samba.org and click on the link for your closest mirror.
    • Click on the link named "download".
    • Click on the link for the source code of the latest version of Samba. You will need the source code in .tar.gz format. The file is called samba-latest.tar.gz.
    • You will be asked to where you wish to save the file. Chose a safe place and make a note of it.
    • The download is about 10Mb and will take at least half an hour over a modem, but a lot less over a broadband connection.
    • If you are using a download accelerator program, it will save the file to your default download directory.
  2. Burn the file samba-latest.tar.gz to a CD. This page assumes that the subdirectory /apps is used for the .tar.gz file. The CD-ROM can be a multi-session disk.
    • Use your CD burning software to create an ISO9660 disc image with the file samba-latest.tar.gz in the /apps directory.
    • Burn the CD and verify the data stored on it.

Back to simple version

Booting

  1. Boot your Core Linux PC.
  2. Login as root. You will need to enter the password at the prompt.
    • Wait for the following text to appear:
      localhost login:
    • Type root and press Enter.
    • The screen will display this message:
      Password:
    • Enter the password for root that you set earlier.
    • You will be shown a prompt that looks like this:
      [~]#

Back to simple version

Extract the source

  1. Place the CD-R in the CD-ROM drive. Mount the CD-ROM drive under /mnt/cdrom.
    • At the prompt enter:
      mount /dev/hdb /mnt/cdrom
    • You will see the following line appear:
      mount: block device /dev/hdb is write-protected, mounting read-only
  2. Change to the /apps directory on the CD-R.
    • At the prompt enter:
      cd /mnt/cdrom/apps
    • The prompt will change to:
      [/mnt/cdrom/apps]#
  3. Copy the samba-latest.tar.gz file to the directory /usr/src.
    • At the prompt enter:
      cp samba-latest.tar.gz /usr/src
    • The system will not display a message if everything is OK.
  4. Change to the /usr/src directory and extract the source from the .tar.gz file.
    • At the prompt enter:
      cd /usr/src
    • The prompt will change to:
      [/usr/src]#
    • At the prompt enter:
      tar -zxvf samba-latest.tar.gz
    • A long stream of unzipping files and directories should scroll up the screen for about thirty seconds.

Back to simple version

Configure and compile Samba

  1. The .tar.gz file will have been decompressed to a directory called samba-x.x.x where x.x.x is the version number of the Samba source code. The version detailed here is Samba 3.0.2a. Change to the /usr/src/samba-3.0.2a/source directory.
    • At the prompt enter:
      cd samba-3.0.2a/source
    • The prompt will change to:
      [/usr/src/samba-3.0.2a/source]#
  2. Run the ./configure script.
    • At the prompt enter:
      ./configure
    • N.B. If you wish the software to be installed in a directory other than the default directory of /usr/local/samba then use the alternative command:
      ./configure --prefix=PREFIX
      where the word PREFIX is replaced by your alternative directory path.
    • A long stream of processes should scroll up the screen for about three mintues.
    • The script finishes with the line:
      config.status: creating include/config.h
  3. Run the make program.
    • At the prompt enter:
      make
    • A long stream of processes should scroll up the screen for about twenty mintues.
    • The program finishes with the line:
      Building plugin bin/CP437.so
  4. Run the make program with the argument install.
    • At the prompt enter:
      make install
    • A long stream of processes should scroll up the screen for about thirty seconds.
    • The program finishes with the lines:
      /usr/bin/ginstall -c /usr/src/samba-3.0.2a/source/include/libsmbclient.h //usr/local/samba/include

Back to simple version

Setting up Samba

  1. Change to the /usr/local/samba/lib directory.
    • At the prompt enter:
      cd /usr/local/samba/lib
    • The prompt will change to:
      [/usr/local/samba/lib]#
  2. Edit the smb.conf file.
    • At the prompt enter:
      nano smb.conf
    • The screen will show the contents of smb.conf with information about the file at the top and bottom of the screen. The file is empty.
    • Navigate the file using the arrow keys.
  3. Enter the text below as a basic Samba configuration. You may replace the value of the variable workgroup with your own workgroup name.
    [global]
       workgroup = SIMPLE
       netbios name = Core
       security = share
       guest ok = yes
       guest account = samba

    [test]
       path = /home/samba/test
       read only = no
  4. Save the file and exit the text editor.
    • Press Ctrl+x on the keyboard.
    • The contents of the white line at the bottom of the screen will change to read:
      Save modified buffer (ANSWERING "No" WILL DESTROY CHANGES) ?
    • Type y.
    • The contents of the white line at the bottom of the screen will change to read:
      File Name to write: smb.conf
    • Press Enter.
    • You will be returned to the system prompt.
  5. Create the directory /home/samba/test.
    • At the prompt enter:
      mkdir -p /home/samba/test
    • The system will not display a message if everything is OK.
  6. Change the access permissions of the /home/samba/test directory to 0777. Although this is an insecure state to leave a folder, this is only for the purposes of testing.
    • At the prompt enter:
      chmod 0777 /home/samba/test
    • The system will not display a message if everything is OK.
  7. Test the syntax of your smb.conf file using the testparm tool.
    • At the prompt enter:
      /usr/local/samba/bin/testparm
    • The following text will appear if the syntax of your smb.conf file is OK:
      Load smb config files from /usr/local/samba/lib/smb.conf
      Processing section "[test]"
      Loaded services file OK.
      Server role: ROLE_STANDALONE
      Press enter to see a dump of your service definition
      When you press enter a full list of the definitions with which Samba will run will scroll up the screen. This includes every setting which doesn't appear in the smb.conf file and so is left at the default value. After the listing is complete you are returned to the system prompt.
  8. Add the user samba.
    • At the prompt enter:
      useradd samba
    • The system will not display a message if everything is OK.

Back to simple version

Starting Samba

  1. Start the smbd and nmbd daemons with the argument -D.
    • At the prompt enter:
      /usr/local/samba/sbin/smbd -D
    • The system will not display a message if everything is OK.
    • At the prompt enter:
      /usr/local/samba/sbin/nmbd -D
    • The system will not display a message if everything is OK.

Back to simple version

Testing Samba

  1. At the prompt enter:
    /usr/local/samba/bin/smbclient -L Core
  2. The screen will display the following message:
    Password:
  3. At the prompt, enter your root password.
  4. The system will display the following message:
    Domain=[SIMPLE] OS=[Unix] Server=[Samba 3.0.2a]

         Sharename      Type     Comment
         ---------      ----     -------
         test           Disk
         IPC$           IPC      IPC Service (Samba 3.0.2a)
         ADMIN$         Disk     IPC Service (Samba 3.0.2a)

         Server             Comment
         ----------         -------
         CORE               Samba 3.0.2a

         Workgroup          Master
         ---------          -------
         SIMPLE             CORE
    There may be other machines listed under the Server section if you have other computers running SMB servers in the same workgroup as your Core Linux PC. Also, the master browser may be different from that listed in the Master section.
  5. Assuming you saw no error messages you have correctly installed and configured Samba. Try to access the Samba server using smbclient or another SMB application on your other PC.

Back to simple version

Stopping Samba

  1. Stop the Samba servers using kill and remove the PID files.
    • At the prompt enter:
      kill `cat /usr/local/samba/var/locks/smbd.pid`
    • The system will not display a message if everything is OK.
    • At the prompt enter:
      kill `cat /usr/local/samba/var/locks/nmbd.pid`
    • The system will not display a message if everything is OK.
    • At the prompt enter:
      rm /usr/local/samba/var/locks/smbd.pid
    • The system will display the following message:
      rm: remove `/usr/local/samba/var/locks/smbd.pid`?
    • Press y followed by Enter to delete the file.
    • The system will not display a message if everything is OK.
    • At the prompt enter:
      rm /usr/local/samba/var/locks/nmbd.pid
    • The system will display the following message:
      rm: remove `/usr/local/samba/var/locks/nmbd.pid`?
    • Press y followed by Enter to delete the file.
    • The system will not display a message if everything is OK.

Back to simple version

Automating Samba

  1. Append the following lines to the /etc/rc.d/rc.mu script:
    /usr/local/samba/sbin/smbd -D
    /usr/local/samba/sbin/nmbd -D
    You can also add comments and echoes for your own information.
    • At the prompt enter:
      nano /etc/rc.d/rc.mu
    • The screen will show the contents of /etc/rc.d/rc.mu with information about the file at the top and bottom of the screen.
    • Add the following text to the end of the file:
      # Start Samba
      /usr/local/samba/bin/smbd -D
      echo smbd Started
      /usr/local/samba/bin/nmbd -D
      echo nmbd Started
    • Save the file and exit the text editor.
      • Press Ctrl+x on the keyboard.
      • The contents of the white line at the bottom of the screen will change to read:
        Save modified buffer (ANSWERING "No" WILL DESTROY CHANGES) ?
      • Type y.
      • The contents of the white line at the bottom of the screen will change to read:
        File Name to write: /etc/rc.d/rc.mu
      • Press Enter.
      • You will be returned to the system prompt.
  2. Insert the following lines at the second line of the /etc/rc.d/rc.ha script:
    kill `cat /usr/local/samba/var/locks/smbd.pid`
    rm -f /usr/local/samba/var/locks/smbd.pid
    kill `cat /usr/local/samba/var/locks/nmbd.pid`
    rm -f /usr/local/samba/var/locks/nmbd.pid
    You can also add comments and echoes for your own information.
    • At the prompt enter:
      nano /etc/rc.d/rc.ha
    • The screen will show the contents of /etc/rc.d/rc.ha with information about the file at the top and bottom of the screen.
    • Insert the following text at the second line of the file:
      # Stop Samba
      kill `cat /usr/local/samba/var/locks/smbd.pid`
      rm -f /usr/local/samba/var/locks/smbd.pid
      echo smbd Stopped kill `cat /usr/local/samba/var/locks/nmbd.pid`
      rm -f /usr/local/samba/var/locks/nmbd.pid
      echo nmbd Stopped
    • Save the file and exit the text editor.
      • Press Ctrl+x on the keyboard.
      • The contents of the white line at the bottom of the screen will change to read:
        Save modified buffer (ANSWERING "No" WILL DESTROY CHANGES) ?
      • Type y.
      • The contents of the white line at the bottom of the screen will change to read:
        File Name to write: /etc/rc.d/rc.ha
      • Press Enter.
      • You will be returned to the system prompt.
  3. Reboot the system and check that Samba is running.
    • At the system prompt enter:
      shutdown -r now
    • Wait for the system to reboot.
    • As the system reboots, watch for any error messages.
    • Once the system has rebooted, try to access the Samba server using smbclient or another SMB application on your other PC.

Back to simple version

Creative Commons License
The text of this page is licensed under a Creative Commons License.


Valid CSS!     Valid HTML 4.0!     Valid RSS
Original design © For oswd.org by SquireCD