Penguin
Diff: SambaPrinting
EditPageHistoryDiffInfoLikePages

Differences between current version and predecessor to the previous major change of SambaPrinting.

Other diffs: Previous Revision, Previous Author, or view the Annotated Edit History

Newer page: version 29 Last edited on Friday, August 4, 2006 1:20:49 pm by CraigBox
Older page: version 21 Last edited on Thursday, January 26, 2006 9:19:46 pm by AriSovijarvi Revert
@@ -1,33 +1,24 @@
-Some notes on printing and samba
+!!! Setting up Samba 3 .x and [CUPS]  
  
-!!!Neat things you can do with samba and printing  
-  
-* For a way to get samba to print to a pdf then email you the result, see [SambaPDFPrinter]  
-* To see what resources are available in your network, on Linux one can use smbtree  
-  
-----  
-  
-!!! Setting up samba and [CUPS]  
-  
-''This covers Samba 3.x, it might be similar in 2.x but be warned''.  
-  
-Your samba binary needs to be linked against libcups. To check this, run the following command and check that your output looks similar: 
+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: 
 <verbatim> 
 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) 
  ..... 
 </verbatim> 
+  
 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: 
+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: 
  
 <verbatim> 
  load printers = yes 
  printing = cups 
  printcap name = cups 
+ printer admin = root, @ntadmins  
 </verbatim> 
  
 In the ~[printers] section, you should have something like the following: 
  
@@ -39,82 +30,77 @@
  public = yes 
  guest ok = yes 
  writeable = no 
  printable = yes 
- printer admin = root, @ntadmins  
-  
 </verbatim> 
  
-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 notes below. 
+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. 
  
-!!! Using samba and [CUPS] - troubleshooting  
+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
+!!Troubleshooting  
  
-Your cups spool dir should be /var/spool/cups , and you samba printing spool dir should probably be /var/ spool/samba  
-  
-----  
-NOTE - In redhat 9 users have reported needing to add the following 3 lines to the printer section of the smb.conf  
+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!  
  
-This fixes the 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
+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.  
  
 <verbatim> 
  print command = lpr -P %p -o raw %s -r 
  lpq command = lpstat -o %p 
  lprm command = cancel %p-%j 
 </verbatim> 
----- 
+  
+- ---- 
  
 !!!Drivers for Windows clients 
  
-There are a few ways you can arrage for your samba server to automagically have windows drivers for the printers it shares. I'll describe one of them below ( Add Printer Wizard); there are other ways however!  
-  
-!!RPCClient  
- -- needs work  
-  
-!!Imprints  
- -- needs work  
+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.  
  
-!!Add Printer Wizard 
+!!Uploading drivers with the Add Printer Wizard 
  
-Win2k and WinNT have an Add Printer Wizard. You can use this to add printer drivers to your (cunningly disguised) Samba server. 
+Windows NT/2000/XP have an Add Printer Wizard. You can use this to add printer drivers to your (cunningly disguised) Samba 3 server. 
  
-I am using Samba 2.999+3..alpha21-3 (one of the Samba 3 Alpha's)  
+!Steps  
  
-Steps:  
 * Configure your smb.conf appropriately. You'll want to add a section that looks like this: 
  
 <verbatim> 
- [PRINT$]  
- path = /home/samba/printers  
- guest ok = yes  
- browseable = yes  
- read only = yes  
- write list = @wheel,root,daniel,admin  
- admin users = @wheel,root,daniel,admin  
- create mask = 0644  
- directory mask = 0755 
+[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 
 </verbatim> 
-Note that the path can be anywhere, really. All that matters is that the permissions are set appropriately. I set them to 777 for the purpose of this exercise: this may not be neccesary  
  
-* Join the Win2k or WinNT machine to your domain . This is covered elsewhere - see [SambaAsPDC]. This machine is referred to after this as the 'NT machine' for brevity.  
-* Find a user you can use that has an (effective) uid of 0 on the samba server. Note: This doesn't mean you have to use the root user, its actually ok to set a printer admin and use that.  
-* Login as this user to the NT machine.  
-* Fire up the APW (Add Printer Wizard) 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?'  
-* After you've correctly added the drivers on the NT machine, right-click on the printer icon and select sharing . Make sure that sharing is enabled for this printer.  
-* Magic time. Not sure if this is neccesary - a reboot of the NT machine may do the job instead. Remove the printer you just added.  
-* Re-add the printer you just added. If things go well, it'll remember you already had the drivers intalled, and it'll just load up straight away  
-* Go to the properties page for the printer you just added, and go to the 'ports' section. After going through the above removal-readd rigmoral, I have only one port listed - a 'Samba Printer Port' one. Make sure this is checked.  
-* You can now add extra drivers - go to the sharing tab, and click 'Additional Drivers', then select the architectures you wish to export drivers for, and it should - if its behaving - prompt for the location of the new drivers.  
-* Done
+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. 
  
-You can have a look at whats happening on the server side of things with the rpcclient program  
- <verbatim >  
- # rpcclient kiakaha -U root -c "enumdrivers"  
- Password:  
+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.  
  
+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''  
+  
+!Troubleshooting  
+  
+* 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.  
+* To find local drivers, try %systemroot%\system32\spool\drivers\w32x86.  
+* __Unable to install ''printer'', Intel, Windows 2000 or XP driver. Operation could not be completed__ - Did you create a W32X86 directory under print$?  
+  
+You can have a look at whats happening on the server side of things with the <tt>rpcclient</tt> program:  
+  
+<pre>  
+# rpcclient ''server'' -U root -c "enumdrivers"  
+ Password:  
+</pre>  
+<verbatim>  
  [Windows 4.0] 
  Printer Driver Info 1: 
  Driver Name: [Mita PointSource Vi300] 
  
@@ -134,9 +120,9 @@
  
  Printer Driver Info 1: 
  Driver Name: [HP Color LaserJet 4550 PS] 
  
- # rpcclient kiakaha -U root -c "enumprinters" 
+ # rpcclient server -U root -c "enumprinters" 
  Password: 
  flags:[0x800000] 
  name:[\\kiakaha\km1810] 
  description:[\\kiakaha\km1810,Kyocera Mita KM-1810 KX,lp] 
@@ -150,15 +136,16 @@
  flags:[0x800000] 
  name:[\\kiakaha\hpcolor] 
  description:[\\kiakaha\hpcolor,HP Color LaserJet 4550 PS,lp2] 
  comment:[lp2] 
-  
 </verbatim> 
+  
 * 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. 
  
-Its also worth pointing out that for the APW to work, you NEED NT or 2K drivers for the printer, even if you only want to share to Win98 Clients. 
+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. 
  
 !!! Linux clients printing to Windows XP machine 
+  
 This can probably be done via some [GUI] tool, but I only tried via the CommandLine. 
  
 1) Make sure the file <tt>/usr/lib/cups/backend/smb</tt> exists. 
 If not, do <tt>ln -s / ln -s /usr/bin/smbspool /usr/lib/cups/backend/smb</tt> 
@@ -176,6 +163,12 @@
 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|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. 
  
 7) wasn't that nice and straight-forward? 
+  
+!!!Other notes  
+  
+* For a way to get samba to print to a pdf then email you the result, see [SambaPDFPrinter]  
+* To see what resources are available in your network, on Linux one can use smbtree  
+  
 ---- 
-Part of CategoryPrinting 
+This page is a member of CategoryPrinting.