Penguin
Blame: SambaPrinting
EditPageHistoryDiffInfoLikePages
Annotated edit history of SambaPrinting version 29, including all changes. View license author blame.
Rev Author # Line
24 CraigBox 1 !!! Setting up Samba 3.x and [CUPS]
16 JohnMcPherson 2
29 CraigBox 3 Your Samba binary needs to be linked against libcups. It will be in all modern distributions. To check this, run the following command and check that your output looks similar:
16 JohnMcPherson 4 <verbatim>
5 root# ldd `which smbd`
6 libldap.so.2 => /usr/lib/libldap.so.2 (0x4001b000)
7 libcom_err.so.2 => /lib/libcom_err.so.2 (0x400c3000)
8 libcups.so.2 => /usr/lib/libcups.so.2 (0x400c6000)
9 .....
10 </verbatim>
24 CraigBox 11
16 JohnMcPherson 12 The 'libcups.so.2' line is the important one. Yours might be slightly different - that's ok.
13
24 CraigBox 14 To configure Samba for printing, you need to make sure the following config options are set in the ~[global] section of /etc/samba/smb.conf:
16 JohnMcPherson 15
16 <verbatim>
17 load printers = yes
18 printing = cups
19 printcap name = cups
24 CraigBox 20 printer admin = root, @ntadmins
16 JohnMcPherson 21 </verbatim>
22
23 In the ~[printers] section, you should have something like the following:
24
25 <verbatim>
26 [printers]
27 comment = All Printers
28 path = /var/spool/samba
29 browseable = no
30 public = yes
31 guest ok = yes
32 writeable = no
33 printable = yes
34 </verbatim>
35
24 CraigBox 36 As long as your CUPS printers are set up, you can now set them up on your Windows clients and print to them via Samba. You might want to investigate uploading client drivers to Samba, using the Add Printer Wizard below.
22 CraigBox 37
38 Note: on Debian, you don't seem to get a /var/spool/samba by default. Create it, and set the permissions appropriately on it - so far I haven't found any evidence that you shouldn't use 777.
16 JohnMcPherson 39
24 CraigBox 40 !!Troubleshooting
16 JohnMcPherson 41
24 CraigBox 42 Do not, whatever you do, set your CUPS spool directory and your Samba printer spool directory to the same location. Printing via Samba to CUPS ''will not work ''if you do this!
16 JohnMcPherson 43
24 CraigBox 44 Your cups spool dir should be /var/spool/cups, and you samba printing spool dir should probably be /var/spool/samba.
16 JohnMcPherson 45
24 CraigBox 46 RedHat 9 users have reported needing to add the following 3 lines to the printer section of the smb.conf, to fixes a problem where the Windows clients can see the printer and connect to it, but not print to it or see the print queue. This is because CUPS apparently uses a slightly different syntax than the older [BSD]-based lp* programs.
16 JohnMcPherson 47
48 <verbatim>
49 print command = lpr -P %p -o raw %s -r
50 lpq command = lpstat -o %p
51 lprm command = cancel %p-%j
52 </verbatim>
24 CraigBox 53
25 CraigBox 54 -----
16 JohnMcPherson 55
56 !!!Drivers for Windows clients
57
28 CraigBox 58 There are a few ways you can arrage for your Samba server to automagically offer Windows drivers for the printers it shares. The best way is uploading them using Add Printer Wizard. Other methods are covered in the [Samba printing HOWTO|http://www.samba.org/samba/docs/man/Samba-HOWTO-Collection/classicalprinting.html#id2597921], which also coveres this information in detail.
59
24 CraigBox 60 !!Uploading drivers with the Add Printer Wizard
16 JohnMcPherson 61
24 CraigBox 62 Windows NT/2000/XP have an Add Printer Wizard. You can use this to add printer drivers to your (cunningly disguised) Samba 3 server.
16 JohnMcPherson 63
24 CraigBox 64 !Steps
16 JohnMcPherson 65
66 * Configure your smb.conf appropriately. You'll want to add a section that looks like this:
67
68 <verbatim>
24 CraigBox 69 [PRINT$]
70 path = /home/samba/printers
71 guest ok = yes
72 browseable = yes
73 read only = yes
25 CraigBox 74 write list = @wheel, user
75 admin users = @wheel, user
24 CraigBox 76 create mask = 0644
77 directory mask = 0755
16 JohnMcPherson 78 </verbatim>
79
25 CraigBox 80 The path can be anywhere, really. All that matters is that the permissions are set appropriately - the user you connect as should be able to write to the files. Try 777 if you really want to make sure.
81
82 Connect to \\server\print$. You will need to create directories here for drivers; <tt>W32X86</tt> is for NT/2000/XP, <tt>WIN40</tt> is for Windows 95/98. This is a good test to see if you can write to the PRINT$ share.
83
26 CraigBox 84 Now, fire up the Add Printer Wizard (APW) and run through the wizard, adding appropriate drivers. You'll note that the APW prompts you with 'The server doesn't have drivers for this printer, would you like to upload them now?'. Hit ''no'', (a yes will install them locally only) and then you will get the printer properties window.
24 CraigBox 85
26 CraigBox 86 Go to the sharing tab, and click 'Additional Drivers', then select the architectures you wish to export drivers for (and you have created directories for), and it should - if its behaving - prompt for the location of the new drivers.
29 CraigBox 87
88 ''For some reason, this isn't working for me - I found that if I copied the drivers to the \\server\print$\w32x86 dir the copy could overwrite them, but it couldn't write to them itself, so would prompt for another location locally, thinking they were broken. I have no idea why this happened. --CraigBox''
16 JohnMcPherson 89
26 CraigBox 90 !Troubleshooting
25 CraigBox 91
27 CraigBox 92 * Try turning <tt>log level</tt> up in the smb.conf. 3 is a good level. You can also issue <tt>smbcontrol smbd debug 3</tt>, which is cool.
25 CraigBox 93 * To find local drivers, try %systemroot%\system32\spool\drivers\w32x86.
94 * __Unable to install ''printer'', Intel, Windows 2000 or XP driver. Operation could not be completed__ - Did you create a W32X86 directory under print$?
16 JohnMcPherson 95
24 CraigBox 96 You can have a look at whats happening on the server side of things with the <tt>rpcclient</tt> program:
97
98 <pre>
99 # rpcclient ''server'' -U root -c "enumdrivers"
100 Password:
101 </pre>
102 <verbatim>
16 JohnMcPherson 103 [Windows 4.0]
104 Printer Driver Info 1:
105 Driver Name: [Mita PointSource Vi300]
106
107 Printer Driver Info 1:
108 Driver Name: [HP Color LaserJet 4550 PS]
109
110 Printer Driver Info 1:
111 Driver Name: [Kyocera Mita KM-1810 KX]
112
113
114 [Windows NT x86]
115 Printer Driver Info 1:
116 Driver Name: [Kyocera Mita KM-1810 KX]
117
118 Printer Driver Info 1:
119 Driver Name: [Mita PointSource Vi300]
120
121 Printer Driver Info 1:
122 Driver Name: [HP Color LaserJet 4550 PS]
123
24 CraigBox 124 # rpcclient server -U root -c "enumprinters"
16 JohnMcPherson 125 Password:
126 flags:[0x800000]
127 name:[\\kiakaha\km1810]
128 description:[\\kiakaha\km1810,Kyocera Mita KM-1810 KX,lp]
129 comment:[lp]
130
131 flags:[0x800000]
132 name:[\\kiakaha\mita]
133 description:[\\kiakaha\mita,Mita PointSource Vi300,lp1]
134 comment:[lp1]
135
136 flags:[0x800000]
137 name:[\\kiakaha\hpcolor]
138 description:[\\kiakaha\hpcolor,HP Color LaserJet 4550 PS,lp2]
139 comment:[lp2]
140 </verbatim>
24 CraigBox 141
16 JohnMcPherson 142 * Gotchas: For one of my drivers, it wouldn't let me upload a Win95/98 driver. No idea why, but it refused to let me do this. In the end, I right clicked on the background of the printers control panel app, and went to server properties, then manually added the printer driver there. I then removed and re-added the printer, and it now recognises the new driver.
143
24 CraigBox 144 Its also worth pointing out that for the APW to work, you NEED NT/2000/XP drivers for the printer, even if you only want to share to Win98 Clients.
145
18 JohnMcPherson 146 !!! Linux clients printing to Windows XP machine
24 CraigBox 147
18 JohnMcPherson 148 This can probably be done via some [GUI] tool, but I only tried via the CommandLine.
149
150 1) Make sure the file <tt>/usr/lib/cups/backend/smb</tt> exists.
20 SamCook 151 If not, do <tt>ln -s / ln -s /usr/bin/smbspool /usr/lib/cups/backend/smb</tt>
18 JohnMcPherson 152
153 2) get the right driver. For me, the Epson 460 Colour printer that is attached to the WinXP machine needs the escp2-460.ppd file in the cupsys-driver-gimpprint-data Debian package. I don't know if I really need this, or if cups/winxp is smart enough to convert arbitrary print data to the correct format.
154
21 AriSovijarvi 155 3) I created the print queue via <tt>lpadmin -p Shared_Epson -v smb://ip.ad.dre.ss/shared_name -P esdp2-460.ppd</tt>
18 JohnMcPherson 156
157 4) Restart cups, and manually enable the queue:
158 <tt>cupsenable Shared_Epson</tt>
159
160 5) when printing, cups told me that the printer wasn't accepting jobs.
161 Turns out I had to do <tt>cupsaccept Shared_Epson</tt> as well. How stupid.
162
163 6) Now when trying to print, cups logged an NT_STATUS_ACCESS_DENIED error when contacting the WinXP machine. The solution to this (as found
164 [here|http://www.flux.org/pipermail/linux/2004-April/015230.html]) is to add a username in the URI, so <tt>smb://guest@ip.ad.dre.ss/shared_name</tt> and restart cups.
165
166 7) wasn't that nice and straight-forward?
24 CraigBox 167
168 !!!Other notes
169
170 * For a way to get samba to print to a pdf then email you the result, see [SambaPDFPrinter]
171 * To see what resources are available in your network, on Linux one can use smbtree
172
16 JohnMcPherson 173 ----
24 CraigBox 174 This page is a member of CategoryPrinting.

PHP Warning

lib/blame.php:177: Warning: Invalid argument supplied for foreach() (...repeated 9 times)