Share USB Printers with CUPS

From KlavoWiki
Revision as of 09:25, 10 September 2014 by David (Sọ̀rọ̀ | contribs) (→‎Connecting to, from Windows)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

cups is a Linux/Debian app that allows you to share printers on a Linux system with Windows and other operating systems. In this example I used a Raspberry Pi to act as a print server on a network for USB printers. The advantage of the Raspberry Pi is the extremely low power consumption and the ability to function on a wired or wireless network.

Installation

sudo apt-get -y install cups

Admin Users

Add the required users to be a printer administrator. In this example the user pi will be added to the group lpadmin.

sudo usermod -a -G lpadmin pi

Access to Interface

By default only local access is allowed.

sudo vi /etc/cups/cupsd.conf

Allow Access and Port

Reaplce

Listen localhost:631

with

Port 631

or a more restrictive option

Listen 192.168.1.0:631
Listen 192.168.0.0:631
Listen *:631

Permissions

Using CLI

By default only local access to '/', '/admin' and '/admin/conf' are allowed.
You can either run the command:

sudo cupsctl --share-printers  --remote-admin --remote-printers

or

Editing conf File

Add '@local' to the sections '/', '/admin' and '/admin/conf' as below.

< Location / >
# Restrict access to the server...
Order allow,deny
Allow @local
< /Location >
 
< Location /admin >
# Restrict access to the admin pages...
Order allow,deny
Allow @local
< /Location >
 
< Location /admin/conf >
AuthType Default
Require user @SYSTEM
 
# Restrict access to the configuration files...
Order allow,deny
Allow @local
< /Location >

Adding a Printer

Browse to your cups server with a web browser using port 631 or a custom port based on your configuration file.

http://192.168.13.250:631

Click on Administration tab and then select Add printer. Any printer that you have connected to the Raspberry Pi or server should be displayed as per my Brother HL1430 printer.
File:cups-add-printer.jpg

Select the printer you wish to add, give it a name and description and make sure to select Share this Printer

Connecting to, from Windows

Connecting to your shared printer is quite simple. From the cups web interface select printers and then the printer you have shared and wish to connect to. Copy the URL in your browser. It should be something similar to:

http://192.168.13.250:631/printers/Brother_HL-1430

In Windows, select to add a network printer. Windows will probably try to locate a printer but the printer won't be advertise on the network. Select The printer that I want isn't listed. The following will then be displayed.
File:cups windows share.jpg

NOTE:Copy the URL from the web browser into the network path making sure to remove the s from https if your URL has https instead of http.

Supported Printers

For a list of printers supported by cups visit the openprinting web site.