# Cups + Samba How to

## Amemes

Many people have problems with this so I try to help you guys and girls  :Smile: 

I first show you simple configuration files then explain a little bit.

Samba configuration(everybody can print):

[global]

workgroup = WORKGROUP

server string = Samba Server %v

printcap name = cups

load printers = yes

printing = cups

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

max log size = 50

map to guest = bad user

security = user

encrypt passwords = yes

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

socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192

dns proxy = no

[printers]

   comment = All Printers

   path = /var/spool/samba

   browseable = no

# to allow user 'guest account' to print.

   guest ok = yes

   writable = no

   printable = yes

   create mode = 0700

print command = lpr -P %p -o raw %s -r   # using client side printer drivers.

Okay now uncomment the raw print file support in /etc/cups/mime.convs and mime.types.

Now setup your printer in cups as a raw printer.On your windows clients install the drivers for your printer(choose the printer in the network).The spool options for your windows clients must be set to raw.Now you can print from your windows clients even when there is no driver available for linux!!!

If you also want to print from the linuxbox itself you must install the printer again but now with the real driver (not raw printer) and in linux choose that printer to print.

I hope this helps some people  :Smile: 

----------

## berhr

Thanks for the tip, Amemes. I was having problems sharing a printer connected to my Gentoo machine via Samba, and this was the answer I needed!

I am curious, though, if there is a way to use the same printer for both Linux and Windows, or if it indeed necessary to set up the raw printer in CUPS in addition to the normal one. (As far as I can tell, a single printer setup would involve installing Adobe's generic Postscript printer driver and the correct CUPS PPD file on client machines.) Anyone know the answer to that?

----------

## Kumba

Ahh, this should prove most useful..., A question, though.   Is there a setup available for using Samba to distribute the printer drivers to windows clients still?  I WAS using the old setup which included the "printer driver file" option, however, It seems Samba is getting more vocal in informing me that option will be deprecated soon, so I'm curious if there is a newer way of distributing these drivers via Samba and/or CUPS to Windows Clients.

--Kumba

----------

## Amemes

from the smb.conf.example file:

# This share is used for Windows NT-style point-and-print support.

# To be able to install drivers, you need to be either root, or listed

# in the printer admin parameter above. Note that you also need write #access

# to the directory and share definition to be able to upload the drivers.

# For more information on this, please see the Printing Support Section of

# /usr/share/doc/samba-<version>/docs/Samba-HOWTO-Collection.pdf

;[print$]

;   path = /var/lib/samba/printers

;   browseable = yes

;   read only = yes

;   write list = @adm root

Hope this helps you but you could of course share a folder with the drivers.

----------

## chromeless

I am trying to get samba running on my box and i am trying to define local shares ..... the thing is my smbd starts up fine using /etc/init.d/samba but then nmbd refuses to start up. I have tried fiddling around with smb.conf and have added allow host=127.0.0.1 to it under [globals] but then nmbd still refuses to start up. Can nmbd run if the hostname is something like localhost ? If so how can it be done and what kind of configuration do i need to do ?

----------

## iKiddo

I've got a printer hooked up on a windows box (my mom's, can't change anything about it :/ ). Is it possible to use that printer with smbclient ?? (I've got LinNeighborhood already using smbclient and I don't want to go through the hassle of installing Samba to be honest.

----------

## Kumba

Okay, been following some Gentoo and Samba documentation on all this, and I've hit some snags (again).

Currently, I _can_ print to my printer, which is a Canon BJC-620, hooked to the parallel port of my linux box, from my windows machine(s).  However, I still cannot get driver downloads to work, and the samba documentation only gives examples for utilizing Adobe's Generic Postscript Drivers.  What I want to do, is be able to use CUPS, Samba, and have it distribute the Windows NT Raster Drivers (which I have) that work for this specific model of Canon Printer.

This entire setup worked semi-flawlessly before (using Samba and  LPD, && "printer driver file" smb.conf option(s)), the only exception being when there was a sheetfeeder error, which resulted in the print job getting screwed up, and the printer tries to print off about ~200 pages of garbage.  This itself was resolved by shutting down LPD, deleteing everything in the spool folder, restarting LPD.  Aside from that minor quirk, network printing and driver download with Samba was a breeze.

Anyone got any idea as to go about pulling this off?

--Kumba

----------

## Jasper

I'm looking for a way to print _to_ my windows box from my linux box(So the other way around), if you could help me with that it would be very appreciated  :Very Happy: 

----------

## Mpemba Effect

I had to add the line

```

use client driver = Yes

```

To get it working on win2000 and XP clients. Otherwise a "access denied" error comes up in the status.

I also had to add the lines

```

lpq command = lpstat -o %p

lprm command = cancel %p-%j

```

To successfully print on my HP Deskjet 870. Hope this helps anyone still struggling to get printing working  :Smile: 

 *Jasper wrote:*   

> I'm looking for a way to print _to_ my windows box from my linux box(So the other way around), if you could help me with that it would be very appreciated 

 

In cups theres an option to add a windows printer via samba  :Smile: 

----------

## TheCoop

is there a way of allowing access without a passwod?

----------

## Mpemba Effect

 *TheCoop wrote:*   

> is there a way of allowing access without a passwod?

 

What to a samba share?

----------

## Tiganu

 *Jasper wrote:*   

> I'm looking for a way to print _to_ my windows box from my linux box(So the other way around), if you could help me with that it would be very appreciated 

 

Here's how I got CUPS to work with a windows shared HP LaserJ 6p:

http://gentoo.org/doc/printing-howto.html  :Wink: 

Everything work ok until you try to use samba, so here's how i did it:

emerge the software

then in '/usr/lib/cups/backend/' do this:

```

$ cd /usr/lib/cups/backend/

$ ln -s /usr/bin/smbspool smb
```

(found it in the cups docs, this emables the smb printing)

then install foomatic from sources (for the printer defs), and (in my case):

```
$  foomatic-configure -s cups -p 152585 -c smb://Guest:print@-alex-/HPLaserJ -n lp0 -d ljet4
```

where: 

'-p 152585'  - printer id

'-alex-' -  the NMB name for the windows machine

'HPLaserJ ' - the printer share

Cheers

----------

## Kumba

This just isn't working for me.  as I stated above, it all worked fine when Samba used the "printer driver file" option, but now because that's a deprecated option, everything just ain't working anymore.  

CUPS has a stuck document -- a print off of an eBay webpage I tried just to test to see if the driver worked or not.  I can't seem to get rid of it, even though I've somehow kludged CUPS to let me connect to (http://)mylinuxboxsIP:631 (I do not have X installed on the linux machine, so connecting to localhost:631 is out of the question, I must use a GUI Web browser from my Windows box).  This stuck document just keeps re-printing itself if I turned CUPS back on.

The Samba documentation (Samba-HOWTO-Collection.pdf, Chapter 7, Subsection 3) refers to the ability to use Samba + CUPS as a "raw" Printing Spooler with vendor driver download.  Yet I find no documentation to readily setup up _this_ specific configuration.  The configuration the above-mentioned Samba documentation does give is how to use CUPS and Adobe's Universal PostScript drivers (Samba-HOWTO-Collection.pdf, Chapter 7, Subsections 4 and 6).

Perhaps the Gentoo Printing HOWTO could be updated with additional information on using Samba + CUPS as a raw print spooler in addition to the other topics covered.  If I knew the steps, I might even offer to do it myself, but alas, I am left in the dark on this, and google searches don't seem to turn up much relevant data on the subject.

--Kumba

----------

## berhr

 *Tiganu wrote:*   

> then install foomatic from sources (for the printer defs), and (in my case):
> 
> ```
> $  foomatic-configure -s cups -p 152585 -c smb://Guest:print@-alex-/HPLaserJ -n lp0 -d ljet4
> ```
> ...

 

Just a quick note: although the Gentoo Printing HOWTO mentions installing foomatic from source, it's not strictly necessary. I was able to get my HP DeskJet 932 working perfectly by using the PPD file that was generated for my printer at this site. I did not need to install foomatic for this to work.

If it helps anyone with their configuration, I installed two printer queues in CUPS, but both point to the same physical printer located at "USB Printer #1". One uses the PPD file generated at the URL I mentioned above; the other was set to use the "Raw" CUPS driver. (I named the former "DJ932C" and the latter "DJ932C_RAW"). Using this configuration, I can print from my Linux box to the first printer queue (DJ932C). In that case, the PPD file is used, which in turn tells CUPS to run the print file through the HPIJS driver that I installed for my printer.

To get printing to work from my Windows XP laptop, I used Windows' My Network Places to find my Linux box, and both my CUPS printers were showing up (I believe the smb.conf.example file included with Gentoo's Samba installation is set up to automatically share all configured CUPS printers). I right-clicked the DJ932C_RAW printer, and clicked Connect... in Windows. Using the subsequent Windows wizard, I installed a printer using the already-installed, native Windows drivers for my printer. (I have not tried to set up the automatic driver downloading for Windows, so I can't help there). Doing this gave me flawless printing across the network to my Linux machine - Windows uses its own drivers to create the print file, which is sent via SMB to my Linux box. From there, it is spooled directly to my printer (without going through any PPD files or HPIJS) because I set the DJ932C_RAW queue to be a raw queue in CUPS.

I can try to provide more detailed information about the steps I took if anyone needs it. Otherwise, I wish everyone luck getting their printers working!

----------

## Mpemba Effect

Thats what I did too  :Smile:  ... setup two printers in cups one RAW for windows and one with a cupsomatic generated ppd for LInux printing  :Smile: 

----------

## Kumba

Okay, this is what I was doing wrong.  I thought I needed both the raw printing and the PPD file to get Windows -> Linux printing to work.  Now the question is how to get driver downloads to work.  Samba's HOWTO, states that by modifying [print$] section, it is possible to get driver downloads to work, but does not state any information on what to modify to enable this.

If anyone has any suggestions, I'm all ears...

--Kumba

----------

## arkane

I've been trying to do it the other way around.  I have an HP-3420 hooked up to my other machine that runs Windows 2000.  linuxprinting.org says it's a paperweight under Linux, so it's fairly useless on this machine.  Since it works under Win2K, I figured I could print via cups using the "Windows Printer via SAMBA" option... I haven't had any luck in that matter.  Windows throws up an error saying "there was an error found when printing the document 'remote downlevel document' to usb002. do you want to retry or cancel the job?".  I wish to god I never bought this printer, but I'm stuck with it, unfortunately.  (wife needed an inexpensive printer to use in school for colour pictures... was going to pick up the 920 but they were out of stock  :Sad: 

----------

## jimlynch11

 *Tiganu wrote:*   

>  *Jasper wrote:*   I'm looking for a way to print _to_ my windows box from my linux box(So the other way around), if you could help me with that it would be very appreciated  
> 
> Here's how I got CUPS to work with a windows shared HP LaserJ 6p:
> 
> http://gentoo.org/doc/printing-howto.html 
> ...

 

ok so i ran the appropriate commands and the printer showed up in the little cups menu.  i went to print a test page, and nothing happened, no print, no error message, nothing.  any ideas how i can fix this?

----------

## b3

Just wanted to note that setting up the second instance of the printer, using the RAW driver works perfectly here.  Things to remember:

Set up local printing via foomatic or whatnot using the "regular" linux printing FAQs

Then, once that's working and recognized by CUPS, add the second "RAW" printer (and give it a different name)  Just point it at the right port, and keep selecting "RAW" whenever possible.

Remember to modify the /etc/cups/mime.convs and /etc/cups/mime.types and uncomment the lines for RAW access!  (This one's easy to miss...  :Embarassed:  )

Now, once both printers are installed in CUPS, go about setting up Samba.  The smb.conf in the first post on this thread has all the necessary elements.

Restart both CUPS and Samba before you go to the WIndows machine to set things up (not sure if this is required, but it can't hurt)

Now, on the WIndows machine, go to the Printers control panel, and select "Add New Printer".

When asked, select "Network Printer".  A list of machine names on the network should come up.  Select the one your printer is attached to, and you *should* see both instances of the printer.  Choose the "RAW" one, and Windows should complain about drivers.  Let it search (this can take a while).  Then when the driver select box comes up, just choose the right driver, and you should be all set!

I think that's everything I did.  Thanks for this!

----------

## b0fh

 *Quote:*   

> '-p 152585' - printer id 

 

Well, where do I get this printer ID? I don't see anything at the database...

----------

## rum

 *Quote:*   

> I've been trying to do it the other way around. I have an HP-3420 hooked up to my other machine that runs Windows 2000. linuxprinting.org says it's a paperweight under Linux, so it's fairly useless on this machine. Since it works under Win2K, I figured I could print via cups using the "Windows Printer via SAMBA" option... I haven't had any luck in that matter. Windows throws up an error saying "there was an error found when printing the document 'remote downlevel document' to usb002. do you want to retry or cancel the job?". I wish to god I never bought this printer, but I'm stuck with it, unfortunately. (wife needed an inexpensive printer to use in school for colour pictures... was going to pick up the 920 but they were out of stock 

 

I have the same issue.

I set up my gentoo box to print to windows XP machine with a hp laserjet 1000.

With the [HP laserjet series CUPS v1.1] driver the Windows printer queue says:

 *Quote:*   

> Document Name : Remote Downlevel Document  
> 
> Status: Printing  <----!!!!! It says its doing it ... but the *#($@! is not.
> 
> User: Guest
> ...

 

Unfortunately I do not know about a Windows log to tell me about the status of the file (ie completed, error, halted).  It just gets deleted from the queue, so i dont know if it thinks it has done its job or not.

A little info:

Printer = HP laserjet 1000   

These logs were taken from /var/log/cups/error_log with the log level set to "debug" in /etc/cups/cupsd.conf

I set up 2 cups printers to try different drivers : 

The first one has a slight rendering issue: 

HP Laserjet 1000 foomatic/foo2zjs (recommended) 

Debug output:

 *Quote:*   

> D [02/Aug/2003:23:27:20 +0000] [Job 54] Starting renderer
> 
> D [02/Aug/2003:23:27:20 +0000] [Job 54] JCL: <job data>
> 
> D [02/Aug/2003:23:27:20 +0000] [Job 54] 
> ...

 

The HP laserjet series CUPS v1.1 allows me to see the windows printer queue (see where i get pissed above because it says it is printing but it doesnt).

This is HP laserjet series CUPS v1.1 with the following debug output:

 *Quote:*   

> D [02/Aug/2003:23:29:15 +0000] [Job 55] cups->ppd->flip_duplex = 0
> 
> D [02/Aug/2003:23:29:15 +0000] [Job 55] width = 2400, height = 3000
> 
> D [02/Aug/2003:23:29:15 +0000] [Job 55] PageSize = [ 612 792 ], HWResolution = [ 300 300 ]
> ...

 

Is this due to poor driver configuration?

Poor samba configuration?

Poor cupsd configuration?

or just windows being retarded. 

Any help would be appreciated.  Thanks.

----------

## ngyahloon

Hei, if you wanna use CUPS, LPD etc with all the available cool printer settings, check out LinuxPrinting.org . There's lotsa useful hints there. Might consider using Kprinter. It's a nice tool for printer configuration with easy interface, especially the driver setup part. Saved me lotsa problems. Cheers

----------

## lucindrea

finnaly i can print postage agin   :Laughing:   ( bill colectors get upset when you dont sent themsomthing hehe )  ....

nice to be able to use up my ink agin

----------

## wb1975

I follow the guide , my xerox just keep blinking when I print a file ... but nothing happen ... I saw from linuxprinting ,seem this is a GDI printer ... but I 'm not print from my grntoo box . I 'm using raw 

printing ,so what happen ? is this printer need some ppd file ? in the cdrom supplied ,they have include a 

ppd file ...

 thanks in advance

----------

## firaX

 *Quote:*   

> [2003/11/29 20:03:56, 1] smbd/ipc.c:api_fd_reply(284)
> 
>   api_fd_reply: INVALID PIPE HANDLE: 707a
> 
> [2003/11/29 20:09:02, 1] smbd/ipc.c:api_fd_reply(284)
> ...

 

getting that error in my log.windowsXPclient file  :Sad:  no error on windows, its just not printing  :Sad: 

Also since samba 3.0.0 my home dirs dont show up on the clients machines anymore :/

----------

## radonsg

Keep getting error, can anyone help?

foomatic-configure -s cups -p Brother-MFC-9600 -c file:smb://user:pass@192.168.0.3/print -n printer -d gimp-print hl1250 ljet2p

lpadmin: add-printer (set device) failed: client-error-not-possible

Could not set up/change the queue "printer"!

Thanks.

----------

## Benji-Boy

 *wb1975 wrote:*   

> I follow the guide , my xerox just keep blinking when I print a file ... but nothing happen ... I saw from linuxprinting ,seem this is a GDI printer ... but I 'm not print from my grntoo box . I 'm using raw 
> 
> printing ,so what happen ? is this printer need some ppd file ? in the cdrom supplied ,they have include a 
> 
> ppd file ...
> ...

 

Yes you need to include the ppd file in the conf files.

unless you are printing _from_windows_to_linux_ in which case RAW is correct.

If you are printing from your linux box you need to include the ppd file as i understand it.

Good luck,

B.

----------

## Benji-Boy

Hi guys,

I am trying to get my Linux box and open office suite to print to a remote print queue.

I have successdully managed to print so far in this way:

```

smbclient //printserv/hp228 -I IP.ad.dr.ess -N -c 'print filename.ps'

```

where printserv is the server name and it is located at IP.

This method has obvious drawbacks.

Thus far using the HOWTO in this forum I have installed and am running samba & cups.'

I have had no luck configuring the KDE printmanager successfully though.

Yes: i have a valid .ppd for the HP LaserJet 4300 postscript printer.

Yes: i have the symlink for smb backend.

To my understanding i need to run a local CUPS server of whatever name that 'prints' files in postscripts format to the printserv queue.

this requires me to emerge CUPS and samba, run the servers after 

I install the required ppd file for the destination printer.

Then setup the CUPS print server through the KDE print manager wizard or via the web interface.

Q: Within KDE PM or localhost:631/admin, 

I add a printer:

I select Smb share printer (windows)

option 1) put in the name of the CUPS server (not very sensible)?

option 2) put in //printserv/hp228

option 3) put in //printserv

with the name n the next page = hp228.

Then when prmpted with the options select the hp LJ 4300 ppd for config.

with option 2&3)

I get messages that the test pages i am trying to print are printing successfully but nothing is actually coming out at the printer. I can see them stuck in the print queue through the admin pages online.

Can you guys see anything i am missing?

Any questions to clarify or requests to post config files etc?

Thanks in advance or your help.

Benji-Boy

----------

## Benji-Boy

FYI I can also ping both hp228 and printserv

Benji-Boy

----------

