Problems using samba to share printers


Forum: Networking
Topic: Problems using samba to share printers
started by: Juanito

Posted by Juanito on Aug. 02 2007,17:42
I'm not sure whether this topic should be in printers or networking but here goes...

After finally getting printing set up in dsl with cups and hplip, I'd like to use samba to share a printer/fax/scanner with other dsl and windows machines on the same small local network. I can manage to mount a windows share on dsl, but so far I didn't make much progress with sharing a printer.

The idea is that cups/samba will make the printer drivers available to the windows machines, but I don't seem to be getting very far:
Code Sample
$ sudo /opt/hplip/sbin/cupsaddsmb -U root -v -a
Password for root required to access /opt/hplip/var/run/cups/cups.sock via SAMBA:
Running command: smbclient ///opt/hplip/var/run/cups/cups.sock/print$ -N -A /opt/hplip/var/spool/cups/tmp/46b2849c180f2 -c 'mkdir W32X86;put /opt/hplip/var/spool/cups/tmp/46b28497f1946 W32X86/OfficeJetG85.ppd;put /opt/hplip/share/cups/drivers/ps5ui.dll W32X86/ps5ui.dll;put /opt/hplip/share/cups/drivers/pscript.hlp W32X86/pscript.hlp;put /opt/hplip/share/cups/drivers/pscript.ntf W32X86/pscript.ntf;put /opt/hplip/share/cups/drivers/pscript5.dll W32X86/pscript5.dll'
creating lame upcase table
creating lame lowcase table
Connection to  failed


Here's the smb/conf file I'm using:
Code Sample
# Samba config file created using SWAT
# from 127.0.0.1 (127.0.0.1)
# Date: 2007/08/02 20:40:04

[global]
workgroup = JUANITO
printcap name = /opt/printcap
valid users = dsl
printing = cups
print command =
lpq command = %p
lprm command =

[printers]
comment = All Printers
path = /var/spool/samba
guest ok = Yes
printable = Yes
browseable = No

[print$]
comment = Printer Drivers
path = /etc/samba-3/drivers
write list = root
Can anybody see any obvious mistakes?

Posted by stevesr0 on Aug. 06 2007,23:47
I am trying to share printers on a home network and have been looking at cups use in windows.  I want to raise two points relevant to the principles for setting this up, rather than technically analyzing your code.  Hopefully, this will be useful to both of us<g>.

(1) I understand that Samba may not be necessary when setting up a CUPS printer in windows.  Apparently, this can be done based on the windows IPP support which is CUPS compatible.  I haven't completely digested the various memos I have read, but there is a type of printer that can be set up with the "http" version of IPP.  

(2) I believe that printer drivers are OS specific, you have to load a windows driver for the windows machine and a linux driver for the linux machine.  For linux, many of these are available from gimp-print and of course there are specific windows drivers for most printer models.    

Steve

Posted by Juanito on Aug. 07 2007,12:09
Quote
I believe that printer drivers are OS specific, you have to load a windows driver for the windows machine and a linux driver for the linux machine
The files I am trying upload to samba are the cups and adobe ps drivers for windows. These would be passed to the windows machine the first time it tries to connect to the cups/samba shared printer.

Posted by ^thehatsrule^ on Aug. 07 2007,14:48
Here's a sample one: < http://lists.samba.org/archive/samba/2002-July/048018.html > where it shows "use client driver" ... so maybe you can do it both ways.

Quote
print command =
lpq command = %p
lprm command =
Just wondering why these aren't filled in...?  And I think printcap name is just a name...

Quote
Running command: smbclient ///opt/hplip/var/run/cups/cups.sock/print$ -N -A /opt/hplip/var/spool/cups/tmp/46b2849c180f2 -c 'mkdir W32X86;put /opt/hplip/var/spool/cups/tmp/46b28497f1946 W32X86/OfficeJetG85.ppd;put /opt/hplip/share/cups/drivers/ps5ui.dll W32X86/ps5ui.dll;put /opt/hplip/share/cups/drivers/pscript.hlp W32X86/pscript.hlp;put /opt/hplip/share/cups/drivers/pscript.ntf W32X86/pscript.ntf;put /opt/hplip/share/cups/drivers/pscript5.dll W32X86/pscript5.dll'
I don't think there's a "put" command included in dsl... unless it's in one of your hplip extensions?

Some more info here: < http://www.samba.org/samba....ng.html >

Posted by Juanito on Aug. 08 2007,18:13
Quote
I don't think there's a "put" command included in dsl... unless it's in one of your hplip extensions?


Aah - that might explain something... I take it that "put" is the one from ftp?

Posted by Juanito on Aug. 31 2007,13:09
In fact the main mistake I was making after modifying smb.conf was:
Code Sample
$ smbd restart
$ nmbd restart

should have been

$ sudo smbd restart
$ sudo nmbd restart
aaargh - you'd think there'd be an error message.

Now things look more promising:
Code Sample
$ /opt/hplip/sbin/cupsaddsmb -H localhost -U root -a -v
Password for root required to access localhost via SAMBA:
Running command: smbclient //localhost/print$ -N -A /tmp/46d86d9748516 -c 'mkdir W32X86;put /tmp/46d86d922450d W32X86/OfficeJetG85.ppd;put /opt/hplip/share/cups/drivers/ps5ui.dll W32X86/ps5ui.dll;put /opt/hplip/share/cups/drivers/pscript.hlp W32X86/pscript.hlp;put /opt/hplip/share/cups/drivers/pscript.ntf W32X86/pscript.ntf;put /opt/hplip/share/cups/drivers/pscript5.dll W32X86/pscript5.dll'
Domain=[DSLKAYAK] OS=[Unix] Server=[Samba 3.0.25b]
putting file /tmp/46d86d922450d as \W32X86/OfficeJetG85.ppd (2943.0 kb/s) (average 2943.0 kb/s)
putting file /opt/hplip/share/cups/drivers/ps5ui.dll as \W32X86/ps5ui.dll (1660.3 kb/s) (average 1779.6 kb/s)
putting file /opt/hplip/share/cups/drivers/pscript.hlp as \W32X86/pscript.hlp (908.1 kb/s) (average 1565.5 kb/s)
putting file /opt/hplip/share/cups/drivers/pscript.ntf as \W32X86/pscript.ntf (3486.8 kb/s) (average 2834.9 kb/s)
putting file /opt/hplip/share/cups/drivers/pscript5.dll as \W32X86/pscript5.dll (3978.1 kb/s) (average 3124.5 kb/s)

Running command: smbclient //localhost/print$ -N -A /tmp/46d86d9748516 -c 'put /opt/hplip/share/cups/drivers/cups6.ini W32X86/cups6.ini;put /opt/hplip/share/cups/drivers/cupsps6.dll W32X86/cupsps6.dll;put /opt/hplip/share/cups/drivers/cupsui6.dll W32X86/cupsui6.dll'
Domain=[DSLKAYAK] OS=[Unix] Server=[Samba 3.0.25b]
putting file /opt/hplip/share/cups/drivers/cups6.ini as \W32X86/cups6.ini (3.1 kb/s) (average 3.1 kb/s)
putting file /opt/hplip/share/cups/drivers/cupsps6.dll as \W32X86/cupsps6.dll (2454.6 kb/s) (average 440.8 kb/s)
putting file /opt/hplip/share/cups/drivers/cupsui6.dll as \W32X86/cupsui6.dll (2225.2 kb/s) (average 755.7 kb/s)

Running command: rpcclient localhost -N -A /tmp/46d86d9748516 -c 'adddriver "Windows NT x86" "OfficeJetG85:pscript5.dll:OfficeJetG85.ppd:ps5ui.dll:pscript.hlp:NULL:RAW:pscript5.dll,OfficeJetG85.ppd,ps5ui.dll,pscript.hlp,pscript.ntf,cups6.ini,cupsps6.dll,c

upsui6.dll"'
Printer Driver OfficeJetG85 successfully installed.

Running command: rpcclient localhost -N -A /tmp/46d86d9748516 -c 'setdriver OfficeJetG85 OfficeJetG85'
Succesfully set OfficeJetG85 to driver OfficeJetG85.

Now - finally - windows machines can see a shared folder on my dsl desktop and they can see the printer and download the drivers automatically on double-clicking the printer icon.

Edit: note that for the above to work, security has to be set to "user" in smb.conf. Once the windows machine has downloaded the printer drivers, security can be reset to "share"

...trouble is, the windows machines cannot copy a file to the dsl share nor does anything print. Back to reading the samba manual  :(

Posted by Juanito on Sep. 01 2007,15:11
I've now got to the point where:

1. Both a w2k and an xp machine can read and write to a share mounted on a dsl machine (when they mount the share as root).
2a. The w2k machine can see a printer on the dsl machine but gives an "access denied" error when I try to add the printer.
2b. The xp machine installs the printer on the dsl machine but gives an "access denied" error when I try to print.

I would like the windows machines to access the printer on the dsl machine without the need for a username or password (in any case I don't believe windows would ask for a password when trying to add a printer).

Does anyone know where I'm going wrong from the conf files below?

smb.conf:
Code Sample
[global]
workgroup = JUANITO
netbios name = DSLKAYAK
hosts allow = 192.168.1.
security = share
load printers = yes
printing = cups
printcap name = cups

[share]
path = /mnt/sdb4/dslshare
read only = no
browseable = yes
guest ok = yes

[printers]
comment = All Printers
path = /var/spool/samba
browseable = yes
public = yes
guest ok = yes
writable = no
printable = yes

[print$]
comment = Printer Drivers
path = /opt/hplip/share/cups/drivers
browseable = yes
guest ok = no
read only = yes
write list = root


cupsd.conf:
Code Sample
LogLevel info
Port 631
Listen /opt/hplip/var/run/cups/cups.sock
Browsing On
BrowseAddress 192.168.1.255

<Location />
 Order Deny,Allow
 Deny From None
 Allow From 192.168.1.*
 Allow From 127.0.0.1
</Location>

<Location /admin>
 AuthType Basic
 AuthClass System
 Allow From 127.0.0.1
 Order Deny,Allow
 Deny From All
</Location>

Posted by Juanito on Sep. 02 2007,15:45
hmm - seems the solution was as simple (or obscure) as:
Code Sample
$ sudo chown -R dsl /var/spool/samba
$ chgrp -R staff /var/spool/samba
$ chmod 777 /var/spool/samba
$ cmod o+t /var/spool/samba

This allows an xp box to print to a printer shared by my dsl desktop, and now onto sharing the scanner...

Posted by stunix*com on Oct. 28 2008,12:59
Juanito,
looks like you had lots of fun with this.  Im re tracing your steps trying to achive the same goal, but Im a little confused.  I dont suppose you managed to bullet point what you did from the beginning to create some sort of simple "howto" to put up here?
just cups, samba and a hp4 driver.

appriciated.

stu

Posted by Juanito on Oct. 28 2008,13:38
Well, one year on it all still works fine - the cups and samba conf files are posted above, the cups windows driver is in the cups extension - which particular part are you having problems with?

(note also that there is an explanation in the cups-1.3.x.uci and samba-3.uci info files)

Powered by Ikonboard 3.1.2a
Ikonboard © 2001 Jarvis Entertainment Group, Inc.