Here is how you can test printing from the Samba server. Let's assume the most complex case and use a guest account. First, run the Samba
testparm command on your configuration file that contains the print shares, as we did in Chapter 2,
Installing Samba on a Unix System. This will tell you if there are any syntactical problems with the configuration file. For example, here is what you would see if you left out the
path
configuration option in the previous example:
# testparm
Load smb config files from /usr/local/samba/lib/smb.conf
Processing configuration file "/usr/local/samba/lib/smb.conf"
Processing section "[global]"
Processing section "[homes]"
Processing section "[data]"
Processing section "[printers]"
No path in service printers - using /tmp
Loaded services file OK.
Press enter to see a dump of your service definitions
Global parameters:
load printers: Yes
printcap name: /etc/printcap
Default service parameters:
guest account: ftp
min print space: 0
print command: lpr -r -P%p %s
lpq command: lpq -P%p
lprm command: lprm -P%p %j
lppause command:
lpresume command:
Service parameters [printers]:
path: /tmp
print ok: Yes
read only: true
public: true
Second, try the command
testprns
printername
. This is a simple program that verifies that the specified printer is available in your
printcap file. If your
printcap file is not in the usual place, you can specify its full pathname as the second argument to the
testprns command:
# testprns lp /etc/printcap
Looking for printer lp in printcap file /etc/printcap
Printer name lp is valid.
Next, log on as the guest user, go to the spooling directory, and ensure that you can print using the same command that
testparm says Samba will use. As mentioned before, this will tell you if you need to change the guest account, as the default account may not be allowed to print.
Finally, print something to the Samba server via
smbclient
, and see if the following actions occur:
-
The job appears (briefly) in the Samba spool directory specified by the path.
-
The job shows up in your print systems spool directory.
-
The job disappears from the spool directory that Samba used.
If
smbclient cannot print, you can reset the
print
command
option to collect debugging information:
print command = /bin/cat %s >>/tmp/printlog; rm %s
or:
print command = echo "printed %s on %p" >>/tmp/printlog
A common problem with Samba printer configuration is forgetting to use the full pathnames for commands; simple commands often don't work because the guest account's PATH doesn't include them. Another frequent problem is not having the correct permissions on the spooling directory.
There is more information on debugging printers in the Samba documentation (
Printing.txt). In addition, the Unix print systems are covered in detail in AEleen Frisch's
Essential Systems Administration (published by O'Reilly).