Setting up a printer with Cups

First thing is to edit the /etc/samba/smb.conf file. printers section to look like this:

[printers]
comment = All Printers
browseable = no
printing = cups
printcap name = cups
printable = yes
writable = no
public = yes
guest ok = yes
path = /var/spool/samba
printer admin = root
Also in the smb.conf file add the specific share info for the printer. For example:
[DeskJet]
comment = HP Deskjet
printable = yes
path = /var/spool/samba
public = yes
guest ok = yes
printer admin = root
You will also need to set the privs for the /var/spool/samba folder for everyone with full access with the following command: chmod 777 /var/spool/samba

Next thing to do is to edit the /etc/cups/cupsd.conf file. Edit the following sections:



ServerName Name_of_Print_Server
ServerAdmin root@Name_of_Print_Server

MaxCopies 10 // Limit the number of copies to print

MaxClients 5 // Set this to whatever you like I don't want more than 5 connections to my server

BrowseAddress @IF(eth0) // change eth0 to your lan connection
BrowseAllow @IF(eth0) // only allow printing from LAN.
BrowseDeny All // I don't want people on internet to try print using my printer
BrowseOrder deny,allow // We first stop everyone from printing, then allow only local printing.

<Location />
Order Deny,Allow
Deny From All
Allow From 127.0.0.1 192.168.0.* // Change to:192.168.0.0/24 = address of internal network
</Location>

<Location /admin>
AuthType Basic
AuthClass System
Order Deny,Allow
Deny From All
Allow From 127.0.0.1 192.168.0.0/24 // Only the users on local network can perform admin
</Location>


If you are going to print MS Office documents, edit the /etc/cups/mime.convs file and uncomment the folllowing line, its towards the end:
application/octet-stream   application/vnd.cups-raw   0   -

Also edit the /etc/cups/mime.types file and uncomment the following line:
# application/octet-stream


Next we need to install the printer drivers. Go to http://www.linuxprinting.org and download the correct CUPS driver for your printer. Download the ppd file and place in /usr/share/cups/model.

Then execute the following command:
lpadmin -p Printer_name_used_in_Samba -E -v parallel:/dev/lp0 -m Some_printer_name.ppd

Printer_name_used_in_Samba should be replaced with whatever you have shared your printer as in the smb.conf file.

The field usb:/dev/usb/ltp0 is what the system refers to as the location of your printer, note this will vary across different systems. On some systems, when using usb printers, it could be at /dev/ultp0. If you have a parallel printer, replace usb with parallel:/dev/lp0 or similar.

The field Some_printer_name.ppd is the name of the printer driver you have downloaded. For example, the HP Deskjet 5160 printer has a ppd file with the name HP-DeskJet_5160-hpijs.ppd.

This sets up the printer server for what is called "raw printing". In order for Windows based Pc's to print, you will need to install the appropriate printer driver on the Windows client.