studying my hobby


Debian as Printserver and Scanserver with HPLIP, CUPS, SANE

(10 votes, average: 4.80 out of 5)

It's nice to have a little home-server like the Seagate Dockstar or the Buffalo Linkstation running debian quite smoothly. What do you do if you would like to use your printer and scanner with more than one device?

Yes, you connect it to your server and share it over the network!
Because I had to set this up in two locations for now I decided to write down those steps I took from powering on the printer through printing the first testpage I can scan later on.

This HowTo requires debian squeeze installed on your Dockstar/Linkstation. If you haven't done this yet, please refer to other articles in this blog.

1. Printserver

1.1 CUPS

First of all we install cups, a powerful, web based printermanager:

Make the frontend accessible:

There are some lines in the config you may want to edit, not to require logins:

After restarting cups you should be able to login the web interface on http://dockstar:631.


In my case I have an ALL-IN-ONE Device from HP. I tested this HowTo with a psc-1310-series and a Photosmart C4100. To get our printer ready to print we need hplip:

Once it is installed, there is a tool for adding printers:

Just follow the instructions and you will have your printer installed properly.
If you now look into CUPS you should be able to print a testpage with the newly installed printer.

1.3 Install the shared printer in Windows

To install the printer go to Control Panel, Devices and Printers and click Add a printer:

Click Add a network, wireless or Bluetooth printer:

Then click The printer that I want isn't listed:

Select the second radio button and fill in the correct URL for your printer in CUPS:

In the following steps you have to select and install the correct driver which fits to your device.
When you are ready test the whole setup with another testpage from your windows machine.

2. Scanserver

2.1 Configure Sane-backend

When you install hplip the sane backends come with it as dependency (obviously we have to install the package), so we only need to install inetd in order to make sane accessible from the network:

Add your network to saned.conf:

Enable sane:

Configure inetd:

Make sure enabled in /etc/services:

Now restart the services:

Run these tests to check if sane sees your scanner:

2.2 Install sane-twain on the client

Go to and download the newest version. Perform an installation as described.
Go and test the connection, scan your first image.

2.3 Troubleshoot

If you have problems with accessing the sane backends the usb-device probably doesn't have the proper rights.
Try to modify them. In my case I had to chmod the device:

Examples for USB devices would be /dev/usbscanner or /dev/usb/scanner0, /proc/bus/usb/001/005 or /dev/bus/usb/001/005, parallel port scanners are connected for example to /dev/parport0.

3. References

  • Adam

    Which version of python do you have on your box ?

    • shyd

      Hi Adam,
      the output of python -V is: Python 2.6.6

  • Adam

    Thank for great tutorial but there are few issues related with this.

    1) Looks like hplip in Debian Squeeze is not working correctly with HP P1005 printer:
    It is possible to add/setup printer but there is error in cups log when trying to print any page.
    The solution for this problem is to use instead hplip driver from package foo2zjs – after installation go to CUPS web interface and add printer with foo2xqx
    One more note – when addidng printer please set check box that printer will be shared.

    2) In my case this configuration of cups didn’t worked:

    vim /etc/cups/cupsd.conf
    #Listen localhost:631 # comment these two lines
    #Listen /var/run/cups/cups.sock

    # Allow remote access
    Port 631

    I’ve change it and it worked:

    Listen localhost:631
    Listen /var/run/cups/cups.sock

    where is IP number of my dockstar server (print server)

    Additionally instead of this changes:

    Order allow,deny

    Order allow,deny

    #AuthType Default
    #Require user @SYSTEM
    Order allow,deny

    this one worked for me:

    Order allow,deny

    Order allow,deny

    #AuthType Default
    #Require user @SYSTEM
    Order allow,deny

    • shyd

      1) Thank you very much for sharing your experience with another printer!
      2) When I have to install cups another time, I’ll test the Listen localhost:631-thing. Of course you needed to change the network to your subnet to get access to the frontend.

  • Adam

    Regarding scanserver this package is also required:
    apt-get install sane-utils

    • shyd

      Thanks for the hint, maybe I installed it as dependency with another package. Just updated the article.

  • Hey there,

    I am looking for a comprehensive guide to install squeeze onto a Linkstar Pro, cant seem to get it working with the tuts on the wiki page! Any ideas where else to look?

    Thanks in advance

    • shyd

      Hi Rory,
      I’ve never heard of the Linkstar Pro, maybe you can provide a link to the product and probably to the wiki you are talking of.

  • twinclouds

    Hi, Shyd:
    The information that you provided here is very useful. It saved me a lot of time and frustration. Thanks.

  • Bigcahoona

    Guys really useful many thanks helped me to get the job done on my Pi.

  • Nandan

    This was helpful. I could setup the printer easier through the cups interface: :631 (see Also I had to add this in Samba to discover printer over Windows (fro your refer link):

    nano /etc/samba/smb.conf # folgenden Abschnitt dort ergänzen:
    comment = All Printers
    browseable = yes
    path = /var/spool/samba
    printable = yes
    public = yes
    writable = no
    create mode = 0777
    guest ok = yes
    /etc/init.d/samba restart # Samba neustarten

    • shyd

      Thanks for your reply! Your are absolutely right, but I didn’t want to see the printer in samba. Additionally I wanted user management for the print jobs.

  • D3cay

    Thank you so much for the helpful tutorial.
    I seem to have a little problem with sane here. I am trying to use sanetwain to access the scanner from my windows system and I get an error that says that there are “No devices found on backend”.
    On the linux system where sane is located, I can scan just fine. Did I miss to set an option?
    I noticed that sane also detects the webcam of the linux machine as a scanner, do I have to select a specific device somewhere for proper remote access?

    • shyd

      I have the same issue right here. Running Windows 7 and 8 x64 might be the problem for me:
      What windows are you running? I didn’t test sanetwain for months on a x86 system.

      • D3cay

        I am on win 8 x64 to. That seems to be the problem here.

        • shyd

          My print/scanserver is a Buffalo Linkstation. My planning is to use the pushbutton as scan start, because I need to place the stuff to scan in the scanner, so I am physically able to push it. For now I scan with putty, running this command:
          scanimage –format=tiff -d hpaio:/usb/psc_1310_series?serial=XXXXXXXXX –resolution=300 > scanPage.tiff

  • Pingback: Hálózati nyomtatószerver Debian-on | Winben blogja()

  • Pingback: Remote printing: Debian and Google Cloud Print |

  • Andreas

    I have managed to enable access to my scanner by a simple UDEV-Rule.

    Create the file 90-scanner.rules in /etc/udev/rules.d/ and the follow content


    # change device file permission to group scanner for sane access

    ATTRS{idVendor}=="04a9", ATTRS{idProduct}=="220d", SUBSYSTEMS=="usb", ACTION=="add", MODE="0664", GROUP="scanner"


    Replace the Vendor-ID and Product-ID with your IDs from LSUSB output. Now, every time you connect your scanner the device node will be set to RW-RW-R– rights with owner ROOT and group SCANNER. You can add all your users who should be able to scan to the scanner group.

    Works great on Debian Wheezy on my Rasperry Pi and should be update safe and would not open any big security hole.

    If you google for udev-Rules for scanner access some people suggest to change the default rule for every usb-device to be in mode 666 and redo the change after every update to the udev packet *facepalm*

  • r2d2

    thanks, man!
    that IS helphul

  • Johannes

    You forgot to explain cases with xinetd:

  • Oleg Neumyvakin

    thanks for chmod o+w /dev/bus/usb/001/005 its helps me

  • Bishoy Harby

    sane-port stream tcp nowait saned.saned /usr/sbin/saned saned … it’s a ‘.’ not a ‘:’

  • Harley Yan

    It works for me. Thank you very much.
    xinetd is not wok with sane 1.0.22 on my raspi, inetd is OK.