Printing with Samba
Some builds of Puppy do not have the 'smbspool' utility (type "which
smbspool" in a terminal to find out). Puppy developer "Patriot" (forum
name) advised of a special CUPS driver
script named 'smbc' is used, which in turn uses the 'smbclient' utility
to print. We found that worked, however Patriot went a big step further
and wrote a script named 'smb' that is a drop-in replacement for
'smbspool'.
This help page is in two parts: the first part describes Patriots 'smb'
drop-in replacement for 'smbspool' (which is the recommended choice),
the second part describes the earlier 'smbc' script...
PART 1: smbspool drop-in replacement
Extract from Forum post: http://www.murga-linux.com/puppy/viewtopic.php?t=57610
Recently, BarryK enquired about samba-tng's
non-existent smbspool and whether printing through smbclient will work.
I've advised him that it is indeed possible to do raw/postcript
printing with smbclient and the smbc script (from http://willem.engen.nl/projects/cupssmb/) is what he can use or base upon.
I've taken a closer look at the whole smbspool thingy and have
scribbled a drop-in replacement script for smbspool by sending print
job(s) to smbclient. This script is loosely based on samba's smbspool
internal logics, uses smbspool input parameter format and attempts to
mimic smbspool behaviour. This script is designed to work with existing
CUPS device URI.
The device URI (Uniform Resource Identifier) format for smbspool is defined as:
smb://[username[:password]@][workgroup/]server[:port]/printer
Please take note of the compulsory minimum in bold: smb:// [username[:password]@] [workgroup/] server [:port] /printer
Examples:
1. smb://PRINTSERVER/HP4V (minimum parameter smb://server/printer)
2. smb://192.168.1.2/ML1200 (same as #1 but using IP address)
3. smb://zigbert:ladiesman217@/192.168.2.22:9191/MP250 (extended parameters with username, password and server port)
4. smb://dogbert:majesty@SYHDP/DILBERT/LEDCOPIER (extended parameters with username, password and domain name)
Features:
- Fully supports smb URI format. This allows the authentication details to be embedded within the URI.
- Allows printing to multiple authenticated servers without mucking with separate authentication files.
- Supports print copies option, if required.
- Supports smbclient from both samba and samba-tng.
Manual installation: [already installed in this Puppy]
1. Save the script as /usr/lib/cups/backend/smb.
2. Give it an owner only permission (# chmod 700
/usr/lib/cups/backend/smb). (If you skip this, smbclient will bork
reading smb.conf file)
3. Configure smb printer if required & do a test print
Final notes:
- This script is designed to run on puppy >= 4.0 platform with cups >= 1.1.x.
- Development and testing is done on puppy412 with cups-1.3.11, samba-3.0.37 and samba-tng-0.5rc1
- and yes, if anyone's wondering, I am able to print raw/ps using either samba or samba-tng smbclient.
PART 2: Getting CUPS to work with Windows print servers
Extract from: http://willem.engen.nl/projects/cupssmb/
by Willem van Engen
CUPS uses
smbspool(8)
to print pages to windows servers. This did not appear to work, whereas printing with
smbclient(1)
did (some relief). Wanting to get it working, I created a custom CUPS backend that uses
the latter instead of the former. This also allowed me to solve the problem of the
windows password being visible in the device uri (which is shown in the web interface).
Note that this still is a work in progress: it is being used with success, but now
and then I encounter issues. This page will be updated accordingly.
Following are sections for using the aforementioned programs. The final section
gives a possible solution for using windows print servers with CUPS when smbspool(8)
isn't working.
Printing with smbspool
A CUPS backend(7)
is a program, usually located in /usr/lib/cups/backend/,
that sends a job to a printer or print server.
CUPS uses smbspool(8), which is part of samba,
to spool jobs to windows servers. To this end, there is a symbolic link from
/usr/lib/cups/backend/smb to /usr/bin/smbspool.
To test the backend, it is possible to invoke smbspool(8) by hand. For example:
DEVICE_URI="smb://server/printer" smbspool 1234 me sometitle 1 <test.ps
Printing with smbclient
It is also possible to use smbclient(1) to print. When logging into a printer share
on a windows server, one can issue the print command to print a file. For example:
smbclient -W Domain -U me //server/printer
Added interface ip=xxx.xxx.xxx.xxx bcast=xxx.xxx.xxx.xxx nmask=xxx.xxx.xxx.xxx
Password: password
Domain=[Domain] OS=[Windows Server 2003 3790 Service Pack 2] Server=[Windows Server 2003 5.2]
smb: \> print test.ps
printing file test.ps as test.ps
xxxxx bytes printed
smb: \> quit
A CUPS backend using smbclient
When smbspool(8) doesn't work, it may be possible to get printing working with smbclient(1) instead.
This can be done by adding a custom CUPS backend. Download the file
smbc, save it as
/usr/lib/cups/backend/smbc and make it executable. Make sure to make it owned by
root. [NOTE: this script is already in Puppy]
You should still create the file /etc/samba/printing.auth containing your
windows credentials, like this:
username = s123456
password = mypassword
domain = TUE
To protect it from prying eyes, make it owned by user cupsys (or whatever
CUPS backends are run by on your system) and make it readable for that user only. For
Ubuntu users: this user is cupsys on Feisty,
but lp on Gutsy.
Remains to setup CUPS. I recommend to add a printer using the
web interface
with a device uri with protocol smbc, like
smbc://physfp.phys.tue.nl/n-IS2060PS
If you happen to use AppArmor in enforcing mode,
you'll need to add #include <abstractions/samba> to the cupsd
profile.
This page composed by Barry Kauler July 2010