Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Samba HowTo Guide
Prev Home Next

Rapid Configuration Validation

Should you need to troubleshoot at any stage, please always come back to this point first and verify if testparm shows the parameters you expect. To give you a warning from personal experience, try to just comment out the load printers parameter. If your 2.2.x system behaves like mine, you'll see this:

root# grep "load printers" /etc/samba/smb.conf
        #  load printers = Yes
        # This setting is commented out!!
 
root# testparm -v /etc/samba/smb.conf | egrep "(load printers)"
        load printers = Yes

I assumed that commenting out of this setting should prevent Samba from publishing my printers, but it still did. It took some time to figure out the reason. But I am no longer fooled ... at least not by this.

root# 

grep -A1 "load printers" /etc/samba/smb.conf

        load printers = No
        # The above setting is what I want!
        #  load printers = Yes
        # This setting is commented out!

root# 

testparm -s -v smb.conf.simpleprinting | egrep "(load printers)"

        load printers = No

Only when the parameter is explicitly set to load printers = No would Samba conform with my intentions. So, my strong advice is:

  • Never rely on commented-out parameters.

  • Always set parameters explicitly as you intend them to behave.

  • Use testparm to uncover hidden settings that might not reflect your intentions.

The following is the most minimal configuration file:

root# 

cat /etc/samba/smb.conf-minimal

        [printers]

This example should show that you can use testparm to test any Samba configuration file. Actually, we encourage you not to change your working system (unless you know exactly what you are doing). Don't rely on the assumption that changes will only take effect after you restart smbd! This is not the case. Samba rereads it every 60 seconds and on each new client connection. You might have to face changes for your production clients that you didn't intend to apply. You will now note a few more interesting things; testparm is useful to identify what the Samba print configuration would be if you used this minimalistic configuration. Here is what you can expect to find:

root# 

testparm -v smb.conf-minimal | egrep "(print|lpq|spool|driver|ports|[)"

 Processing section "[printers]"
 WARNING: [printers] service MUST be printable!
 No path in service printers - using /tmp

        lpq cache time = 10
        load printers = Yes
        printcap name = /etc/printcap
        disable spoolss = No
        enumports command =
        addprinter command =
        deleteprinter command =
        show add printer wizard = Yes
        os2 driver map =
        printer admin =
        min print space = 0
        max print jobs = 1000
        printable = No
        printing = bsd
        print command = lpr -r -P%p %s
        lpq command = lpq -P%p
        printer name =
        use client driver = No

 [printers]
        printable = Yes

testparm issued two warnings:

  • We did not specify the [printers] section as printable.

  • We did not tell Samba which spool directory to use.

However, this was not fatal, and Samba will default to values that will work. Please, do not rely on this and do not use this example. This was included to encourage you to be careful to design and specify your setup to do precisely what you require. The outcome on your system may vary for some parameters given, since Samba may have been built with different compile-time options. Warning: do not put a comment sign at the end of a valid line. It will cause the parameter to be ignored (just as if you had put the comment sign at the front). At first I regarded this as a bug in my Samba versions. But the man page clearly says: Internal whitespace in a parameter value is retained verbatim. This means that a line consisting of, for example,

# This defines LPRng as the printing system
printing = lprng

will regard the whole of the string after the = sign as the value you want to define. This is an invalid value that will be ignored, and a default value will be used in its place.

Samba HowTo Guide
Prev Home Next

 
 
  Published under the terms fo the GNU General Public License Design by Interspire