|
Unsupported Version |
|
Duplicate Article |
Overview
Ubuntu supports network printing, so you can print from either your Ubuntu machine or a Windows machine etc, to another Ubuntu machine that has a printer attached (ie a "print server"). This page covers these scenarios only.
This page does not cover printing from Ubuntu to a printer attached to a Windows machine, ie a Windows print server. The WindowsXPPrinter page addresses this.
Background
Ubuntu uses the Common UNIX Printing System ("CUPS") to handle printing. CUPS uses the Internet Printing Protocol ("IPP") as the basis for managing print jobs and queues. The Line Printer Daemon ("LPD") Server Message Block ("SMB"), and AppSocket (a.k.a. JetDirect) protocols are also supported with reduced functionality. This page describes network printing with CUPS and IPP.
CUPS printer configuration and management is handled by the Printer Admin utility launched from the Gnome menu - System -> Administration -> Printing. In addition CUPS provides command-line commands that are similar to old Berkley and SystemV print commands such as lpq, lpstat etc. Also IPP provides web services so after you have configured CUPS appropriately, you can access the printers and jobs via your web browser.
When a locally attached printer is defined, eg using the Printer Admin utility, that printer is automatically published from this "print server" host to the network, depending on the server directives in the CUPS configuration file. A remote Ubuntu "client" host can then be able to see and use the printer attached to the server. The network printer automatically appears in the client's Printer Admin utility. It simply pops up if CUPS is up and configured correctly and disappears if you stop CUPS at either the Print Server or your local machine.
Ubuntu 9.04
Printer sharing in Ubuntu 9.04 Jaunty is a very similar process as in previous versions, but some of the front-end wording for options has been changed.
Ubuntu Print Server
The Print Server is the Ubuntu computer that is directly connected to the printers.
On the server machine (the one the printer is attached to) open up printer manager with by going to System in the top toolbar panel, then Administration and Printing. This will open the Printer Configuration window.
Select Server in the menu bar, and then Settings.
This will open the Basic Server Settings window. If this computer only serves as a Print Server and does not need access to a printer connected to another computer select the second box.
- Publish shared printers connected to this server
If this computer acts as both a Print Server and a client (it does need access to a printer connected to another computer), select the first two boxes
- Show printers shared by other systems
- Publish shared printers connected to this system
Select the OK button.
Right click on the printer you want to share and select properties
- Click on Policies.
Check the Shared box then click Apply and OK.
This config file should be altered if security within your local network is an issue for you. E.g. if you use a poorly-secured wireless network, this could allow access to anyone nearby.
- Change the network addresses if you are part of a different network, eg on the real internet, and remove unnecessary ones.
This config allows you to use a web browser to manage CUPS, eg set up printers, manage jobs, via "http://PRINTSERVERNAME:631/".
Restart CUPS
- After changing this file, restart CUPS by running ...
sudo /etc/init.d/cupsys restart
or use the Services tool under Gnome menu System -> Administration. After CUPS is restarted the printers will immediately be found automatically by machines that are set up as per the next sections.
- After changing this file, restart CUPS by running ...
Ubuntu Client Machine
- This is the machine you want to work on and send print jobs from.
Reconfigure CUPS
- CUPS Client: /etc/cups/cupsd.conf Use the following file. Its features are contained in its comments.
# /etc/cups/cupsd.conf # DavidTangye@netscape.net ConfigFilePerm 0600 LogLevel info Printcap /var/run/cups/printcap RunAsUser Yes ### Listen fails. Use Port #Listen 127.0.0.1:631 #Listen 10.0.0.0/8:631 #Listen 128.0.0.0/16:631 #Listen 192.168.0.0/24:631 Port 631 ### Which print servers to use Include cupsd-browsing.conf BrowseOrder deny,allow BrowseDeny from All BrowseAllow from @LOCAL BrowseAllow from 10.0.0.0/8 BrowseAllow from 172.16.0.0/12 BrowseAllow from 192.168.0.0/16 <Location /> AuthType None Order Deny,Allow Deny From All Allow From @LOCAL </Location> <Location /jobs> AuthType None Order Deny,Allow Deny From All Allow From @LOCAL </Location> <Location /printers> AuthType None Order Deny,Allow Deny From All Allow From @LOCAL </Location> <Location /admin> AuthType None Order Deny,Allow Deny From All Allow From @LOCAL </Location>
- CUPS Client: /etc/cups/cupsd.conf Use the following file. Its features are contained in its comments.
Restart CUPS
After making any alterations you wish to this file, restart CUPS by running ...
sudo /etc/init.d/cupsys restart
or use the Services tool under Gnome menu System -> Administration. After CUPS is restarted, the printers on file servers, (eg, set up in the Print Servers section above) will be found automatically by your machine. They will pop up in your "Printers" screen. This might take up to 30 seconds though.th
If you want your machine to print to printers on other Ubuntu hosts, and also to be a print server for other machines, you need to create a combination of the above two cupsd.conf files.
Windows Client Machine
- Add the printer to the Windows client by using the Windows "Add Printer" Wizard. Type in the following in the printer URL:
http://PRINTSERVERNAME:631/printers/PRINTERNAME
- PRINTSERVERNAME is the name or ip address of the print server,
- PRINTERNAME is the name given to the printer on the print server.
Common Problems
Print jobs stay on the client machine and do not print. Run the command
lpstat -p -d
printer HP-OfficeJet-D155 is idle. enabled since Jan 01 00:00 Network host 'alice' is busy; will retry in 30 seconds...
This info is current for Ubuntu 5.10 (Breezy Badger)
Troubleshooting
Bypassing firewall.
If there is an firewall either on print server or the client side, there might appear a communications problem. Use this command to update the firewall to get through.
iptables -A INPUT -p tcp --dport 631 -j ACCEPT
- This rule is used for IPP only. If you're using other protocol, such as SAMBA, you have to adapt.
You might need to use this rule on both sides (server & client) if the firewall is being used on both of them.
To apply this rule after each start/restart of the system, use /etc/rc.local .