> I have a linux server, without X, on a windows network, and I need to print
> to a hp lj 4000 on that windows network (only 98 p2p I think) from the
> linux box. I have printed before from linux on a similiar network, but I
> had 1) X and printtool, and 2) someone gave me the ip address of the
> printer or perhaps the print server, I'm not sure but it worked.
> For question 1, I don't think I can remotely run an X session from my home
> box into the X-less box, because the firewall is not setup to NAT say a ssh
> session into that particular box. If need be, I suppose I could bring in my
> box and put it on the lan, it sounds easier than editing /etc/printcap.
> Perhaps there is a ncurses program with similar functionality or something
> else, any one have an idea, please?
> For question 2, I'm obviously a bit clueless about how a networked printer
> works. The printer has a ethernet connection to the hub, I at least know
> that. Is it essential I find an IP for the printer, is that from a print
> server I don't know about or is that actually internal to the printer? This
> lan has only about 6 hosts, no one knows anything about them.
> Lastly, as clueless as I probably sound I was actually able to successfully
> get samba up and windows clients to access it. That being the case, is
> smbprint the easiest solution, or at least possible?
> Thanks in advance,
> iksrazal
Hi, iksrazal,
It's me again (this time wearing my 'at home' hat <g>)
I thought that I had better give you a bit more information on
configuring printcap for network printers.
First off, there are at least three different 'network printer'
configurations: Appletalk printers, Microsoft Networks printers, and
Unix Lineprinting Daemon printers. It sounds as if you have one of the
latter two configurations to worry about. (I don't know anything about
Appletalk, so I couldn't help you with it anyway <g>).
Let's start with the "Microsoft Networks" printer. This is a printer
that is accessed through a Microsoft "File and Print Sharing" share.
Here, you'll need to gather a bit of information before you get going.
You'll need to know
- the SERVER name,
- the SERVICE name,
- a USERID that can access the SERVER and SERVICE, and
- the PASSWORD for the USERID.
These will all be parameters defined on the MS system that hosts the
printer. For instance, if your printer is accessed through share
\\WIN98SERVER\LASERPRINTER, then the SERVER is "WIN98SERVER" and the
SERVICE is "LASERPRINTER". IF the WIN98SERVER machine has
userid/password protection enabled on this share, and permits user JOE
(with password "CRYPTIC") to access the printer share, then the USERID
would be "JOE" and the PASSWORD would be "CRYPTIC"
To access this printer from Linux, you'll need to install
a) Samba (which is a Unix implementation of a client and server for the
SMB protocol that Microsoft uses in "File and Print Sharing", and
b) lpr/lpd
The "SMB Howto" provides a script that (along with the Samba tools)
permits lpd to print to an SMB printer. The script should be installed
in a suitable directory (I called it 'smbprint', and installed it in
/usr/local/sbin), and will be referenced by the /etc/printcap entry for
the printer. The printcap entry will also provide the name of a
directory in which a config file can be placed; the config file will
contain entries for the SERVER, SERVICE, USERID, and PASSWORD to the
machine hosting the printer.
Ok, enough verbiage about this setup. Here's an example...
/etc/printcap entry for an SMB printer
# REMOTE SMB Printer
epson:\
:lp=/dev/null:\
:sd=/usr/spool/lpd/smbprinter:\
:if=/usr/local/sbin/smbprint:\
:af=/usr/spool/lpd/smbprinter/acct:\
:sh:sf:
/usr/spool/lpd/smbprinter/.config file (used by smbprint) for the SMB
printer
server=WIN98SERVER
service=LASERPRINTER
password=""
Now, the Unix Lineprinting Daemon network printer setup is a bit
different...
First off, you'll have to determine the hostname or IP address of the
network printer. This may be as simple as looking at the printer's
control panel to see what the values are, or you might have to peek at
how a WinXX box has it defined. At worst case, ask the sysadm who set up
the printer. You'll also have to find out the name of the printer (which
is different from it's hostname/IP address). If you can't find this out,
you can _assume_ that it is called 'lp' or 'raw' (these are two standard
names).
Once you have the printer address and the printer name, set up a
printcap entry for it. Your printcap entry will look something like...
# REMOTE LPR Printer
remoteprinter:\
:rm=hostname-or-IP-address-goes-here:\
:rp=printername-goes-here:\
:lp=/dev/null:\
:sd=/usr/spool/lpd/remoteprinter:\
:pl#66:pw#80:\
:sh:sf:
You can now lpr -Premoteprinter, and get your output printed on the
network printer.
But... you might still need to run your output through a print filter.
Some printers (most printers) can't handle the arbitrary data we
normally print, and need some preprocessing to make it printable. If
this is the case for you, you'll have to add a _second_ printcap entry
to make this happen (because lpd doesn't filter network print, so you'll
have to filter it as local print, then network print it out).
This second printcap entry simply invokes a print filter (as per normal)
and has the print filter respool the output to the remoteprinter printer
for printing. This additional printcap entry would look like...
# RESPOOLED REMOTE LPR Printer
netprinter:\
:lp=/dev/null:\
:sd=/usr/spool/lpd/netprinter:\
:if=/usr/spool/lpd/netprinter.filter:\
:pl#66:pw#80:\
:sh:sf:
and the netprinter.filter would look something like
#!/bin/bash
/usr/local/sbin/whatever.filter.I.use $1 $2 $3 $4 $5 $6 $7 $8 $9 |
lpr -Premoteprinter
As you can see, 'netprinter' simply filters it's input, and respools it
to 'remoteprinter'. 'remoteprinter' will spool any print data it
receives to the real networked printer.
That's about it.
Let me know how it works for you...
Thanks... Lew
--
Lew Pitcher
Master Codewright and JOAT-in-training
Registered Linux User #112576