Skip to main content
IBM  
Shop Support Downloads
IBM Home Products Consulting Industries News About IBM
IBM developerWorks : Linux : Education - Tutorials
LPI certification 102 exam prep, Part 3
ZIPPDF (letter)PDF (A4)e-mail
Main menuSection menuFeedbackPreviousNext
5. Printing
  


Printing to a remote MS Windows or Samba server page 7 of 10


Thanks to Samba, printing to a remote Microsoft Windows print server is only slightly more complicated. First, add the local printcap entry:


smb|Remote windows printer:\
        :if=/usr/bin/smbprint:\
        :lp=/dev/null:\
        :sd=/var/spool/lpd/smb:\
        :mx#0:

The new key here is if, the input filter. Pointing this to the smbprint script will cause the print job to be sent to a Windows server instead of the lp device. We still have to list a device (/dev/null in this case) which the print daemon uses for locking. But no print jobs will actually be sent there.

Don't forget to create the spool directory!


# mkdir -p /var/spool/lpd/smb
# chown lp /var/spool/lpd/smb
# chmod 700 /var/spool/lpd/smb
# checkpc -f
# /etc/init.d/lprng restart

In your favorite editor, create a .config file in the spool directory named above. In this case, /var/spool/lpd/smb/.config:


server="WindowsServerName"
service="PrinterName"
password=""
user=""

Adjust these values to point to the Windows machine and printer name that you want to use, and you're done:


$ lpr -Psmb sample.txt

The smbprint script should come with Samba, but it isn't included in all distributions. If you can't find it on your system, you can get it from the Samba HOWTO.


Main menuSection menuFeedbackPreviousNext
Privacy Legal Contact