Monday, 1 September 2014

Ubuntu Server: Common Unix Printing System (CUPS)

Setup


  • sudo apt-get install cups

The following file is heavily used to configure CUPS, it is advised to backup the original file;

  • sudo cp /etc/cups/cupsd.conf /etc/cups/cupsd.conf.original
  • sudo chmod a-w /etc/cups/cupsd.conf.original
By default CUPS only listens to its loopback address, to change this edit cupsd.conf

You can either define the IP address (Listen 192.168.10.250:631), the port (Port 631), or by hostname (Listen CUPS:631)

 

Each time you change the configuration file, you will need to restart CUPS;

  • sudo service cups restart
 The GUI can be accessed from http://localhost:631/admin, where localhost is your CUPS IP, if connecting remotely.

You may need to add your useraccount the group 'lpadmin'

sudo usermod -aG lpadmin username

Remote Access to GUI

I was having problems accessing the GUI and was getting forbidden messages. I changed my configuration file to the following to gain access;

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


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

Adding Printer

  • Navigate to the CUPS GUI
  • Click 'Administration'
  • Then 'Add Printer'
  • Click the printer you want (you can search by IP).

 

Continue going through the steps to add your printer. I did have an issue with drivers so I had to download some.

I downloaded the drivers I needed for the 8600 from HP http://www8.hp.com/us/en/support-drivers.html . When you find your drivers they do provide a step by step guide on how to install them.

On my Ubuntu machine the printer was instantly shared.

Windows


To allow Windows PC's to add a printer from CUPS, configure cupsd.conf;


<Location /printers>
 AuthType None
 Order Deny,Allow
 Deny From None
 Allow From All
</Location>

 
This will allow you to add a printer from a windows machine;

  • Click 'Start'
  • Then 'Devices and Printers' -> 'Add a printer'

If you need further information on how to set this up, click this link


Sources;

https://help.ubuntu.com/10.04/serverguide/cups.html
https://help.ubuntu.com/14.04/serverguide/serverguide.pdf
http://injustfiveminutes.com/2013/11/07/remote-access-to-cups-admin-inter/
http://hplipopensource.com/hplip-web/install/install/index.html
http://www.gigamegablog.com/2012/09/03/adding-a-linux-cups-printer-to-windows-8/