https://wiki.archlinux.org/api.php?action=feedcontributions&user=Furret&feedformat=atomArchWiki - User contributions [en]2024-03-29T06:06:41ZUser contributionsMediaWiki 1.41.0https://wiki.archlinux.org/index.php?title=Exim_with_remote_SMTP_server&diff=74762Exim with remote SMTP server2009-08-28T03:57:49Z<p>Furret: Fixes for 451</p>
<hr />
<div>[[Category:Networking (English)]]<br />
[[Category:HOWTOs (English)]]<br />
===Use Exim with a remote smtp server===<br />
<br />
This document describes how to set up Exim (a mail transfer agent) to use a remote smtp server, for example your ISP's smtp server.<br />
<br />
====Install Packages====<br />
<pre><br />
# pacman -S exim<br />
</pre><br />
<br />
<br />
====Edit configuration====<br />
Edit <code>/etc/mail/exim.conf</code> and add or change the following<br />
<br />
In Main Configuration Settings uncomment <code>primary_hostname</code> and add the hostname of your box (see the <code>HOSTNAME</code> field in<br />
<code>/etc/rc.conf</code>)<br />
<pre><br />
primary_hostname = myhostname # change to your hostname<br />
</pre><br />
<br />
At the end of the Routers Configuration section add<br />
<pre><br />
pass''on''to_isp:<br />
driver = manualroute<br />
domains = !+local_domains<br />
transport = remote_smtp<br />
route_list = * smtp.myisp.com # change to the desired smtp server<br />
</pre><br />
<br />
Make sure that in Transports Configuration it says (uncommented)<br />
<pre><br />
remote_smtp:<br />
driver = smtp<br />
</pre><br />
<br />
----<br />
<br />
If you have a laptop, or a machine in a smarthost configuration, where you don't want the name of the machine to appear in the outgoing email then you must enable exim's rewriting facilities.<br />
<br />
In the Rewriting section you should have something like:<br />
<br />
<pre><br />
*@machine.mydomain $1@mydomain<br />
</pre><br />
<br />
where ''machine'' is the hostname of your laptop or PC and ''mydomain'' is the domain name of the machine and the outgoing mail.<br />
<br />
====Update: 11-Feb-05:====<br />
<br />
FYI - I just got done wrestling with Exim (4.44) to get it up and running in this configuration on my machine, and I had to do a number of things quite differently than the other person. Thought I'd capture them here for posterity, since I had to go through a pretty painful process that cost me a lot of time and aggravation before I hit upon the right config. Hopefully this'll save others from a similar fate.<br />
<br />
By the way, I should note: my Exim server does not receive any emails directly from the Net. I'm using fetchmail to grab the mail's from an external POP mail drop and dump them into my Exim server. So perhaps this is different than the other person's configuration.<br />
<br />
Anyway, here's what worked for me.<br />
<br />
I did not need to update <code>primary_hostname</code>. If you leave it commented out, like this:<br />
<pre><br />
# primary_hostname =<br />
</pre><br />
then exim will just automatically use whatever your system's <code>hostname</code> command outputs. (i.e., the <code>HOSTNAME</code> that you've set in rc.conf.)<br />
I very much DID need to update this line:<br />
<pre><br />
domainlist local_domains = @<br />
</pre><br />
and it caused me much grief until I got it right!<br />
In my case, it needed to look like this:<br />
<pre><br />
domainlist local_domains = @:localhost:mydnamicdnshostname.homeip.net<br />
</pre><br />
I think the dynamic dns entry might be optional (since I never really deliver any mail to an address at that FQDN), but the <code>@</code> and the <code>localhost</code> are both critical.<br />
* <code>@</code> basically means again to use whatever your system's <code>hostname</code> command outputs. That's needed because some daemons that run on your box may try to send emails to the root user at the host, and they will get rejected if you don't have the <code>@</code> entry.<br />
* <code>localhost</code> was necessary in order to allow fetchmail to deliver all the messages that it fetched. Without that entry there, Exim would fail to deliver them, and then generate a bounce message in response. Even worse, most of my fetched messages were spam, and so it would try to send the bounce back to the return address on the spam which 1) often was forged, and thus a bad thing to do, and 2) often would get rejected either due to an invalid email address or because I was trying to initiate email from a residential dynamic IP address and thus was also a bad thing to do. In the latter case, those messages wound up frozen on the queue, and I had to spend some time manually purging them from the queue. Just a bad situation all around until I got this piece right.<br />
* I also wanted to allow other boxes on my LAN to relay messages through this exim server. By default, though, that's blocked. You can enable it by changing this:<br />
<pre><br />
hostlist relay''from''hosts = 127.0.0.1<br />
</pre><br />
to this:<br />
<pre><br />
hostlist relay''from''hosts = 127.0.0.1 : 192.168.0.0/24<br />
</pre><br />
While, you're at it, it actually couldn't hurt to make it this:<br />
<pre><br />
hostlist relay''from''hosts = 127.0.0.1 : ::::1 : 192.168.0.0/24<br />
</pre><br />
(The <code>::::1</code> is just the ipv6 equivalent of 127.0.0.1)<br />
<br />
Despite what was written by the other person, I found that that the <code>pass''on''to_isp</code> router should NOT go at the end of the Routers Configuration section. Since it's at the end, it won't get executed if some other router gets executed first, and that's exactly what was happening to me. This router, which appears before it was getting executed instead:<br />
<pre><br />
dnslookup:<br />
driver = dnslookup<br />
domains = ! +local_domains<br />
transport = remote_smtp<br />
ignore''target''hosts = 0.0.0.0 : 127.0.0.0/8<br />
no_more<br />
</pre><br />
That router might be desired in some configurations, but not this one. That will cause exim to try to deliver the message itself, rather than passing it on to your ISP's MTA. (And as I indicated above, that will often fail if you're on a residential dynamic IP adddress.)<br />
To set this up properly, do it like this:<br />
<pre><br />
#dnslookup:<br />
# driver = dnslookup<br />
# domains = ! +local_domains<br />
# transport = remote_smtp<br />
# ignore''target''hosts = 0.0.0.0 : 127.0.0.0/8<br />
# no_more<br />
<br />
pass''on''to_isp:<br />
driver = manualroute<br />
domains = !+local_domains<br />
transport = remote_smtp<br />
route_list = * smtp.myisp.com # change to the desired smtp server<br />
</pre><br />
<br />
One last thing: make sure to also update the <code>/etc/mail/aliases</code> file, if you've got any daemons running on your box that need to send email to the root user. You'll probably want those emails to get delivered to your non-root user account instead, and this is how you set that behavior. Look for these lines:<br />
<pre><br />
# Person who should get root's mail<br />
#root:<br />
</pre><br />
And uncomment and add your local user account to the <code>root:</code> line:<br />
<pre><br />
# Person who should get root's mail<br />
root: johndoe<br />
</pre><br />
<br />
Hope this all spares someone some hair-pulling and lost sleep down the road. I wish I had read an entry like this before I started - I wouldn't be so tired right now!<br />
<br />
====Update: 10-Feb-08:====<br />
<pre><br />
pass''on''to_isp:<br />
driver = manualroute<br />
domains = !+local_domains<br />
transport = remote_smtp<br />
route_list = * smtp.myisp.com # change to the desired smtp server<br />
</pre><br />
should be changed to <br />
<pre><br />
send_to_gateway:<br />
driver = manualroute<br />
domains = !+local_domains<br />
transport = remote_smtp<br />
route_list = * smtp.myisp.com # change to the desired smtp server<br />
</pre><br />
<br />
==Troubleshooting==<br />
<br />
===451 Temporary local problem===<br />
<br />
If you're getting a "451 Temporary Local Problem" when testing SMTP, try these steps:<br />
<br />
* Are you sending as root? By default Exim will not allow you to send as root.<br />
* Make sure that you have enabled Exim in /etc/hosts.allow.</div>Furrethttps://wiki.archlinux.org/index.php?title=CUPS&diff=64741CUPS2009-03-10T05:39:57Z<p>Furret: Mention net-snmp more clearly</p>
<hr />
<div>[[Category:Printers (English)]]<br />
[[Category:HOWTOs (English)]]<br />
{{i18n_links_start}}<br />
{{i18n_entry|English|CUPS}}<br />
{{i18n_entry|Рolski|CUPS (Polski)}}<br />
{{i18n_entry|Русский|CUPS (Русский)}}<br />
{{i18n_entry|Türkçe|CUPS (Türkçe)}}<br />
{{i18n_links_end}}<br />
=Introduction=<br />
<br />
==What is CUPS?==<br />
<br />
Straight from the CUPS website: "The Common UNIX Printing System ("CUPS") is a cross-platform printing solution for all UNIX environments. It is based on the "Internet Printing Protocol" and provides complete printing services to most Postscript and raster printers. CUPS is provided under the GNU GPL..." Although there are other printing packages such as LPRNG, CUPS is quite popular and relatively easy to use. It is the default printing system on Arch Linux as well as many other Linux distributions.<br />
<br />
==Troubleshooting CUPS & components==<br />
<br />
The best way to get printing working is to set 'LogLevel' in '/etc/cups/cupsd.conf' to:<br />
<pre><br />
LogLevel debug<br />
</pre><br />
And then viewing the output from '/var/log/cups/error_log' like this:<br />
<pre><br />
# tail -n 100 -f /var/log/cups/error_log<br />
</pre><br />
The characters at the left of the output stands for:<br />
<pre><br />
D = Debug<br />
E = Error<br />
I = Information<br />
etc...<br />
</pre><br />
These files may also prove useful.<br />
<pre><br />
/var/log/cups/page_log 'spits out a new entry each time a print is successful.'<br />
/var/log/cups/access_log 'lists all cupsd http1.1 server activity'<br />
</pre><br />
<br />
Of course it's important to know how CUPS work if you want to solve your problems, this is somewhat correct:<br />
<br />
# An application sends a .ps file (PostScript, a script language that details how the page will look) to CUPS when you select 'print' (99% of apps do).<br />
# CUPS then looks at your printers PPD file (printer description file) and figures out what filters it needs to use to convert the .ps file to a language that the printer understands (like PJL,PCL). Usually it needs ghostscript.<br />
# GhostScript takes the input and figures out which filters it should use, then applies them and converts the .ps file to a format understood by the printer.<br />
# Then it is sent to the backend. For example, if you have your printer connected to a USB port, it uses the USB backend.<br />
<br />
Print a document and watch 'error_log' to get a more detailed and correct image of the printing process.<br />
<br />
=Installing CUPS=<br />
<br />
==Packages==<br />
<br />
You will need CUPS and Ghostscript for sure:<br />
# pacman -S cups ghostscript gsfonts<br />
<br />
* <b>cups</b> - The actual CUPS software<br />
* <b>dbus-core</b> - The dbus library is needed for cups<br />
* <b>ghostscript</b> - An interpreter for the Postscript language<br />
* <b>gsfonts</b> - Ghostscript standard Type1 fonts<br />
<br />
<br />
Here are some of the following driver packages; choosing the right driver depends on the printer you own. If unsure, install gutenprint.<br />
<br />
* <b>gutenprint</b> - A collection of high quality drivers for Canon, Epson, Lexmark, Sony, Olympus, and PCL printers for use with Ghostscript, CUPS, Foomatic, and the Gimp.<br />
* <b>foomatic-db</b>, <b>foomatic-db-engine</b>, <b>foomatic-db-nonfree</b> and <b>foomatic-filters</b> - Foomatic is a database-driven system for integrating free software printer drivers with common spoolers under Unix<br />
* Installing <b>foomatic-filters</b> should solve your problems if the cups error_log is reporting "stopped with status 22!"<br />
* <b>hplip</b> and <b>net-snmp</b> - HP Linux inkjet driver. Provides support for DeskJet, OfficeJet, Photosmart, Business Inkjet and some LaserJet printer models. <i>net-snmp</i> should be listed as a dependency but is not as of this writing, so you should manually install it along with <i>hplip</i>.<br />
* <b>ufr2</b> - Canon UFR2 driver with support for LBP, iR and MF series printers. Package is available in AUR.<br />
* <b>cups-pdf</b> - A nice package that allows one to setup a virtual PDF Printer that generates a PDF out of anything sent to it.<br />
<br />
<br />
If your system is connected to a networked printer using the samba protocol or if the system is to be a print server for Windows clients:<br />
# pacman -S samba<br />
<br />
==Download Printer PPD==<br />
<br />
Depending on your printer, this step is optional and may not be needed, as the standard CUPS installation already comes with quite a few PPD (Postscript Printer Description) files. Moreover, the <i>foomatic-filters</i>, <i>gimp-print</i> and <i>hplip</i> packages already include quite a few PPD files which will automatically be detected by CUPS.<br />
<br />
<br />
Here's an explanation of what a PPD file is from the Linux Printing website: "For every PostScript printer the manufacturers provide a PPD file which contains all printer-specific information about the particular printer model: Basic printer capabilities as whether the printer is a color printer, fonts, PostScript level, etc., and especially the user-adjustable options, as paper size, resolution, etc."<br />
<br />
<br />
*To get the PPD file for your printer, go to http://www.linuxprinting.org/printer_list.cgi and select the manufacturer and model of your printer.<br />
<br />
<br />
*Now, you will need to copy the file to the cups folder so it can detect the file. If you are in the folder where you downloaded the PPD file, you can use the following command:<br />
<br />
<pre><br />
# cp your_printer.ppd /usr/share/cups/model/<br />
</pre><br />
<br />
<br />
If you cannot find your printer on the website, you may want to try similar models or using generic printer drivers. Just do some googling or ask your manufacturer (good luck with that).<br />
<br />
=Configuring Cups=<br />
<br />
==Options==<br />
<br />
Now that you have cups installed, you have a variety of options on how to setup CUPS. You can always use the tried and true command line. Likewise, various desktop environments such as GNOME and KDE have useful programs that can help you manage your printers. However, in order to make this process easy for the largest amount of users, we will use the web interface provided by CUPS.<br />
<br />
Please note that if you are planning on connecting to a network printer, rather than one that is directly connected to your computer, you may wish to jump to the Printer Sharing section first. Linux to Linux printer sharing is quite easy and involves very little configuration. Windows to Linux and vice-versa requires a little bit more effort, but is relatively easy as well.<br />
<br />
==Kernel Modules==<br />
<br />
Before we can use the CUPS web interface, we must install the appropriate kernel modules. The following are steps that I got from the Gentoo Printing Guide. <br />
===USB printers===<br />
If you want to use a USB printer with a 2.6.x kernel, use the following command:<br />
<br />
<pre><br />
# modprobe usblp<br />
</pre><br />
<br />
If you are using a USB printer and a 2.4.x kernel, use the following command:<br />
<br />
<pre><br />
# modprobe printer<br />
</pre><br />
<br />
Note, this assumes that you are using the stock kernels from Arch Linux. If you custom-rolled your own, you may need to run this first:<br />
<br />
<pre><br />
# modprobe usbcore<br />
</pre><br />
<br />
Once you have the modules installed, you should plug in your printer and check if the kernel detected it by running the following:<br />
<br />
<pre><br />
# tail /var/log/messages.log<br />
</pre><br />
<br />
or<br />
<br />
<pre><br />
# dmesg<br />
</pre><br />
<br />
<br />
You should see something like this:<br />
<br />
<pre><br />
Feb 19 20:17:11 kernel: printer.c: usblp0: USB Bidirectional<br />
printer dev 2 if 0 alt 0 proto 2 vid 0x04E8 pid 0x300E<br />
Feb 19 20:17:11 kernel: usb.c: usblp driver claimed interface cfef3920<br />
Feb 19 20:17:11 kernel: printer.c: v0.13: USB Printer Device Class driver<br />
</pre><br />
<br />
===Parallel port printers===<br />
If you plan on using a parallel port printer, the configuration is pretty much the same. Kernel 2.6.x users have to first type in:<br />
<br />
<pre><br />
# modprobe lp<br />
</pre><br />
<br />
And then both 2.4.x and 2.6.x kernel users can enter in:<br />
<br />
<pre><br />
# modprobe parport<br />
# modprobe parport_pc<br />
</pre><br />
<br />
Once again, you can check your setup by running:<br />
# tail /var/log/messages.log<br />
You should see something like this:<br />
<br />
<pre><br />
lp0: using parport0 (polling).<br />
</pre><br />
<br />
<br />
Note: Installing my Brother HL 1250 I found that permissions for the device won't let CUPS write on the device, so it doesn't print. To fix it:<br />
<br />
<pre><br />
[root@mihal ~]# ls /dev/usb/<br />
lp0<br />
[root@mihal ~]# chgrp lp /dev/usb/lp0<br />
<br />
</pre><br />
<br />
===Auto-loading===<br />
You may also want to have the system automatically load the kernel module every time the computer starts up. To do this use your favorite text editor to open up <code>/etc/rc.conf</code> and add the appropriate module to the <i>MODULES=()</i> line. Here's a portion of the text from my <code>rc.conf</code> file:<br />
<br />
<pre><br />
MODULES=(!usbserial scsi_mod sd_mod snd-ymfpci snd-pcm-oss lp parport parport_pc ide-scsi)<br />
</pre><br />
<br />
==CUPS Daemon==<br />
<br />
With the kernel modules installed, you are now ready to start the actual CUPS daemon. To do this, simply run this command as root:<br />
<br />
<pre><br />
# /etc/rc.d/cups start<br />
</pre><br />
<br />
If you want to have cups start up automatically every time you start your computer, then you need to add it to your DAEMONS=() line in the <code>/etc/rc.conf</code> file. For example:<br />
<br />
<pre><br />
DAEMONS=(pcmcia syslogd klogd !fam esd mono network autofs cups crond gdm)<br />
</pre><br />
<br />
==Web Interface and tool kit.==<br />
<br />
Once the daemon is running, if a web interface is available. Open up your browser and go to:<br />
<br />
<i>http://localhost:631</i><br />
<br />
(You may need to replace ''localhost'' with your hostname found in <code>/etc/hosts</code>)<br />
<br />
'''or''' install "GNOME CUPS Manager" GUI frontend (see Appendix: A.1 [http://wiki.archlinux.org/index.php/CUPS_Setup#Alternative_CUPS_Interfaces Alternative CUPS Interfaces])<br />
<br />
From here, all you have to do is follow the various wizards to add your printer. To setup my Samsung ML-1250 printer, I started out by clicking on <i>Manage Printers</i>, and then <i>Add Printer</i>. I was then prompted for a username and password. I just logged in as root. I entered in ml1250 for my printer name, My Room for location and then Peter's Samsung ML-1250 Laster Printer for description. Next you will select the device. Since my printer is a USB device, I just selected <i>USB Printer #1</i>. The name of my printer also showed up next to the label <i>USB Printer #1</i>, so look for that. Next, I simply chose the appropriate drivers and the installation was complete.<br />
<br />
Once the installation is complete, you can test your configuration by pressing the Print Test Page button.<br />
<br />
===Remote Access to Web Interface===<br />
By default the CUPS web interface can only be accessed by the ''localhost''; i.e. the computer that it is installed on. To remotely access the interface make the following changes to the /etc/cups/cupsd.conf file. Replace the line<br />
Listen localhost:631<br />
with<br />
port 631<br />
so that CUPS will listen to incoming requests. There are three levels of access that can be granted:<br />
<Location /> #access to the server<br />
<Location /admin> #access to the admin pages<br />
<Location /admin/conf> #access to configuration files<br />
To give remote hosts access to one of these levels add an '''Allow''' statement to that level’s section. An '''Allow''' statement can take one or more of the forms listed below:<br />
Allow all<br />
Allow host.domain.com<br />
Allow *.domain.com<br />
Allow ip-address<br />
Allow ip-address/netmask<br />
Deny statements can also be used. For example if I wanted to give all hosts on the 192.168.1.0/255.255.255.0 subnet full access, my /etc/cups/cupsd.conf file would include this:<br />
<br />
# Restrict access to the server...<br />
# By default only localhost connections are possible<br />
<Location /><br />
Order allow,deny<br />
Allow From localhost<br />
'''Allow From 192.168.1.0/255.255.255.0'''<br />
</Location><br />
<br />
# Restrict access to the admin pages...<br />
<Location /admin><br />
# Encryption disabled by default<br />
#Encryption Required<br />
Order allow,deny<br />
Allow From localhost<br />
'''Allow From 192.168.1.0/255.255.255.0'''<br />
</Location><br />
<br />
# Restrict access to configuration files...<br />
<Location /admin/conf><br />
AuthType Basic<br />
Require user @SYSTEM<br />
Order allow,deny<br />
Allow From localhost<br />
'''Allow From 192.168.1.0/255.255.255.0'''<br />
</Location><br />
<br />
=Printer Sharing=<br />
<br />
==Linux to Linux==<br />
<br />
Once you have CUPS setup on your Linux print server, sharing the printer with another Linux box is relatively easy. There are several ways to configure such a scenario -- here we will describe the manual setup. On the server computer (the one managing and connecting to the printer) simply open up <code>/etc/cups/cupsd.conf</code> and allow access to the server by modifying the location lines. For instance:<br />
<br />
<pre><br />
<Location /><br />
Order Deny,Allow<br />
Deny From All<br />
Allow From 127.0.0.1<br />
Allow From 10.0.0.*<br />
</Location><br />
</pre><br />
<br />
You will also need to make sure the server is listening on the IP address your client will be addressing. Add the following line after "Listen localhost:631":<br />
<br />
<pre><br />
Listen 10.0.0.1:631<br />
</pre><br />
<br />
using your server's IP address instead of 10.0.0.1.<br />
<br />
Add the IP address of the client computer by doing Allow From client_ip_address. After you make your modifications, you will want to restart CUPS by doing:<br />
<br />
<pre><br />
# /etc/rc.d/cups restart<br />
</pre><br />
<br />
On the client side, open up <code>/etc/cups/client.conf</code> and edit the ServerName option to match the IP address or the name of your server. For instance, I named my server beast and have an entry in my hosts file to point to it. So in my <code>client.conf</code> file, I just edited this line:<br />
<br />
<pre><br />
ServerName beast<br />
</pre><br />
<br />
Next, run the following command to update the client computer:<br />
<br />
<pre><br />
# lpq<br />
</pre><br />
<br />
You should see something like this:<br />
<br />
<pre><br />
ml1250 is ready<br />
no entries<br />
</pre><br />
<br />
There are more configuration possibilities including an automatic configuration which are described in detail on http://localhost:631/sam.html#CLIENT_SETUP (this link works on your printer server).<br />
<br />
When prompted for username and password, use root to access.<br />
Then follow the instructions from here<br />
http://www.digitalhermit.com/linux/printing/<br />
if it's a TCP/IP printer, use JetDirect.<br />
<br />
That's it for Linux to Linux printer sharing.<br />
<br />
==Linux to Windows==<br />
<br />
If you are connected to a Windows print server (or any other Samba capable print server), you can skip the section about kernel modules and such. All you have to do is start the CUPS daemon and complete the web interface as specified in section 3.3 and 3.4. Before this, you need to activate the Samba CUPS backend. You can do this by entering the following command:<br />
<br />
<pre><br />
# ln -s `which smbspool` /usr/lib/cups/backend/smb<br />
</pre><br />
<br />
Note that the symbol before is ` (underneath the ~ on a standard US keyboard) and not '. After this, you will have to restart CUPS using 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".<br />
<br />
For the device location, enter:<br />
<br />
<pre><br />
smb://username:password@hostname/printer_name<br />
</pre><br />
<br />
Or without a password:<br />
<br />
<pre><br />
smb://username@hostname/printer_name<br />
</pre><br />
<br />
Make sure that the user actually has access to the printer on the Windows computer. Select the appropriate drivers and that's about it. If the computer is located on a domain, make sure the username includes the domain: <br />
<pre><br />
smb://username:password@domain/hostname/printer_name<br />
</pre><br />
<br />
Note: If your network contains many printers, use "lpoptions -d your_desired_default_printer_name" to set your preferred printer<br />
<br />
Note: I, thepizzaking, was having 'NT_STATUS_ACCESS_DENIED' errors and to fix them I needed to use a slightly different syntax:<br />
<pre><br />
smb://workgroup/username:password@hostname/printer_name<br />
</pre><br />
<br />
==Windows to Linux==<br />
<br />
Sometimes you might want to allow a Windows computer to connect to your Linux server. There are a few ways to do this, and the one I am most familiar with is using Samba. In order to do this, you will have to edit your <code>/etc/samba/smb.conf</code> file to allow access to your printers. Your <code>smb.conf</code> can look something like this:<br />
<br />
<pre><br />
[global]<br />
workgroup = Heroes<br />
server string = Arch Linux Print Server<br />
security = user<br />
<br />
[printers]<br />
comment = All Printers<br />
path = /var/spool/samba<br />
browseable = yes<br />
# to allow user 'guest account' to print.<br />
guest ok = no<br />
writable = no<br />
printable = yes<br />
create mode = 0700<br />
write list = @adm root neocephas<br />
</pre><br />
<br />
That should be enough to share your printer, but you just might want to add an individual printer entry:<br />
<br />
<pre><br />
[ML1250]<br />
comment = Samsung ML-1250 Laser Printer<br />
printer=ml1250<br />
path = /var/spool/samba<br />
printing = cups<br />
printable = yes<br />
printer admin = @admin root neocephas<br />
user client driver = yes<br />
# to allow user 'guest account' to print.<br />
guest ok = no<br />
writable = no<br />
write list = @adm root neocephas<br />
valid users = @adm root neocephas<br />
</pre><br />
<br />
Please note that in my configuration I made it 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, you must set up a regular Linux account and then set up a Samba password on the server. For instance:<br />
<br />
<pre><br />
# useradd neocephas<br />
# smbpasswd -a neocephas<br />
</pre><br />
<br />
After setting up any user accounts that you need, you will also need to set up the samba spool directory:<br />
<br />
<pre><br />
# mkdir /var/spool/samba<br />
# chmod 777 /var/spool/samba<br />
</pre><br />
<br />
The next items that need changing are <code>/etc/cups/mime.convs</code> and <code>/etc/cups/mime.types</code>:<br />
<br />
<code>mime.convs</code>:<br />
<pre><br />
# The following line is found at near the end of the file. Uncomment it.<br />
application/octet-stream application/vnd.cups-raw 0 -<br />
</pre><br />
<br />
<code>mime.types</code>:<br />
<pre><br />
# Again near the end of the file.<br />
application/octet-stream<br />
</pre><br />
<br />
The changes to <code>mime.convs</code> and <code>mime.types</code> are needed to make CUPS print Microsoft Office document files. Many people seem to need that.<br />
<br />
After this, restart your Samba daemon:<br />
<br />
<pre><br />
# /etc/rc.d/samba restart<br />
</pre><br />
<br />
Obviously there are a lot of tweaks and customizations that can be done with setting up a Samba print server, so I advise you to look at the Samba and CUPS documentation for more help. The <code>smb.conf.example</code> file also has some good samples to that you might want to look at.<br />
<br />
==Windows 2000 and Windows XP to Linux==<br />
<br />
For the most modern flavors of Windows, an alternative way of connecting to your 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 you allow the clients to access the print server by editing the location settings as specified in section 4.1.<br />
<br />
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 your printer:<br />
<br />
<i>http://host_ip_address:631/printers/printer_name</i><br />
<br />
where host_ip_address is the Linux server's IP address and printer_name is the name of the printer you are connecting to. After this, install the printer drivers for the Windows computer. If you setup the CUPS server to use its own printer drivers, then you can just select a generic postscript printer for the Windows client. You can then test your print setup by printing a test page.<br />
<br />
==Others to Linux, Linux to others==<br />
<br />
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<br />
<br />
=Appendix=<br />
<br />
==Alternative CUPS Interfaces==<br />
<br />
If you are a GNOME user, you can manage and configure your printer by using the gnome-cups-manager.<br />
<br />
Update: this package is now available through pacman if you have the "community" repository uncommented in <code>/etc/pacman.conf</code><br />
<br />
<pre><br />
# pacman -S gnome-cups-manager<br />
</pre><br />
<br />
The package is also still available from the [http://aur.archlinux.org/packages.php?do_Details=1&ID=66&O=0&L=0&C=0&K=cups&SB=&SO=&PP=25&do_MyPackages=0&do_Orphans=0&SeB=nd AUR].<br />
<br />
KDE users can modify their printers from the Control Center. Both should refer to those desktop environments' documentation for more information on how to use the interfaces.<br />
<br />
There is also gtklp. It is in the "extra" repository.<br />
<br />
<pre><br />
# pacman -S gtklp<br />
</pre><br />
<br />
You may also install system-config-printer from the "community" repository;<br />
<br />
<pre><br />
# pacman -S system-config-printer<br />
</pre><br />
For system-config-printer to work as it should you may run as root or with sudo/gksudo, or alternatively set up a "normal" user to administer cups (if so '''follow steps 1-3''')<br />
<br />
* 1. Create group, and add a user<br />
<pre><br />
# groupadd lpadmin<br />
# usermod -aG lpadmin <username><br />
</pre><br />
<br />
* 2. Add "lpadmin" (without the quotes) to this line in /etc/cups/cupsd.conf<br />
<pre><br />
SystemGroup sys root <insert here><br />
</pre><br />
<br />
* 3. Restart cups, log out and in again (or restart your computer)<br />
<pre><br />
# /etc/rc.d/cups restart<br />
</pre><br />
<br />
==PDF Virtual Printer==<br />
<br />
A nice is CUPS-PDF. This package allows one to setup a virtual printer that will generate a PDF from anything sent to it. Obviously this package is not necessary, but it can be quite useful.<br />
<br />
You can find generated PDF documents in a directory of your user name located in <code>/var/spool/cups-pdf</code> directory.<br />
<br />
This package can be installed by the following command:<br />
<br />
<pre><br />
# pacman -S cups-pdf<br />
</pre><br />
<br />
After installing the package, you can set it up as you would for any other printer in the web interface. For the Device, select '''CUPS-PDF (Virtual PDF Printer)'''; Make/Manufacturer, choose '''Generic'''; Model/Driver, select '''Generic postscript color printer'''. Alternatively, provide the PPD file from this link: [http://www.physik.uni-wuerzburg.de/~vrbehr/cups-pdf/cups-pdf-CURRENT/extra/CUPS-PDF.ppd].<br />
<br />
==Online Resources==<br />
<br />
Here is a listing of web sites that may be of use to you:<br />
<br />
* <b>Official CUPS documentation on your computer</b> http://localhost:631/documentation.html<br />
* <b>Official CUPS Website</b> - http://www.cups.org/<br />
* <b>Linux Printing</b> - http://www.linuxprinting.org/<br />
* <b>Tips and Suggestions on common CUPS problems</b> - http://home.nyc.rr.com/computertaijutsu/cups.html<br />
* <b>Gentoo's Printing Guide</b> - http://www.gentoo.org/doc/en/printing-howto.xml<br />
* <b>Arch Linux User Forums</b> - http://bbs.archlinux.org/<br />
<br />
==Specialized Cases==<br />
<br />
This section is dedicated to specific problems and their solutions. If you managed to get some unusual printer working, please put the solution here.<br />
<br />
===Brother DCP 7020 ===<br />
See [[Brother_DCP-7020]].<br />
<br />
===Getting FX C1110 (not model B) to work ===<br />
<br />
'''Assumes:''' <br />
<br />
# The printer is connected and listening on the network.<br />
# The printer driver is in rpm package.<br />
<br />
* Install cpio and rpmunpack to later unpack rpm package<br />
<br />
pacman -S cpio rpmunpack cups ghostscript gsfonts<br />
<br />
* Get the FX Linux Driver [http://www.fujixeroxprinters.com/downloads/uploaded/Drivers/DocuPrint%20C1110%20C1110B/linux/fxlinuxprint-1.0.1-1.i386.zip here]<br />
<br />
* In /var/tmp unzip fxlinuxprint-1.0.1-1.i386.zip<br />
<br />
unzip fxlinuxprint-1.0.1-1.i386.zip -d /var/tmp<br />
<br />
* In /var/tmp<br />
<br />
cd /var/tmp<br />
rpmunpack fxlinuxprint-1.0.1-1.i386.rpm<br />
gunzip fxlinuxprint-1.0.1-1.cpio.gz<br />
mkdir /var/tmp/DST<br />
mv fxlinuxprint-1.0.1-1.cpio /var/tmp/DST<br />
cd /var/tmp/DST<br />
cpio -id < fxlinuxprint-1.0.1-1.cpio<br />
rm fxlinuxprint-1.0.1-1.cpio<br />
cd /var/tmp<br />
find /var/tmp/DST -type f |cat -n<br />
1 /var/tmp/DST/etc/cups/mimefx.convs<br />
2 /var/tmp/DST/etc/cups/mimefx.types<br />
3 /var/tmp/DST/usr/lib/cups/filter/pdftopjlfx<br />
4 /var/tmp/DST/usr/lib/cups/filter/pstopdffx<br />
5 /var/tmp/DST/usr/lib/cups/filter/pdftopdffx<br />
6 /var/tmp/DST/usr/share/cups/model/FujiXerox/en/fxlinuxprint.ppd<br />
<br />
* Copy /var/tmp/DST files to /<br />
<br />
'''Note:''' for the PPD use /usr/share/cups/model/fxlinuxprint.ppd<br />
<br />
* Point web browser at http://localhost:631/ and point and click to add lpd://f.q.d.n/queue printer<br />
<br />
'''Note:''' in the final step authenticate using the root password<br />
<br />
* Manage Printer and Set Printer Options<br />
<br />
* Print a test page, and if printer name is color103, use at a shell prompt<br />
<br />
lpq -Pcolor103<br />
color103 is ready<br />
no entries<br />
<br />
* The End<br />
<br />
===Printing does not work/aborts with the HP Deskjet 700 Series Printers.===<br />
<br />
*The solution is to install <b>pnm2ppa</b> printer filter for the HP Deskjet 700 series. Without this the print jobs will be aborted by the system. A [[ABS - The Arch Build System | PKGBUILD]] for pnm2ppa can be found in [http://aur.archlinux.org/packages.php?do_Details=1&ID=696&O=0&L=0&C=0&K=pnm&SB=n&SO=a&PP=25&do_MyPackages=0&do_Orphans=0 AUR].<br />
<br />
===Getting HP LaserJet 1010 to work===<br />
I had to compile ghostscript myself because ESP gs in rep was 7.07 and had not fixed some bugs like ESP 8.15.1 had. I never downloaded 'foomatic' in rep. I think that is an old package. <br />
<pre><br />
$ pacman -Qs cups a2ps psutils foo ghost<br />
local/cups 1.1.23-3<br />
The CUPS Printing System<br />
local/a2ps 4.13b-3<br />
a2ps is an Any to PostScript filter<br />
local/psutils p17-3<br />
A set of postscript utilities.<br />
local/foomatic-db 3.0.2-1<br />
Foomatic is a system for using free software printer drivers with common<br />
spoolers on Unix<br />
local/foomatic-db-engine 3.0.2-1<br />
Foomatic is a system for using free software printer drivers with common<br />
spoolers on Unix<br />
local/foomatic-db-ppd 3.0.2-1<br />
Foomatic is a system for using free software printer drivers with common<br />
spoolers on Unix<br />
local/foomatic-filters 3.0.2-1<br />
Foomatic is a system for using free software printer drivers with common<br />
spoolers on Unix<br />
local/espgs 8.15.1-1<br />
ESP Ghostscript<br />
</pre><br />
I also had to set LogLevel in <code>/etc/cups/cupsd.conf</code> to debug2 before i saw that I missed some "Nimbus" fonts. Then I had to rename and put them where the log told me to. Some fancy google searching had to be applied, e.g., http://www.google.com/search?q=n019003l+filetype%3Apfb since the fonts turned out to be proprietary (I'm sure Windows comes with these by default). Nevertheless, after downloading them (about 7 fonts) and putting them in the correct directory, printing started working.<br />
<br />
Before, I was getting all the errors said here: http://linuxprinting.org/show_printer.cgi?recnum=HP-LaserJet_1010 'Unsupport PCL' etc...<br />
<br />
I'm sure it could have worked with ESP gs 7.07 too (in rep) if I were smart enough to turn on DebugLevel2 sooner :/ UPDATE: yeah it did... maybe this info is useful for someone else though... sorry for the inconvenience.<br />
<br />
===Getting HP LaserJet 1020 to work===<br />
<br />
====Manual installation====<br />
After a lot of tries with hplib and gutenprint, I finally found the solution to get my printer HP LaserJet 1020 printing. <br />
<br />
First of all, you only need to install cups and ghostscript. Then follow the link on http://www.linuxprinting.org/show_printer.cgi?recnum=HP-LaserJet_1020 to the http://foo2zjs.rkkda.com/ printer driver page and follow the install instructions. Log in as root. After you've downloaded the package and extracted the archive, change into the foo2zjs directory. Now you can follow the original installation instructions with a minor modification to change the userid for printing:<br />
<br />
$ make<br />
$ ./getweb 1020<br />
<br />
Open the ''Makefile''<br />
$ nano Makefile<br />
and search for the line<br />
# LPuid=-olp<br />
and modify it to<br />
# LPuid=-oroot<br />
then continue with the script<br />
$ make install<br />
$ make install-hotplug<br />
$ make cups<br />
<br />
====Installation from AUR====<br />
You can also use the package foo2zjs from AUR and modify the PKGBUILD. Change the line:<br />
<br />
./getweb all<br />
<br />
to<br />
<br />
./getweb 1020<br />
<br />
(or if you're setting another printer, change this line to what you need).<br />
<br />
If you get errors with incorrect md5sums, you should also change the md5sum of foo2zjs.tar.gz in PKGBUILD to match the downloaded driver.<br />
<br />
As a last step, add and configure the printer in the CUPS manager. The printer should be recognized automatically. It works fine for root and all users. When booting the operating system, the printer is initialized and indicates it's working.<br />
<br />
=== Printer connected to an Airport Express Station ===<br />
The first thing to do is to scan the airport express station. It<br />
seems that there are different addresses depending on the model.<br />
<pre><br />
[root@somostation somos]# nmap 192.168.0.4<br />
<br />
Starting Nmap 4.20 ( http://insecure.org ) at 2007-06-26 00:50 CEST<br />
Interesting ports on 192.168.0.4:<br />
Not shown: 1694 closed ports<br />
PORT STATE SERVICE<br />
5000/tcp open UPnP<br />
9100/tcp open jetdirect<br />
10000/tcp open snet-sensor-mgmt<br />
MAC Address: 00:14:51:70:D5:66 (Apple Computer)<br />
<br />
Nmap finished: 1 IP address (1 host up) scanned in 25.815 seconds<br />
</pre><br />
With my station, the port is 9100. The airport station is accessed like<br />
an HP JetDirect printer.<br />
Afterwards, you can edit your <code>printer.conf</code> file in this way:<br />
<pre><br />
# Printer configuration file for CUPS v1.2.11<br />
# Written by cupsd on 2007-06-26 00:44<br />
<Printer LaserSim><br />
Info SAMSUNG ML-1510 gdi<br />
Location SomoStation<br />
DeviceURI socket://192.168.0.4:9100<br />
State Idle<br />
StateTime 1182811465<br />
Accepting Yes<br />
Shared Yes<br />
JobSheets none none<br />
QuotaPeriod 0<br />
PageLimit 0<br />
KLimit 0<br />
OpPolicy default<br />
ErrorPolicy stop-printer<br />
</Printer><br />
</pre><br />
It should work. I had a few problems. They were resolved by removing foomatic and installing foomatic-db, foomatic-db-engine, foomatic-db-ppd instead.<br />
<br />
===Performing Utility Functions on Epson Printers===<br />
<br />
====Escputil====<br />
<br />
Here we explain how to perform some of the utility functions such as nozzle cleaning and nozzle checks on Epson printers. We will use the escputil utility, which is part of the gutenprint package.<br />
<br />
There is a man page ("man escputil") that provides pretty good information, but it does not include necessary information on how to identify your printer. There are two parameters that can be used. One is --printer; what it expects is the name you used to identify your printer when you configured it. The other is --raw-device. What this option expects is is something beginning with "/dev". If your printer is a serial printer, and the only serial printer, it is "/dev/lp0". If it is a USB printer, it is "/dev/usb/lp0". If you have more than one printer, they will have names ending in "lp1", "lp2", etc. <br />
<br />
* To clean the printer heads:<br />
<br />
escputil -u --clean-head<br />
<br />
* To print the nozzle-check pattern, allowing you to verify that the previous head cleaning worked. (Or to determine that you need to clean the heads)<br />
<br />
escputil -u --nozzle-check<br />
<br />
If you want to perform an operation that requires two-way communication with a printer, you must use the "--raw-device" specification and your user must be root or be a member of the group "lp". <br />
<br />
* The following is an example of getting the printer's internal identification:<br />
<br />
sudo escputil --raw-device=/dev/usb/lp0 --identify<br />
<br />
* To print out the ink levels of the printer:<br />
<br />
sudo escputil --raw-device=/dev/usb/lp0 --ink-level<br />
<br />
====Mtink====<br />
<br />
This is a printer status monitor which enables to get the remaining ink quantity, to print test patterns, to reset printer and to clean nozzle. It use an intuitive graphical user interface. Package can be downloaded from [http://aur.archlinux.org/packages.php?do_Details=1&ID=476&O=0&L=0&C=0&K=mtink&SB=n&SO=a&PP=25&do_MyPackages=0&do_Orphans=0&SeB=nd AUR].<br />
<br />
==Another Source for Printer Drivers==<br />
<br />
On <i>http://www.turboprint.de/english.html</i> is a really good printer driver for many printers not yet supported by Linux (especially Canon i*). The only problem is that high-quality-prints are either marked with a turboprint-logo or you have to pay for it -- it's not open source.<br />
<br />
{{Wikipedia|Common_Unix_Printing_System}}<br />
<br />
=Troubleshooting=<br />
==As a result of upgrade==<br />
<br />
===Error with gnutls===<br />
After updating, if you get something like :<br />
/usr/sbin/cupsd: error while loading shared libraries: libgnutls.so.13: cannot open shared object file: No such file or directory<br />
<br />
You need to update gnutls:<br />
<pre><br />
# pacman -Sy gnutls<br />
</pre><br />
<br />
In addition, in <code>/etc/cups</code>, there will be a file named <code>cupsd.conf.pacnew</code>. Rename it <code>cupsd.conf</code>.<br />
<br />
===All jobs are "stopped"===<br />
After updating CUPS, if all jobs sent to the printer become "stopped", delete the printer and add it again.<br />
Using the CUPS web interface (http://localhost:631), go to Printers > Delete Printer.<br />
<br />
''Note:'' If you don't remember your printer's settings, go to Printers > Modify Printer. Copy down the information displayed, click 'Modify Printer' to proceed to the next page(s), etc.<br />
<br />
===The PPD version (XXXXXX) is not compatible with Gutenprint X===<br />
Run (as root)<br />
<pre><br />
/usr/sbin/cups-genppdupdate<br />
</pre><br />
And restart CUPS (as pointed out in gutenprint's post-install message)<br />
<br />
==Other==<br />
<br />
===A HPLIP printer sends "/usr/lib/cups/backend/hp failed" error===<br />
Make sure dbus is installed and running, e.g. check DAEMONS in /etc/rc.conf or run 'ls /var/run/daemons'.<br />
<br />
===CUPS returns ""foomatic-rip" not available/stopped with status 3" with a HP printer===<br />
<br />
If you receive any of the following error messages in /var/log/cups/error_log while using a HP printer, with jobs appearing to be processed while they all end up not being completed with their status set to 'stopped':<br />
<br />
* Filter "foomatic-rip" for printer "<printer_name>" not available: No such file or director<br />
* PID 5771 (/usr/lib/cups/filter/foomatic-rip) stopped with status 3!<br />
<br />
Make sure you have '''hplip''' installed, in addition to [[CUPS_Setup#Packages|the packages mentioned above]]; '''net-snmp''' is also needed. See http://bbs.archlinux.org/viewtopic.php?id=65615<br />
<br />
<pre><br />
# pacman -S hplip<br />
</pre><br />
<br />
Personally I experienced this with a HP LaserJet 1100A (hplip says it only supports a couple of laser models, which could make you skip the option of trying it) over an LPR print server. I don't know if it applies to using it through /dev/lp0 (parallell port) as well, although it would make sense.<br />
<br />
===Printing fails with unauthorised error===<br />
If you added yourself to the lp group, and allowed your user to print (cups.conf), then problem lies in /etc/cups/printers.conf. There should be a line that says<br />
<pre>AuthInfoRequired negotiate</pre><br />
Just delete it or comment it out, restart cups and printing will magically work again.</div>Furret