Difference between revisions of "CUPS/Printer sharing"

From ArchWiki
Jump to navigation Jump to search
m (Windows client: Changing personal username to "yourusername")
m (Bot: Removing from Category:HOWTOs (English))
Line 1: Line 1:
[[Category:Printers (English)]][[Category:HOWTOs (English)]]
[[Category:Printers (English)]]
{{i18n|CUPS printer sharing}}
{{i18n|CUPS printer sharing}}
{{Article summary start|Summary}}
{{Article summary start|Summary}}

Revision as of 17:13, 10 June 2011

This template has only maintenance purposes. For linking to local translations please use interlanguage links, see Help:i18n#Interlanguage links.

Local languages: Català – Dansk – English – Español – Esperanto – Hrvatski – Indonesia – Italiano – Lietuviškai – Magyar – Nederlands – Norsk Bokmål – Polski – Português – Slovenský – Česky – Ελληνικά – Български – Русский – Српски – Українська – עברית – العربية – ไทย – 日本語 – 正體中文 – 简体中文 – 한국어

External languages (all articles in these languages should be moved to the external wiki): Deutsch – Français – Română – Suomi – Svenska – Tiếng Việt – Türkçe – فارسی

Template:Article summary start Template:Article summary text Template:Article summary heading Template:Article summary wiki Template:Article summary wiki Template:Article summary end

CUPS provides capabilities to set up printer sharing between different systems. Below you'll find instructions for common scenarios.

Between GNU/Linux systems

Once CUPS has been setup on the GNU/Linux print server, the recommended method of sharing the printer with another GNU/Linux system is through the relatively easy to use web interface, yet manual configuration is also a way.

Using the web interface

Access http://localhost:631 with a browser and the CUPS administration home page will be displayed.

Click on the Administration tab near the top, select the add printer option and it should automatically detect the connected printer. If not, try turning off the printer and then back on before another attempt.

Once the printer has been set up, look under the Server heading and click the checkbox for "Share printers connected to this system". Now, conclude by clicking change settings and the server will automatically restart.

Selecting "Edit Configuration File" allows making direct edits to the Template:Filename file. This is useful for allowing server access only to certain users or IP addresses, as the example shown below.

Manual setup

On the server computer (the one directly connected to the printer) simply open up Template:Filename and allow access to the server by modifying the location lines. For instance:

<Location />
   Order allow,deny
   Allow localhost
   Allow 192.168.0.*

Also make sure the server is listening on the IP address the client will be addressing. Add the following line after "# Listen <serverip>:631" (using the server's IP address instead of client's


To "Show shared printers on the local network", add the line "BrowseAllow all":

Browsing On
BrowseOrder allow,deny
BrowseAllow @LOCAL
BrowseAllow all

After making modifications, restart CUPS by:

# /etc/rc.d/cups restart

On the client system, open up (create if not present) Template:Filename and add the ServerName to match the IP address or the name of the server. Add this line:


To "Show shared printers on the local network", add the line "BrowseAllow all":

Browsing On
BrowseOrder allow,deny
BrowseAllow @LOCAL
BrowseAllow all

There are more configuration possibilities, including automatic methods, which are described in detail in http://localhost:631/help/network.html

After making modifications, restart CUPS.

Note: When adding the printer from the client, if using the Internet Printing Protocol (IPP), put the URI as ipp://<name-of-printer>

Between GNU/Linux and Windows

GNU/Linux client

If connected to a Windows print server (or any other Samba capable print server), skip the section about kernel modules and such. All that needs to be done is to start the CUPS daemon and complete the web interface as specified previously. Before this, activate the Samba CUPS back-end. Do this by entering the following command:

# ln -s $(which smbspool) /usr/lib/cups/backend/smb

After completing this task, restart CUPS issuing the command specified in the previous section. Next, simply log in on the CUPS web interface and choose to add a new printer. As a device choose "Windows Printer via SAMBA".

For the device location, enter:


Or without a password:


Make sure that the user actually has access to the printer on the Windows computer and select the appropriate drivers. If the computer is located on a domain, make sure the user-name includes the domain:


If the network contains many printers, use Template:Codeline to set the preferred printer.

Windows client

Sometimes one might want to allow a Windows computer to connect to a GNU/Linux server. There are a few ways to do this, including Samba. In order to do this, edit Template:Filename file to allow access to printers. File Template:Filename can look something like this:

server string=Arch Linux Print Server

    comment=All Printers
    # to allow user 'guest account' to print.
    guest ok=no
    create mode=0700
    write list=@adm root yourusername

That should be enough to share the printer, yet adding an individual printer entry may be desirable:

    comment=Samsung ML-1250 Laser Printer
    printer admin=@admin root yourusername
    user client driver=yes
    # to allow user 'guest account' to print.
    guest ok=no
    write list=@adm root yourusername
    valid users=@adm root yourusername

Please note that this assumes configuration was made so that users must have a valid account to access the printer. To have a public printer, set guest ok to yes, and remove the valid users line. To add accounts, set up a regular GNU/Linux account and then set up a Samba password on the server. For instance:

 # useradd yourusername
 # smbpasswd -a yourusername

After this, restart Samba daemon:

# /etc/rc.d/samba restart

Obviously, there are a lot of tweaks and customizations that can be done with setting up a Samba print server, so it is advised to look at the Samba and CUPS documentation for more help. The Template:Filename file also has some good samples that might warrant imitating.

Windows 2000 and Windows XP

For the most modern flavors of Windows, an alternative way of connecting to the GNU/Linux printer server is to use the CUPS protocol directly. The Windows client will need to be using Windows 2000 or Windows XP. Make sure the clients are allowed to access the print server by editing the location settings as specified in section 4.1.

On the Windows computer, go to the printer control panel and choose to 'Add a New Printer'. Next, choose to give a URL. For the URL, type in the location of the printer: http://host_ip_address:631/printers/printer_name (where host_ip_address is the GNU/Linux server's IP address and printer_name is the name of the printer being connected to).

After this, install the printer drivers for the Windows computer. If the CUPS server is setup to use its own printer drivers, then just select a generic postscript printer for the Windows client. Then test the print setup by printing a test page.

Other operating systems

More information on interfacing CUPS with other printing systems can be found in the CUPS manual, e.g. on http://localhost:631/sam.html#PRINTING_OTHER