printtool without X, or perhaps samba?

printtool without X, or perhaps samba?

Post by iksraza » Sat, 14 Jul 2001 07:24:44



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

 
 
 

printtool without X, or perhaps samba?

Post by Lew Pitch » Sat, 14 Jul 2001 21:28:17




Quote:>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?

Well, I'm afraid that you are SOL. That's the danger in depending
exclusively on GUI tools: when they aren't available, you don't have a
clue as to how to configure a system.

You already stated that you'd attach your box directly to the network
rather than learn how to configure /etc/printcap, and I guess that's
what you'll have to do (just don't expect it to work once you take the
box home again).

My advice (you're not going to like this) is to read the "Printing
HOWTO" and the "Printing Using HOWTO" (both available from The Linux
Documentation Project at http://www.linuxdoc.org/), and go
hand-configure your /etc/printcap entry. Those two howtos have pretty
good explanations (with examples) of how printcap should be
configured, and _if_ you learn how to hand-configure your system, you
won't be so dependant on GUI tools.

Lew Pitcher, Information Technology Consultant, Toronto Dominion Bank Financial Group

(Opinions expressed are my own, not my employer's.)

 
 
 

printtool without X, or perhaps samba?

Post by iksraza » Sat, 14 Jul 2001 21:45:52





>>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?

> Well, I'm afraid that you are SOL. That's the danger in depending
> exclusively on GUI tools: when they aren't available, you don't have a
> clue as to how to configure a system.

> You already stated that you'd attach your box directly to the network
> rather than learn how to configure /etc/printcap, and I guess that's
> what you'll have to do (just don't expect it to work once you take the
> box home again).

> My advice (you're not going to like this) is to read the "Printing
> HOWTO" and the "Printing Using HOWTO" (both available from The Linux
> Documentation Project at http://www.linuxdoc.org/), and go
> hand-configure your /etc/printcap entry. Those two howtos have pretty
> good explanations (with examples) of how printcap should be
> configured, and _if_ you learn how to hand-configure your system, you
> won't be so dependant on GUI tools.

> Lew Pitcher, Information Technology Consultant, Toronto Dominion Bank

> (Opinions expressed are my own, not my employer's.)

My reason for not wanting to hand edit /etc/printcap is not some vi phobia,
I've been a programmer for years. Rather the FILE ITSELF, and the HOWTO
ITSELF, say not to do so unless you really know what you are doing. Thanks
for the condescending answer, if for nothing else than the social
commentary, but if anyone has a bit more constructive advice, I'd like to
hear it.

iksrazal

 
 
 

printtool without X, or perhaps samba?

Post by Lew Pitch » Sun, 15 Jul 2001 01:33:14







>>>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?
[snip]
>> My advice (you're not going to like this) is to read the "Printing
>> HOWTO" and the "Printing Using HOWTO" (both available from The Linux
>> Documentation Project at http://www.linuxdoc.org/), and go
>> hand-configure your /etc/printcap entry. Those two howtos have pretty
>> good explanations (with examples) of how printcap should be
>> configured, and _if_ you learn how to hand-configure your system, you
>> won't be so dependant on GUI tools.
>My reason for not wanting to hand edit /etc/printcap is not some vi phobia,
>I've been a programmer for years. Rather the FILE ITSELF, and the HOWTO
>ITSELF, say not to do so unless you really know what you are doing.

Hmmm.... Perhaps on your system, this is true, but neither my
/etc/printcap nor the "Printing HOWTO" say this on my system
(Slackware 7.0). FWIW, I believe that some 'configuration tools' stick
"do not edit" banners in the editable system files on their own. At
least one of these tools does this because of it's problem in
maintaining 'state', and it gets confused if it's internal database
doesn't match the system file.

Certainly, you should exercise caution when altering any system file,
but printcap is neither critical nor daunting. I had my first custom
printcap built and working about two hours of first installing
Slackware 3.0 (the distro I started with), and have built three custom
printcaps since. You _can't_ damage your system by building a bad
printcap, and recovery is as simple as cp command. The HOWTO docs are
very good at describing exactly how to build a printcap, and they _do
not_ have any "DO NOT DO THIS" instruction regarding editing printcap.

Quote:>Thanks
>for the condescending answer, if for nothing else than the social
>commentary, but if anyone has a bit more constructive advice, I'd like to
>hear it.

Social commentary I've got to the gills <g>

Condescension is in the eyes of the beholder, I guess. I answered your
question to the best of my knowledge and experience, and if you don't
like the advice, then you aren't obliged to listen to it or take it.

However, to assuage your concern, here's my advice:
-Read the Printing HOWTO and Printing Using HOWTO
-Make a backup copy of your current /etc/printcap file
-Hand edit your /etc/printcap file to include the network printer
   definitions (one for a local print filter, and one for the remote
   printer; here's a sample of what you'll have to add)
   #------------------------------------------------------------------
    netprint:\
      :lp=/dev/null:sh:mx#0:\
      :sd=/var/spool/lpd/netprint:\
      :if=/var/spool/lpd/netprint.filter:

   rmtprt:\
      :lp=/dev/null:sh:mx#0:\
      :sd=/var/spool/lpd/remoteprint:\
      :rm=network-name-or-ip-address-of-printer:rp=lp:
   #------------------------------------------------------------------
-Build your spool directories (named by the printcap entries)
-Build your local printer ('netprint' in the example above) filter
   program ('netprint.filter' in the example above, contents like the
   example below)
   #! /bin/bash
   /usr/local/lib/prtfilter $1 $2 $3 $4 $5 $6 $7 $8 $9 | lpr -Prmtprt
   #----------------------------------------------------------------
-Restart lpd (optional)

But, of course, you don't want _this_ advice. You want a GUI print
config tool that doesn't require X. Well, good luck in finding one.
Perhaps with a few days research, a weekend to install and configure
it, and five minutes to use it to construct your network printer
definition, you'll match the 2 hours (max) that it would take to
construct, test, and implement a hand-edited printcap and it's
supporting facilities.

Luck to you.

Lew Pitcher, Information Technology Consultant, Toronto Dominion Bank Financial Group

(Opinions expressed are my own, not my employer's.)

 
 
 

printtool without X, or perhaps samba?

Post by iksraza » Sat, 14 Jul 2001 23:45:20








>>>>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?
> [snip]
>>> My advice (you're not going to like this) is to read the "Printing
>>> HOWTO" and the "Printing Using HOWTO" (both available from The Linux
>>> Documentation Project at http://www.linuxdoc.org/), and go
>>> hand-configure your /etc/printcap entry. Those two howtos have pretty
>>> good explanations (with examples) of how printcap should be
>>> configured, and _if_ you learn how to hand-configure your system, you
>>> won't be so dependant on GUI tools.
>>My reason for not wanting to hand edit /etc/printcap is not some vi
>>phobia, I've been a programmer for years. Rather the FILE ITSELF, and the
>>HOWTO ITSELF, say not to do so unless you really know what you are doing.

> Hmmm.... Perhaps on your system, this is true, but neither my
> /etc/printcap nor the "Printing HOWTO" say this on my system
> (Slackware 7.0). FWIW, I believe that some 'configuration tools' stick
> "do not edit" banners in the editable system files on their own. At
> least one of these tools does this because of it's problem in
> maintaining 'state', and it gets confused if it's internal database
> doesn't match the system file.

> Certainly, you should exercise caution when altering any system file,
> but printcap is neither critical nor daunting. I had my first custom
> printcap built and working about two hours of first installing
> Slackware 3.0 (the distro I started with), and have built three custom
> printcaps since. You _can't_ damage your system by building a bad
> printcap, and recovery is as simple as cp command. The HOWTO docs are
> very good at describing exactly how to build a printcap, and they _do
> not_ have any "DO NOT DO THIS" instruction regarding editing printcap.

>>Thanks
>>for the condescending answer, if for nothing else than the social
>>commentary, but if anyone has a bit more constructive advice, I'd like to
>>hear it.

> Social commentary I've got to the gills <g>

> Condescension is in the eyes of the beholder, I guess. I answered your
> question to the best of my knowledge and experience, and if you don't
> like the advice, then you aren't obliged to listen to it or take it.

> However, to assuage your concern, here's my advice:
> -Read the Printing HOWTO and Printing Using HOWTO
> -Make a backup copy of your current /etc/printcap file
> -Hand edit your /etc/printcap file to include the network printer
>    definitions (one for a local print filter, and one for the remote
>    printer; here's a sample of what you'll have to add)
>    #------------------------------------------------------------------
>     netprint:\
>       :lp=/dev/null:sh:mx#0:\
>       :sd=/var/spool/lpd/netprint:\
>       :if=/var/spool/lpd/netprint.filter:

>    rmtprt:\
>       :lp=/dev/null:sh:mx#0:\
>       :sd=/var/spool/lpd/remoteprint:\
>       :rm=network-name-or-ip-address-of-printer:rp=lp:
>    #------------------------------------------------------------------
> -Build your spool directories (named by the printcap entries)
> -Build your local printer ('netprint' in the example above) filter
>    program ('netprint.filter' in the example above, contents like the
>    example below)
>    #! /bin/bash
>    /usr/local/lib/prtfilter $1 $2 $3 $4 $5 $6 $7 $8 $9 | lpr -Prmtprt
>    #----------------------------------------------------------------
> -Restart lpd (optional)

> But, of course, you don't want _this_ advice. You want a GUI print
> config tool that doesn't require X. Well, good luck in finding one.
> Perhaps with a few days research, a weekend to install and configure
> it, and five minutes to use it to construct your network printer
> definition, you'll match the 2 hours (max) that it would take to
> construct, test, and implement a hand-edited printcap and it's
> supporting facilities.

> Luck to you.

> Lew Pitcher, Information Technology Consultant, Toronto Dominion Bank

> (Opinions expressed are my own, not my employer's.)

Actually, thanks. After doing some research, yes, I probably will end up
editing /etc/printcap, and your examples will probably help. Now I
realize you took the time to help me, even after my snide response to your
RTFM suggestion, and that is perhaps the real social commentary after all.
I was spooked by the following, and I appreciate your help in overcoming
that.

-- rh 6.2
# /etc/printcap
#
# Please don't edit this file directly unless you know what you are doing!
# Be warned that the control-panel printtool requires a very strict format!
# Look at the printcap(5) man page for more info.
#
# This file can be edited with the printtool in the control-panel.

Cheers,
iksrazal                

 
 
 

printtool without X, or perhaps samba?

Post by Lew Pitch » Sun, 15 Jul 2001 02:48:47




[snip]

Quote:>Actually, thanks. After doing some research, yes, I probably will end up
>editing /etc/printcap, and your examples will probably help. Now I
>realize you took the time to help me, even after my snide response to your
>RTFM suggestion, and that is perhaps the real social commentary after all.
>I was spooked by the following, and I appreciate your help in overcoming
>that.

No problem; always glad to help. And I should apologize for any
condescention in my replies. I don't intend to condescend, but
sometimes I accidently let my 'social commentary' leak into the text.

Quote:>-- rh 6.2
># /etc/printcap
>#
># Please don't edit this file directly unless you know what you are doing!
># Be warned that the control-panel printtool requires a very strict format!
># Look at the printcap(5) man page for more info.
>#
># This file can be edited with the printtool in the control-panel.

Just as I thought. <g>

Quote:>Cheers,
>iksrazal                

Luck to you.

Lew Pitcher, Information Technology Consultant, Toronto Dominion Bank Financial Group

(Opinions expressed are my own, not my employer's.)

 
 
 

printtool without X, or perhaps samba?

Post by Lew Pitche » Sun, 15 Jul 2001 10:56:52



> 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

 
 
 

1. printtool without X, or perhaps samba?

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 with X, 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

2. Scanner...

3. printing setup WITHOUT printtool

4. Trident 8900b chipset config anyone?

5. printtool/Samba problem

6. solaris and exceed

7. Posix ACLs on FreeBSD? Samba perhaps?

8. DOS Emulator Problem

9. HOW to upgrade to samba 2.2.3a without losing previous samba configuration

10. Samba and FTP without NAT - is it possible ?

11. Samba without nmbd

12. Connect Samba Server without disable password encryption in Win98

13. disconnect from samba without loggin off from Windows