1 This is a short description of how to debug printing problems with
2 Samba. This describes how to debug problems with printing from a SMB
3 client to a Samba server, not the other way around. For the reverse
4 see the examples/printing directory.
6 Please send enhancements to this file to samba-bugs@samba.anu.edu.au
8 Ok, so you want to print to a Samba server from your PC. The first
9 thing you need to understand is that Samba does not actually do any
10 printing itself, it just acts as a middleman between your PC client
11 and your Unix printing subsystem. Samba receives the file from the PC
12 then passes the file to a external "print command". What print command
15 The whole things is controlled using options in smb.conf. The most
16 relevant options (which you should look up in the smb.conf man page)
22 Samba should set reasonable defaults for these depending on your
23 system type, but it isn't clairvoyant. It is not uncommon that you
24 have to tweak these for local conditions.
26 On my system I use the following settings:
28 print command = lpr -r -P%p %s
29 lpq command = lpq -P%p
30 lprm command = lprm -P%p %j
32 The % bits are "macros" that get dynamically replaced with variables
33 when they are used. The %s gets replaced with the name of the spool
34 file that Samba creates and the %p gets replaced with the name of the
35 printer. The %j gets replaced with the "job number" which comes from
38 When I'm debugging printing problems I often replace these command
39 with pointers to shell scripts that record the arguments, and the
40 contents of the print file. A simple example of this kind of things
43 print command = cp %s /tmp/tmp.print
45 then you print a file and look at the /tmp/tmp.print file to see what
46 is produced. Try printing this file with lpr. Does it work? If not
47 then your problem with with your lpr system, not with Samba. Often
48 people have problems with their /etc/printcap file or permissions on
51 Another common problem is that /dev/null is not world writeable. Yes,
52 amazing as it may seem, some systems make /dev/null only writeable by
53 root. Samba uses /dev/null as a place to discard output from external
54 commands like the "print command" so if /dev/null is not writeable
55 then nothing will work.
57 Other really common problems:
59 - lpr isn't in the search path when Samba tries to run it. Fix this by
60 using the full path name in the "print command"
62 - the user that the PC is trying to print as doesn't have permission
63 to print. Fix your lpr system.
65 - you get an extra blank page of output. Fix this in your lpr system,
66 probably by editing /etc/printcap
68 - you get raw postscript instead of nice graphics on the output. Fix
69 this either by using a "print command" that cleans up the file before
70 sending it to lpr or by using the "postscript" option in smb.conf.
72 Note that you can do some pretty magic things by using your
73 imagination with the "print command" option and some shell
74 scripts. Doing print accounting is easy by passing the %U option to a
75 print command shell script. You could even make the print command
76 detect the type of output and its size and send it to an appropriate
79 If the above debug tips don't help, then maybe you need to bring in
80 the bug gun, system tracing. See Tracing.txt in this directory.