root# ldd `which smbd` libldap.so.2 => /usr/lib/libldap.so.2 (0x4001b000) libcom_err.so.2 => /lib/libcom_err.so.2 (0x400c3000) libcups.so.2 => /usr/lib/libcups.so.2 (0x400c6000) .....
The 'libcups.so.2' line is the important one. Yours might be slightly different - that's ok.
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:
load printers = yes printing = cups printcap name = cups printer admin = root, @ntadmins
In the [printers] section, you should have something like the following:
[printers] comment = All Printers path = /var/spool/samba browseable = no public = yes guest ok = yes writeable = no printable = yes
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.
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.
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!
Your cups spool dir should be /var/spool/cups, and you samba printing spool dir should probably be /var/spool/samba.
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.
print command = lpr -P %p -o raw %s -r lpq command = lpstat -o %p lprm command = cancel %p-%j
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, which also coveres this information in detail.
Windows NT/2000/XP have an Add Printer Wizard. You can use this to add printer drivers to your (cunningly disguised) Samba 3 server.
[PRINT$] path = /home/samba/printers guest ok = yes browseable = yes read only = yes write list = @wheel, user admin users = @wheel, user create mask = 0644 directory mask = 0755
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.
Connect to \\server\print$. You will need to create directories here for drivers; W32X86 is for NT/2000/XP, WIN40 is for Windows 95/98. This is a good test to see if you can write to the PRINT$ share.
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.
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.
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
You can have a look at whats happening on the server side of things with the rpcclient program:
# rpcclient server -U root -c "enumdrivers" Password:
[Windows 4.0] Printer Driver Info 1: Driver Name: [Mita PointSource Vi300] Printer Driver Info 1: Driver Name: [HP Color LaserJet 4550 PS] Printer Driver Info 1: Driver Name: [Kyocera Mita KM-1810 KX] [Windows NT x86] Printer Driver Info 1: Driver Name: [Kyocera Mita KM-1810 KX] Printer Driver Info 1: Driver Name: [Mita PointSource Vi300] Printer Driver Info 1: Driver Name: [HP Color LaserJet 4550 PS] # rpcclient server -U root -c "enumprinters" Password: flags:[0x800000] name:[\\kiakaha\km1810] description:[\\kiakaha\km1810,Kyocera Mita KM-1810 KX,lp] comment:[lp] flags:[0x800000] name:[\\kiakaha\mita] description:[\\kiakaha\mita,Mita PointSource Vi300,lp1] comment:[lp1] flags:[0x800000] name:[\\kiakaha\hpcolor] description:[\\kiakaha\hpcolor,HP Color LaserJet 4550 PS,lp2] comment:[lp2]
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.
1) Make sure the file /usr/lib/cups/backend/smb exists. If not, do ln -s / ln -s /usr/bin/smbspool /usr/lib/cups/backend/smb
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.
3) I created the print queue via lpadmin -p Shared_Epson -v smb://ip.ad.dre.ss/shared_name -P esdp2-460.ppd
4) Restart cups, and manually enable the queue: cupsenable Shared_Epson
5) when printing, cups told me that the printer wasn't accepting jobs. Turns out I had to do cupsaccept Shared_Epson as well. How stupid.
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 here) is to add a username in the URI, so smb://email@example.com/shared_name and restart cups.
7) wasn't that nice and straight-forward?