Configuring Samba to allow Use of CUPS printer

29,356

Solution 1

  • If your not too attached to using Samba you can share a printer using IPP:

    The preferred way to connect a Windows client to a Linux print server is using IPP. It's a standard printer protocol based on HTTP, allowing you all ways to profit from port forwarding, tunneling etc. The configuration is very easy and this way is less error-prone than using Samba. IPP is natively supported by Windows since Windows 2000. To configure the server side you need to enable browsing in /etc/cups/cupsd.conf, by adding the line "BrowesAllow all":

     Browsing On
     BrowseOrder allow,deny
     BrowseAllow @LOCAL
     BrowseAllow all
    

    On the Windows computer, go to the printer control panel and choose to 'Add a New Printer'. Next, choose to give a URL. For the URL, type in the location of the printer: http://host_ip_address:631/printers/printer_name (where host_ip_address is the GNU/Linux server's IP address and printer_name is the name of the printer being connected to).

    After this, install the native printer drivers for your printer on the Windows computer. If the CUPS server is set up to use its own printer drivers, then you can just select a generic postscript printer for the Windows client(e.g. 'HP Color LaserJet 8500 PS' or 'Xerox DocuTech 135 PS2'). Then test the print setup by printing a test page.

  • If you must use Samba to share, you could adding a write list to smb.conf:

    [printers]
    comment = All Printers
    path = /var/spool/samba
    browseable = yes
    guest ok = no
    printable = yes
    create mode=0700
    write list=@adm root <username>
    

All of the above info I found at this wiki, which has more info then what I included here. Hope that helps!

Solution 2

I also had this problem w/ a printer attached to a computer running Ubuntu 12.04, and trying to print from a Windows XP computer. I found out that there is a known bug in samba.

sudo add-apt-repository ppa:louis-bouchard/samba-lp967410
sudo apt-get update
sudo apt-get upgrade

And then I had to have the samba database regenerated.

sudo rm -f /var/lib/samba/registry.tdb
sudo rm -f /var/cache/samba/printing/*
sudo restart smbd
sudo restart mnbd

And then it worked. I have a support contract w/ canonical and they helped fix this.

Solution 3

All the manuals say that under the share options you may have read only = yes. It turned out to me, that write possibility is required (a samba bug?). That's what jpetersen put as write list=@adm root <username>.

When I have no write access, zero sized files appear under /var/spool/samba. When I map the shares as root - I succeed.

Finally I made it work by adding in [printers] section:

read only = no

I also have the following, to simplify things and make debugging and troubleshooting easier:

[global]
max protocol=NT1
smb ports=139
Share:
29,356

Related videos on Youtube

Skizz
Author by

Skizz

I first started programming aged nine in Basic on a Sinclair ZX80, quickly progressing onto Z80 machine code on the ZX Spectrum. This led to the PC platform, an Amstrad 1512, where I learned various flavours of BASIC and 8086 programming, even doing some very rudimentary 3D graphics. Up until this point, everything had been self taught. In 1988 I went to Bradford University to study for an Electronic / Software Engineering degree. This was a thin sandwich style course over four years, the first three were split six months at university and six months on placement in industry. The first year introduced the Pascal programming language and the Unix operating system at university and C during the placement. Subsequent years concentrated on C and assembly language for various platforms – mainly Motorola and Transputer based as well as Sun Unix systems. Upon completing my degree I developed and had published my first PC game. This led the way to further jobs in the games industry and it wasn't long before C++ became the language of choice for work. In 2004 I began branching out on my own to work on business solutions. My interest in programming goes beyond work related projects. I spend my spare time looking into new technologies and new languages. I have recently configured a linux server for my home network, built some small, personal websites and tools to update the databases that sit behind the sites. I purchased a Raspberry Pi which I use to develop linux based software using python, OpenGL|ES, etc., as well as building some electronic circuits to interface to the device.

Updated on September 18, 2022

Comments

  • Skizz
    Skizz almost 2 years

    Having trouble with samba printing. I have a CUPS printer installed on an Ubuntu 11.04 server and that works great.

    When I try to configure samba to allow an XP machine to use the printer, it fails when printing. I can install the printer drivers for XP from the server and the printer appears in the XP printer control panels. When I try to print a test page from the XP machine I get this error in the system event log:

    Jun 27 20:33:29 FatController smbd[3571]: [2012/06/27 20:33:29,  0] rpc_server/srv_netlog_nt.c:603(_netr_ServerAuthenticate3)
    Jun 27 20:33:29 FatController smbd[3571]:   _netr_ServerAuthenticate3: netlogon_creds_server_check failed. Rejecting auth request from client JAMES machine account JAMES$
    

    Here's my smb.conf file:

    [global]
    server string = %h (Server)
    workgroup = SODOR
    encrypt passwords = true
    security = user
    os level = 255
    preferred master = yes
    domain master = yes
    local master = yes
    logon path = \\%L\profile\%U
    logon drive = S:
    logon home = \\%L\home\%U
    domain logons = yes
    map to guest = Never
    guest ok = no
    dns proxy = no
    time server = yes
    logon script = logon.bat
    load printers = yes
    printing = cups
    printcap name = cups
    nt acl support = no
    interfaces = eth1 lo
    bind interfaces only = yes
    smb ports = 445
    
    [netlogon]
    comment = Net Log On
    path = /home/samba/netlogon
    guest ok = no
    read only = yes
    browseable = no
    
    [profile]
    comment = User Profiles
    path = /home/samba/profiles
    read only = no
    create mask = 0600
    directory mask = 0700
    browseable = no
    store dos attributes = yes
    
    [printers]
    comment = All Printers
    path = /var/spool/samba
    browseable = yes
    guest ok = no
    printable = yes
    
    [print$]
    comment = Printer Drivers
    path = /var/lib/samba/printers
    browseable = yes
    guest ok = no
    read only = yes
    write list = root, skizz
    

    Anyone know what the problem is and how to fix it?

    In addition to the above, I also get this error:

    Jun 27 21:56:35 FatController smbd[3571]: [2012/06/27 21:56:35,  0] printing/print_cups.c:1027(cups_job_submit)
    Jun 27 21:56:35 FatController smbd[3571]:   Unable to print file to `Edward' - client-error-not-authorized
    

    which I think is more relevant.

  • Skizz
    Skizz about 12 years
    I'm not attached to Samba. It's just that I already had it (for the Windows network share stuff) and I'd read it can interface to CUPS to share printers. I'll try your samba update first and if that doesn't work I'll try the IPP. I take it that using IPP that print jobs can be authenticated by user?
  • jpetersen
    jpetersen about 12 years
    You can require authentication in cupsd.conf, by setting AuthType Basic and Require user, in the appropriate sections you want to be authenticated. I haven't needed authenticated printing on windows though, so I haven't tried it out yet.
  • Skizz
    Skizz almost 12 years
    Samba didn't work. But the IPP method worked a treat. Thanks.