# Network printing :  how to start?

## srlinuxx

Hi folks.  I've been pounding away at this server and this week is printer sharing.  I have a printer hooked up parallel port to one of the machines in our home network.  I was hoping other linux and windows boxes could print to it.   But I'm kinda lost as to how to go about this.  The printer does work on the machine it's hooked up to (or did before I started fiddling around), but the rest of the network doesn't see it.  

Here comes the questions:  Can I share a printer hooked up to this client machine or does it have to be connected to the server?

If I can have it connected to client machine, does samba server and cups server need to be on both the server as well as the client box?

I tried to setup cups & samba on the server and on the client machine, but I'm not having much luck with it.  The foomatic-configuration don't like the smb://user:password@server/share bit.  Does that need to be actual users or is this like a formula?

Thanks in advance,

Susan

----------

## Spinwing

 *Quote:*   

> 
> 
> The printer does work on the machine it's hooked up to (or did before I started fiddling around), but the rest of the network doesn't see it. 
> 
> 

 

Question: what OS is running the client where the printer is hooked up?

 *Quote:*   

> 
> 
> Here comes the questions: Can I share a printer hooked up to this client machine or does it have to be connected to the server?
> 
> 

 

A server in general is something that offers a service. In this respect, the client will be offering the service of printing to the network, and therefore will be a server and a client at the same time.

 *Quote:*   

> 
> 
> If I can have it connected to client machine, does samba server and cups server need to be on both the server as well as the client box?
> 
> 

 

You do not need them on the server if the server is not printing and not sharing, but you definetly need cups for printing and samba for windows printing on the client in order to provide the service.

Hope this helps

Spinwind

----------

## srlinuxx

 *Quote:*   

> 
> 
> Question: what OS is running the client where the printer is hooked up?
> 
> 

 

gentoo current.  

 *Quote:*   

> 
> 
> A server in general is something that offers a service. In this respect, the client will be offering the service of printing to the network, and therefore will be a server and a client at the same time.
> 
> 

 

Yeah, I was just speculating that with a friend.  ...wondering if I need samba & cups on the "server" at all.

 *Quote:*   

> 
> 
> You do not need them on the server if the server is not printing and not sharing, but you definetly need cups for printing and samba for windows printing on the client in order to provide the service.

 

Thanks, yes it helps some.  I'm not having a lot of luck as the "client" with the printer won't take the "foomatic-configure command.   

You don't by chance know the config file that command writes do ya?

thanks, 

-s

----------

## Ateo

Here are the steps I used to reach the result you want.

On the client to which the printer is attached to, you need to make sure you have enabled parallel printer support in your kernel (built-in or module, makes no difference) AND you need to install all the packages used to maintain and share the printer.

```
USE="cups foomaticdb ppds" emerge samba cups foomatic foomatic-db

** Note: emerge hpijs if you have an HP printer
```

Make sure samba is compiled with cups support or samba won't load cups drivers, etc.

Once you have re-compiled your kernel and installed the above packages, you'll need to grab your printer's PPD file from linuxprinting.org. Use this link and just enter your printers information here and download it's PPD file and save it to --> /usr/share/cups/model. This step is the same as running the foomatic configuration commands thus negating the need to do that particular step. Start cups:

```
/etc/init.d/cupsd start
```

Once cups has started, add your printer using this url --> http://127.0.0.1:631. Adding a printer is pretty obvious. Once you add you printer print a test page to verify it prints.

Now configure /etc/samba/smb.conf. This is all you really have to add to smb.conf, assuming you already have samba running and sharing mount points:

```
   printcap name = cups

   printing = cups

   load printers = yes

[print$]

   comment = Printer Drivers

   path = /etc/samba/printer

   public = yes

   guest ok = yes

   browseable = yes

   read only = yes

   write list = root,other,users,separated,by,commas

[printers]

   comment = All Printers

   browseable = yes

   guest ok = yes

   printable = yes

   public = yes

   path = /var/spool/samba

   printer admin = root,other,users,separated,by,commas

```

Start/restart samba:

```
/etc/init.d/samba [re]start
```

At this point, all of your windows clients should be able to browse the network and see the printer.

To share the printer with other linux machines, you will need to install cups, configure /etc/cups/client.conf and start cups. /etc/cups/client.conf is really easy to configure. My file consists of 2 lines:

```
ServerName my.servers.nisdomain.name

Encryption IfRequested

```

Start cups....

Once cups is started, goto http://127.0.0.1:631 and click printers and the printer from your printer server should be listed.

This should actually do it for you. If you need more information, the guide I followed can be found here. Please note that if you can't find your printer's PPD file at linuxprinting.org, odds are linux does not support your particular printer.

HTH

----------

## srlinuxx

I'm still not having much luck.  It's a big ole mess here I gotta say.  I spent two days writing smb.conf files with varying degrees of success and finally stole one from a mandrake install that will allow limited sharing.  Printing is still a big ole bust tho.  Windows thinks it's printing away, but nothing ever makes it to the spool of the machine printer is connected to.  My linux machines can't even see the printers.  I tried your entries and the ones in that mandrake file.  I ain't never had such a hard time getting something to work.  Is it me or is samba kinda hit and miss by nature?

Can I see your complete smb.conf for your linux machines please?  Thanks.   :Smile: 

----------

## Ateo

 *srlinuxx wrote:*   

> I'm still not having much luck.  It's a big ole mess here I gotta say.  I spent two days writing smb.conf files with varying degrees of success and finally stole one from a mandrake install that will allow limited sharing.  Printing is still a big ole bust tho.  Windows thinks it's printing away, but nothing ever makes it to the spool of the machine printer is connected to.  My linux machines can't even see the printers.  I tried your entries and the ones in that mandrake file.  I ain't never had such a hard time getting something to work.  Is it me or is samba kinda hit and miss by nature?
> 
> Can I see your complete smb.conf for your linux machines please?  Thanks.  

 

I had my share of issues while trying to get network printing (on my server) when I bought a new USB Samsung printer. My old one was a parallel printer. It turned out that loading the print support driver as a module worked best for me. You might want to try that if you haven't.

Anyways, below is my smb.conf on the server that hosts my USB printer, aka, my printer server. Once you get samba working correctly, the printer just shows up under windows network neighborhood. Once it appears there, you can add the printer to your windows workstation. This is my /etc/samba/smb.conf file, in it's entirety:

```
[global]

   workgroup = MYWORKGROUP

   server string = MYCOMPUTERNAME [Gentoo/Samba server %v]

   printcap name = cups

   printing = cups

   load printers = yes

   log file = /var/log/samba3/log.%m

   max log size = 50

   socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192

   interfaces = 192.168.4.253

   bind interfaces only = yes

   hosts allow = 192.168.4.0/24

   hosts deny = 0.0.0.0

   security = user

   map to guest = bad user

   encrypt passwords = yes

   smb passwd file = /etc/samba/private/smbpasswd

   dns proxy = no

   printer admin = dracco,root

   print command = lpr-cups -P %p -o raw %s -r

#============================ Share Definitions ==============================

[print$]

   comment = Printer Drivers

   path = /etc/samba/printer

   public = yes

   guest ok = yes

   browseable = yes

   read only = yes

   write list = dracco,root

[printers]

   comment = All Printers

   browseable = yes

   guest ok = yes

   printable = yes

   public = yes

   path = /var/spool/samba

   printer admin = dracco,root

[homes]

   comment = Home Directories

   browseable = no

   writable = yes

   guest ok = no

[public]

   comment = Public Stuff

   public = yes

   write list = dracco,root

   path = /storage/public

```

I left cups.conf with default settings. I did, however, add a couple of configs. The following is what I added to /etc/cups/cups.conf:

```
<Location /admin>

AuthType Basic

AuthClass System

Order Deny,Allow

Deny From All

Allow From 127.0.0.1

Allow From 192.168.4.0/24  <-- Added my network as to be able to administer from any computer on my lan

</Location>

<Location />

Order Deny,Allow

Deny From All

Allow From 127.0.0.1

Allow From 192.168.4.0/24 <-- Added my network as to be able to access the printer from any computer on my lan

</Location>
```

Finally, to allow OTHER linux machines to access this cups printer, install cups on those OTHER linux machines. You'll probably want to start cups on boot on these client machines. Once installed, you need to at least take a look at /etc/cups/client.conf:

```
ServerName nis.domain.com

Encryption IfRequested

```

client.conf only has 2 directives. Make sure "ServerName" is the nisdomainname of the machine that your printer is attached to.

This is all I have done to get my network printing working. However, one small problem exists. I can printer from any windows platform except Win98. Weird issue but I could care less since the Win98 machine is a company laptop.

Also, are your certain your printer is supported? Did you find your printers PPD file @ linuxprinting.org? If you are able to find the PPD file for your printer, you do not have to configure cups via the foomatic command.

Another thing. After installing samba, did you create samba users? Your linux users are not the same as your samba users thus you need to add users to samba:

```
samba -a <NEW_USER>
```

Where "NEW_USER" is any username you want. It does not have to be copy of a current linux user on your system but I suggest using the same usernames and passwords....

HTH

----------

## srlinuxx

 *Ateo wrote:*   

> 
> 
> Another thing. After installing samba, did you create samba users? Your linux users are not the same as your samba users thus you need to add users to samba:
> 
> ```
> ...

 

Thanks, I did the smbpasswd -a <user> thing (is that what you mean), but I tried setting up the same users as already present on all the machines.  I even used the same passwords, and set the security level to user where it'd just use the regular ole unix pam thing.  But kicker is, I set up guest and gave all priviledges and a blank password and I'm getting all kinds of incorrect password errors and bad network name errors even for actual users using their passwords.

But I'm gonna try your scripts (modified) next.  Can I by chance see your master/main server's .conf?  Thanks so much for helping.

----------

## Ateo

 *srlinuxx wrote:*   

> Can I by chance see your master/main server's .conf?  Thanks so much for helping.

 

Master/main config file for which service? I'd be happy to post it for you. I'm just not sure which one...

Let me know.

----------

## srlinuxx

 *Ateo wrote:*   

>  *srlinuxx wrote:*   Can I by chance see your master/main server's .conf?  Thanks so much for helping. 
> 
> Master/main config file for which service? I'd be happy to post it for you. I'm just not sure which one...
> 
> Let me know.

 

I was hoping to see your master server's smb.conf.  I was able to get shares working and the printers to show up on windows and in smbtree on linux, but nothing will print to it.  I guess I don't have it set up properly in samba yet.  I've tried to follow a few howtos, but no real luck yet.  

Is it necessary to have windows drivers for samba or is that an outdated procedure, do ya know?

I commented out everything about printers in my master server's smb.conf (as you'll recall I'm wanting to run printer off another "client" machine) and I tried dnat'in the traffic on that port to that particular machine.  Is either of these not a good idea?

----------

## srlinuxx

Woohoo.  Ok, I got it now.   :Smile:   Thanks for all your help, it was truly invaluable.

----------

## fostix

HTH says  *Quote:*   

> Once cups has started, add your printer using this url 

 

My question is "How do you do that"  :Question: 

Attempted: Url - that means you need a browser - so I opened the Konqueror Browser on my laptop runing KDE and typed in the URL.  I got the error message that it could not connect to host 127.0.0.1 port 613.

Thanks in advance.   :Very Happy: 

fostix

----------

