Print from Linux to Windows Server
Sometimes a Linux workstation must print to Windows or Samba Server. Between Linuxes, it’s better to use CUPS Servers. Often it’s possible to print directly to printer too.
© 2005 Tero Karvinen http://www.iki.fi/karvinen
Below we use
-
Windows Username: “wuser”
-
Windows Password: “wpassword”
-
Windows Workgroup: “WGROUP”
-
Windows Server: “wserver”
-
Windows Printer: “wprinter”
Save this as /etc/cups/printers.conf:
# CUPS printers.conf for Samba (c) 2005 Tero Karvinen <DefaultPrinter wprinter> Info Location DeviceURI smb://wuser:wpassword@WGROUP/wserver/wprinter State Idle Accepting Yes JobSheets none none QuotaPeriod 0 PageLimit 0 KLimit 0 </Printer>
Restart CUPS service to load printers.conf:
$ sudo /etc/init.d/cupsys restart
Now it’s installed, print a test page trough web interface. Login “root”, password is your root password (should be changed).
# x-www-browser http://localhost:631/printers/foo
Choose “Print test page”.
You can also test it in OpenOffice. Close all OpenOffice windows, then start OpenOffice Writer, write something and choose print.
If your document was printed, well done, you have successfully installed a Windows SMB printer queue on Linux CUPS.
Tested with Debian Sarge on 2005-05-16t1907, Tero
Troubleshooting
If printing fails, check your logs:
$ tail -f /var/log/cups/*_log
If nothing else helps, get sniffer log:
$ sudo wireshark
Use display filter like
proto == smb a ip.addr==10.0.0.1
If problem is related to SMB login, test connectivity with smbclient. Logon problems ( NT_STATUS_LOGON_FAILURE or NT_STATUS_ACCESS_DENIED) can often be fixed by adding workgroup or domain to user name part. Problems with SMB name service can be solved by using DNS names instead.
Try again until you get the list of shared printers, for example:
$ smbclient -L server.firm.com -U FIRM/user
For example, once I’ve had to change:
DeviceURI smb://FIRM/user:pass@FIRM/server/printer
to
DeviceURI smb://FIRM/user:pass@/server.firm.com/printer