18.17 Printing from CUPS to Windows Attached Printers

>From time to time the question arises, how can you print to a Windows attached printer from Samba? Normally the local connection from Windows host to printer would be done by USB or parallel cable, but this does not matter to Samba. From here only an SMB connection needs to be opened to the Windows host. Of course, this printer must be shared first. As you have learned by now, CUPS uses backends to talk to printers and other servers. To talk to Windows shared printers, you need to use the smb (surprise, surprise!) backend. Check if this is in the CUPS backend directory. This usually resides in /usr/lib/cups/backend/ . You need to find an smb file there. It should be a symlink to smbspool and the file must exist and be executable:

 root# ls -l /usr/lib/cups/backend/ total 253 drwxr-xr-x 3 root root 720 Apr 30 19:04 . drwxr-xr-x 6 root root 125 Dec 19 17:13 .. -rwxr-xr-x 1 root root 10692 Feb 16 21:29 canon -rwxr-xr-x 1 root root 10692 Feb 16 21:29 epson lrwxrwxrwx 1 root root 3 Apr 17 22:50 http -> ipp -rwxr-xr-x 1 root root 17316 Apr 17 22:50 ipp -rwxr-xr-x 1 root root 15420 Apr 20 17:01 lpd -rwxr-xr-x 1 root root 8656 Apr 20 17:01 parallel -rwxr-xr-x 1 root root 2162 Mar 31 23:15 pdfdistiller lrwxrwxrwx 1 root root 25 Apr 30 19:04 ptal -> /usr/sbin/ptal-cups -rwxr-xr-x 1 root root 6284 Apr 20 17:01 scsi lrwxrwxrwx 1 root root 17 Apr 2 03:11 smb -> /usr/bin/smbspool -rwxr-xr-x 1 root root 7912 Apr 20 17:01 socket -rwxr-xr-x 1 root root 9012 Apr 20 17:01 usb root# ls -l `which smbspool' -rwxr-xr-x 1 root root 563245 Dec 28 14:49 /usr/bin/smbspool 

If this symlink does not exist, create it:

 root# ln -s `which smbspool` /usr/lib/cups/backend/smb 

smbspool has been written by Mike Sweet from the CUPS folks. It is included and ships with Samba. It may also be used with print subsystems other than CUPS, to spool jobs to Windows printer shares. To set up printer winprinter on CUPS, you need to have a driver for it. Essentially this means to convert the print data on the CUPS/Samba host to a format that the printer can digest (the Windows host is unable to convert any files you may send). This also means you should be able to print to the printer if it were hooked directly at your Samba/CUPS host. For troubleshooting purposes, this is what you should do to determine if that part of the process chain is in order. Then proceed to fix the network connection/authentication to the Windows host, and so on.

To install a printer with the smb backend on CUPS, use this command:

 root# lpadmin -p winprinter -v smb://WINDOWSNETBIOSNAME/printersharename \ -P / path /to/PPD 

The PPD must be able to direct CUPS to generate the print data for the target model. For PostScript printers, just use the PPD that would be used with the Windows NT PostScript driver. But what can you do if the printer is only accessible with a password? Or if the printer's host is part of another workgroup? This is provided for: You can include the required parameters as part of the smb:// device-URI like this:

  • smb://WORKGROUP/WINDOWSNETBIOSNAME/printersharename

  • smb://username:password@WORKGROUP/WINDOWSNETBIOSNAME/printersharename

  • smb://username:password@WINDOWSNETBIOSNAME/printersharename

Note that the device-URI will be visible in the process list of the Samba server (e.g., when someone uses the ps -aux command on Linux), even if the username and passwords are sanitized before they get written into the log files. So this is an inherently insecure option, however, it is the only one. Don't use it if you want to protect your passwords. Better share the printer in a way that does not require a password! Printing will only work if you have a working netbios name resolution up and running. Note that this is a feature of CUPS and you do not necessarily need to have smbd running.

Official Samba-3 HOWTO and Reference Guide
The Official Samba-3 HOWTO and Reference Guide, 2nd Edition
ISBN: 0131882228
EAN: 2147483647
Year: 2005
Pages: 297

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net