Linux simple fax printer server mini-HOWTO
DISCLAIMER: No warranties. Comments are always welcome. This document describes in details one of the simplest ways to setup fax server on your Linux system. The fax is available to the users on the local host and to network users.
To get a working printer/fax on the linux machine you should have some software and fax modem. The Printing software will be using the fax software as a print filter. The efax will find the fax number from the print Job number and will send the fax. The efax software was written be Ed Casas firstname.lastname@example.org. The rest of the document is build as Q&A.
Questions & Answers
Q: What is a fax printer server ? A: A fax printer server is a setup of few programs: efax, and the print server, in such a way that sending a fax from the computer is as simple as sending printout to a printer.
Q: How to set it up ? A: Setting efax as fax print server includes few problems As I worked it out few times, I decided to collect this wisdom in this small mini- HOWTO, comments are welcome at email@example.com. I describe them here and the solutions, and all the instruction in short steps:
make sure you have the efax package. On RPM based system use the command 'rpm -qv efax'. The efax documentation is missing the : at the end of the printcap entry.
Solution: Add the following /etc/printcap entry:
:lp=/dev/null:\ :sd=/var/spool/fax:\ :if=/usr/bin/faxlpr:
Use hard link and not symbolic link to the fax command. Run the command: ln /usr/bin/fax /usr/bin/faxlpr
Edit the /usr/bin/fax to your preferences: choose the right Fax Class for your modem: CLASS=2.0 Set the FROM=“your international phone number” field: NAME=“Your Name” Add the line for conversion of international phone number to local for example in Israel you would use: TELCVT='sed -e s/+972/0/ -e s/+/00/' # Israel
There is a problem in the file in line 586, change the cfile=… with the following two lines: cfile=`/usr/bin/tail -1 lock` cfile=`cat $cfile`
at lines 586,587 there shouldn't be '-' signs the lines are: 0) echo “$l” | mail -s “fax to $num succeeded” $user@$host ;; *) echo “$l” | mail -s “fax to $num failed ” $user@$host ;;
create the directory /var/spool/fax : mkdir /var/spool/fax chmod 777 /var/spool/fax
The lock file (/var/spool/fax/lock) is being created with incorrect permissions, use the following command to set it correctly: touch /var/spool/fax/lock ; chmod 644 /var/spool/fax/lock
The efax program is expecting real device file at the /dev/modem and will not work with symbolic link, so create a device file with the same major and minor number as the /dev/cua? the is connected to the modem. The file should have the rw-rw-rw- mode to enable any user to use the fax software.
ls -lL /dev/modem rm /dev/modem mknod /dev/modem c Mj Mi chmod 666 /dev/modem
Mj is 5, and Mi is 64 for the cua0, 65 for cua1 and so on. For example (for cua1): mknod /dev/modem c 5 65
change the mode at the /var/lock directory : chmod 1777 /var/lock
You should use the fax printer using the -P option and the -J option with the fax number. use one of the following lpr commands:
lpr -Pfax -J <Fax-Number> [file-names] any command | lpr -Pfax -J <Fax-Number>
Q: Where do I specify the target Fax number ? A: After the -J option.
Q: How do I use it from other Unixes on the net ? A: Add the following entry into the /etc/printcap file and the client Linux systems, create the spool directory, and so on …
:sd=/var/spool/fax:\ :mx#0:\ :sh:\ :rm=host.domain:\ :rp=fax:
add the name of the client hosts into the /etc/hosts.lpd on the fax server machine. use it as before.
Note: The header string that efax adds to the fax pages is not effected by the user name that sends the fax. (can be updated).
The LPRng printing management software is using a different method to handle the control file. Thanks to Luca Montecchiani firstname.lastname@example.org, who found the problem and the solution. Here is an update to the /usr/bin/fax file. The following line replace the two simple cfile=… lines at lines 586,587
# Modified to work also with the LPRng package # Luca Montecchiani (08/11/97 email@example.com) if [ !-z “$CONTROL_FILE” ]
then cfile=`cat tail -1 lock` cfile=`cat $cfile` else cfile=$CONTROL_FILE