In small organisations it can be desireable to replace a cumbersome fax machine with a computer and modem. In this fashion all faxes are recieved into this share and available for all to read in TIF or PDF formats. We plan to follow this with a document about a more complex FaxDispatch operation.
Configure Samba Share Point
Create a share that is only accessable to a single user and force all connections to that user.
Create the directory and change ownership accordingly.
Hylafax typically runs as the user
uucp, this example has Samba use the same account.
Merge the following into
/etc/samba/smb.conf, or use a fancy include file.
Update as necessary for the target environment.
[fax] comment = Inbound Faxes force group = uucp force user = uucp path = /var/lib/samba/fax # say yes to prevent deletion (see below) read only = no
Then make the directory and change the ownership.
mkdir -p /var/lib/samba/fax chmod 0755 /var/lib/samba/fax chown uucp /var/lib/samba/fax
After a fax is recieved Hylafax will drop it into
recvd/ then execute
faxrcvd will source FaxDispatch allowing almost complete control of the delivery operation.
All paths given here are relative to the Hylafax root, on Gentoo this is
The FaxDispatch script is run as a shell script, so can use whatever features your default shell has.
This includes interacting with external services, or executing commands like
curl to make HTTP notifications.
cat etc/FaxDispatch # Don't want emails NOTIFY_FAXMASTER="never" # New name n=`date +%Y.%m.%d.%H.%M.%S` # New destination t=/var/lib/samba/fax/$n # See interesting information, commands could `2>&1 >>` here too # set > /tmp/FaxDispatch.log # make pdf in target $TIFF2PDF -o $t.pdf $FILE # We only copy to the fax location, archive this just in case /bin/cp $FILE $t.tif # use this to move it instead, but then there is no archive and if # a user deletes it from the Samba Share it's gone forever # /bin/mv $FILE /var/lib/samba/fax # Make infos like faxrcvd if [ -f log/c$COMMID ]; then $SED -e '/-- data/d' \ -e '/start.*timer/d' -e '/stop.*timer/d' \ -e 's/=/=3D/g' \ log/c$COMMID elif [ -n "$COMMID" ]; then echo "$DICTNOLOGAVAIL ($DICTCOMMID c$COMMID)." else echo "$DICTNOLOGAVAIL." fi
It is not necessary to send a new fax everytime to test Hylafax.
Modify the user to allow
su, fake the
faxrcvd and cleanup.
The file in
recvq must already be present and with proper permissions, presumeably it's leftover from a previous fax.
Increment the COMMID each run, in the example it is 000000037.
# could also be `cat /etc/passwd|cut` but what about LDAP then? oh=`getent passwd uucp|cut -d: -f6` os=`getent passwd uucp|cut -d: -f7` usermod -d /var/spool/fax -s /bin/bash uucp su - uucp
As the uucp user do the following as many times a necessary to get it right. If there are no pre-existing TIF files in the directory any will do, name doesn' matter either (only to Hylafax, no user mode testing).
bin/faxrcvd "recvq/fax000000008.tif" "ttySL0" "000000037" "" bin/faxrcvd "recvq/fax000000008.tif" "ttySL0" "000000038" "" bin/faxrcvd "recvq/fax000000008.tif" "ttySL0" "000000039" "" exit
Now cleanup those user mods.
It's not necessary or required to change the homedir back.
Please be sure to change the shell back to
/bin/false or whatever it was to prevent login.
usermod -d $oh -s $os uucp
Now clean the Hylafax spool and deploy.