Archive for March, 2007

Simple Samba Printserver on Debian GNU/Linux 4.0 (Etch)

Friday, March 30th, 2007 | linux | 3 Comments

[Updated to fix some strings that got mangled by wordpress – the instructions should make more sense now]

This is a follow on to my previous blog –
Simple Samba PDC on Debian GNU/Linux 4.0 (Etch) where we looked at how to configure Samba as a simple PDC for your network. One of the benefits of having a domain controller like this is that it can simplify the configuration of printers by your users.

Rather than each user having to install their own drivers, configure up the printer settings and generally struggle with such administration tasks, you can configure your Samba server to push these configuration details to the users.

In the previous article you saw how we had the following lines in our smb.conf

load printers = yes
printing = cups
printcap name = cups

These ensure that printers configured in our cups server are available for use through Samba.

We also have the following special shares defined in our smb.conf

comment = All Printers
browseable = no
path = /var/spool/samba
printable = yes
public = yes
writable = no
create mode = 0700

comment = Printer Drivers
path = /var/lib/samba/printers
write list = root, @ntadmin
printer admin = root, @ntadmin

The first one is the share used for spooling print-jobs and the second is a special share used to serve printer drivers for automatic installation when users add a new printer from the Samba server.

I’ve tried to set this up in the past and had problems with permissions, thanks to the helpful people on the Samba mailing list, particularly Martin Zielinski and Dale Schroeder I’ve managed to surmount those problems and now have a working configuration.

Summarising the tips from Martin and Dale here is the procedure for configuring printing with Samba,

Check your permissions

  1. On the Samba server, Note that /var/lib/samba/printers needs to be writeable by users in the ntadmin group (unless you are going to do all your print management as the root user which is inadvisable).
    chgrp -R ntadmin /var/lib/samba/printers


    chmod -R g+w /var/lib/samba/printers

    should ensure permissions are correct on the share.

  2. On Windows, login as a user in the ntadmin group and verify the permissions on the print$ share by clicking on Start and then Run… and executing \\sambaserver\print$. At this point, if you’re using the Debian Samba packages you should see 2 subdirectories: W32X86 and WIN40.
  3. Try adding a new folder here as a test. If you can’t, you’ll need to check your permissions (is the user you are logged in as in the ntadmin group and does the ntadmin group have write permissions in that folder?).

Install the printer driver on the server

  1. Firstly, on the Samba server, ensure the user you are connecting with on Windows has the rights to add new printer drivers. You may need to run the following to grant those privileges,
    net rpc rights grant smulcahy SePrintOperatorPrivilege
  2. On Windows, open the printer properties window by clicking on Start and then Run… and executing \\sambaserver.
  3. Change into the Printers and Faxes.
  4. Right click on the blank/white area of the resulting window and select Server Properties from the drop-down menu.
  5. Select the middle tab – Drivers.
  6. Click Add and follow the instructions to add the printer driver to your system. In my case I was installing a driver for a HP Color LaserJet 2500l. I initially downloaded the driver from HP’s website and ran the installer. It placed the driver files in a subdirectory of C:\Program Files. When adding the printer driver, I selected the Have Disk option and then provided the path to this subdirectory.

Configure your printer

  1. On Windows, again change into the Printers and Faxes folder.
  2. Right-click on a printer, select Properties and click the Advanced tab.
  3. Select the driver you installed previously from the drop-down box.
  4. You can also configure various other properties (including the default paper size) for the printer at this point by selecting the various tabs.
  5. When finished click Ok.

Your printer is new configured with an automatically installing driver and your desired default settings! These same settings will be used on any new clients added to your network and connected to that printer.