
From mit-eddie!INDYVAX.IUPUI.EDU!ICBJ100 Tue, 14 Jan 1992 01:16:52 EST remote from kendra
Received:  from kendra by ffactory.kew.com (UUPC/extended 1.11r) with UUCP;
           Tue, 14 Jan 1992 01:16:52 EST
Received:  from mit-eddie by kewgate.kew.com (UUPC/extended 1.11r) with UUCP;
           Mon, 13 Jan 1992 22:16:08 EST
Received: from indyvax.iupui.edu by EDDIE.MIT.EDU with SMTP (5.65/25-eef)
	id AA27970; Mon, 13 Jan 92 21:01:04 -0500
Received: from INDYVAX.IUPUI.EDU by INDYVAX.IUPUI.EDU (PMDF #12264) id
 <01GFA4VYVK7K0032DS@INDYVAX.IUPUI.EDU>; Mon, 13 Jan 1992 21:00 -0500
Date: Mon, 13 Jan 1992 21:00 -0500
From: Michael Morrett <mit-eddie!INDYVAX.IUPUI.EDU!ICBJ100>
Subject: My UNIX host UUCP setup
To: ahd@kew.com
Message-Id: <01GFA4VYVK7K0032DS@INDYVAX.IUPUI.EDU>
X-Vms-To: IN%"ahd@kew.com"
X-Vms-Cc: ICBJ100

Hi Drew,

A person in Finland (Saku Elovarra <se@sakke.pp.fi>) asked to see
my UNIX host UUCP setup. Here is what I sent. You can make this
information avaliable to anyone if you think what I wrote is worth
a bears butt.

thanks,
mike
-----------------------------------------------------------------
                                                      13-JAN-1992
                                               Michael R. Morrett
                                        icbj100@indyvax.iupui.edu
                                        Indianapolis, Indiana USA
                                                   1-317-265-1870

                                     314 lines / 13074 characters

Here is how my UNIX host is configured to run UUCP...

+------------------+
| Intergraph       |     +-------+             +-------+
| InterPro 2020    |     | Hayes |             | Hayes |
| UNIX Workstation X-----X V9600 | . . . . . . | V9600 |
| System V 3.1     |  ^  | Modem |      ^      | Modem |
| HoneyDanBer UUCP |  ^  +-------+      ^      +---X---+
+------------------+  ^                 ^          |
     "frogshid"       ^          telephone line    |
                      ^                            |
25 pin male/female straight                +-------X-------+
through RS-232 cable (The                  | PC running    |
workstation only has pins                  | UUPC/extended |
1-8 & 20 cabled to the                     +---------------+
modem port tty00.)                             "flybait"

The Hayes modem is connected to port /dev/tty00 (the only port
with modem control on the workstation). This port is configured
at 9600 baud and with RTS/CTS flow control.

+--------------+
| /etc/inittab |
+--------------+
t0:234:respawn:/usr/lib/uucp/uugetty -r -t 30 tty00 9600H

This port (tty00) is using uugetty to allow the port to dial in
or dial out. The "-r" flag causes uugetty to wait to read a
character before it displays the login message. The "-t" flag
specifies the length of time in seconds (30 seconds for my host)
uugetty will wait before aborting if no response. The 9600H is a
pointer to an entry in the /etc/gettydefs file.

+----------------+
| /etc/gettydefs |
+----------------+
9600H# B9600 BRKINT IGNPAR ICRNL IXON IXANY OPOST ONLCR CS8 \
CREAD ISIG HUPCL ECHO ECHOE ECHOK ICANON # B9600 BRKINT IGNPAR \
ICRNL IXON IXANY OPOST ONLCR CS8 CREAD ISIG HUPCL ECHO ECHOE \
ECHOK ICANON #login: #2400H

2400H# B2400 BRKINT IGNPAR ICRNL IXON IXANY OPOST ONLCR CS8 \
CREAD ISIG HUPCL ECHO ECHOE ECHOK ICANON # B2400 BRKINT IGNPAR \
ICRNL IXON IXANY OPOST ONLCR CS8 CREAD ISIG HUPCL ECHO ECHOE \
ECHOK ICANON #login: #1200H

1200H# B1200 BRKINT IGNPAR ICRNL IXON IXANY OPOST ONLCR CS8 \
CREAD ISIG HUPCL ECHO ECHOE ECHOK ICANON # B1200 BRKINT IGNPAR \
ICRNL IXON IXANY OPOST ONLCR CS8 CREAD ISIG HUPCL ECHO ECHOE \
ECHOK ICANON #login: #9600H

The "\" continuation character is NOT part of the lines above.
They are just three really long lines. It is shown this way to
make it "pretty" for this document. The first line starts with
9600H# and ends with #2400H. The second line starts with 2400H#
and ends with #1200H. The third line starts with 1200H# and ends
with #9600H.

The first part and last part of each line are labels. The
/etc/inittab file says to read the line labeled 9600H in the
/etc/gettydefs file. If there is an error reading this line or
the remote host or the remote user sends a BREAK, the label at
the end of the 9600H line says to read the line labeled 2400H.
These labels provide a "goto" function.

To create the three lines for modem use, a line in the existing
/etc/gettydefs file labeled 9600 was copied to create three new
lines labeled 9600H, 2400H, and 1200H. CLOCAL was changed to
HUPCL in two places in each line so that when the connection
stops (carrier detect is lost), the uugetty process will die and
drop the DTR lead. The baud Bxxx settings in two places in each
line also need to be changed.

Besides HUPCL, another important option is CS8. This sets the
character size to eight (needed for "g" UUCP protocol). The "man
pages" for gettydefs(4) and termio(7) describe in detail the
other options in the /etc/gettydefs file.

+-------------+
| /etc/passwd |
+-------------+
uucp:*:5:1:Admin/cron login:/usr/lib/uucp:
nuucp:*:6:1:uupsycho login:/usr/spool/uucppublic:/usr/lib/uucp/uucico
uubugs:xxx:6:1:uupsycho login:/usr/spool/uucppublic:/usr/lib/uucp/uucico
        |
(13 character encrypted password)

The "uucp" login is the administrative login id that "owns" all
UUCP files and directories. It is also used by cron to execute
the UUCP maintenance programs.

The "nuucp" login is the login id that remote uucico programs
will use to log into the local host. For security reasons, this
account on my host is disabled. The "nuucp" account was copied to
create a separate login for each remote host that calls my host.
For example, the "uubugs" login id will be used by the PC host
"flybait".

+-----------------------+
| /usr/lib/uucp/Systems |
+-----------------------+
flybait Any ACU 9600 9=123-4567 "" \r\d\r ogin:--ogin: tadpole ssword: mucus
1       2   3   4    5          6  7      8            9       10      11
                                \-------------- chat script ---------------/

1 = remote host name
2 = call Anytime
3 = index into Devices file (1st field) to find port type
4 = index into Devices file (4th field) to find port baud rate
5 = remote host phone number
6 = expect ""
7 = send carriage return + delay (1-2 seconds) + carriage return
8 = expect-send and subexpect-subsend information
    Expect "ogin:" (part of "login:"). If not received, send
    a carriage return or linefeed, look again for "ogin:".
    Between the "--" is where the carriage return or linefeed is
    sent. Additional characters can be included between the "--"
    if needed.
9 = send remote host login id
10 = expect "ssword:" (part of "Password:")
11 = send remote host password

+-----------------------+
| /usr/lib/uucp/Devices |
+-----------------------+
ACU tty00 - 9600 hayes
1   2     3 4    5

1 = device type ACU (Automatic Call Unit) - a modem, indexed from
    the Systems file
2 = device port
3 = not used
4 = baud rate, indexed from the Systems file
5 = index into Dialers file (1st field) to find modem name

+-----------------------+
| /usr/lib/uucp/Dialers |
+-----------------------+
hayes   =,-,    "" \dAT "" \dAT OK-\dAT-OK \dATDT\T CONNECT
1       2       3  4    5  6    7          8        9

1 = modem name, indexed from the Devices file
2 = "=" equals "," and "-" equals ","
    This allows the use of "=" and "-" in the Systems file (fifth
    field) for the remote host phone number. This translates the
    "=" and the "-" characters to the Hayes modem "," pause
    character.
3 = expect ""
4 = send delay + AT
5 = expect ""
6 = send delay + AT
7 = expect OK, if not received, send delay + AT again, expect OK
8 = send delay + ATDT + remote host phone number. The "\T" means
    use the information in the Dialcodes file if needed.
9 = expect CONNECT

+-------------------------+
| /usr/lib/uucp/Dialcodes |
+-------------------------+
(I do not use.)

+---------------------------+
| /usr/lib/uucp/Permissions |
+---------------------------+
LOGNAME=nuucp
LOGNAME=uubugs VALIDATE=flybait MACHINE=flybait \
        REQUEST=yes SENDFILES=yes PUBDIR=/usr/spool/uucppublic/flybait \
        READ=/ WRITE=/usr/spool/uucppublic/flybait \
        COMMANDS=rmail

Options             LOGNAME                  MACHINE
                    (remote calls local)     (local calls remote)
------------------  -----------------------  --------------------

VALIDATE            Remote host must log in  Does not apply
                    with user id specified
                    by LOGNAME. This links
                    MACHINE and COMMANDS
                    with a LOGNAME entry.

REQUEST=yes/no      Can remote host          Same meaning
                    request files from
                    local host (default is
                    no).

SENDFILES=yes/call  Can local host send      Does not apply
                    files queued for remote
                    host (default is call,
                    only send when local
                    host calls remote host).

READ=pathnames      Directories uucico may   Same meaning
                    read from (default
                    /usr/spool/uucppublic).

WRITE=pathnames     Directories uucico may   Same meaning
                    write to (default
                    /usr/spool/uucppublic).

COMMANDS=commands   Does not apply           Commands uuxqt will
                                             execute for remote
                                             host (default
                                             rmail).

+--------------------+
| /usr/lib/uucp/Poll |
+--------------------+
flybait<tab>9 13

My host has a cron job execute the shell script
/usr/lib/uucp/uudemon.poll at eight minutes before every hour.
This shell script checks the /usr/lib/uucp/Poll file to find
remote hosts that are to be polled. It then creates the required
work file /usr/spool/uucp/hostname/C.hostnamn0000. Another cron
job executes the shell script /usr/lib/uucp/uudemon.hour (it runs
uusched and uuxqt in the background) at four minutes before every
hour. As a result of these two cron jobs, the remote host
"flybait" will be called at 9:56am and 1:56pm.

The work file name (C.flybaitn1234 for example) is created in an
unique way by adding "C." + first seven characters of remote host
name + an ASCII character representing the grade (priority) of
the work and a 4-digit job sequence number asigned by UUCP. The
"C" stands for Command file. Uucico processes the file priority
in order from A to Z and then a to z. The latest sequence number
is stored in the file /usr/lib/uucp/SEQF, but polling work files
are always sequence number 0000.

+-------------+
| Hayes Modem |
+-------------+
The modem was setup by executing the following commands on a PC
temporarily connected to the Hayes modem:

                    AT&FM0Q2&C2&D3S0=1&Y0&W0&W1

AT&F   recall factory configuration
M0     turn speaker off
Q2     return result codes in originate mode, do not return
       result codes in answer mode
&C2    Pin 8 - presume presence of carrier detect (CD) signal
       until on-line, then monitor status of signal
&D3    Pin 20 - monitor DTR signal and when an on-to-off
       transition of DTR signal occurs, hang up and perform a
       hard reset
S0=1   answer on 1 ring
&Y0    specify stored user profile 0 as power-up configuration
&W0    write storable parameters as profile 0
&W1    write storable parameters as profile 1

Option Q2 (it appears most people use Q1) is used because it
allows the modem result codes (OK, CONNECT, etc) to be seen on a
manually dialed connection and disables the modem result codes in
answer mode. If the modem echoes the result code (CONNECT for
example) on an incoming call, the local host uugetty will see the
capital letters in the result code and think the remote host only
understands uppercase! At least three weeks of time was spent in
tracking down this problem!

Option &C2 (it appears most people use &C1) is used because it
allows a manually dialed connection (Kermit for example) to the
modem even if carried detect is not present or enabled. Because
the /etc/gettydefs file has HUPCL, the uugetty process will NOT
communicate with the modem without seeing carrier detect if
option &C1 is used.

Option &D3 (it appears most people use &D2) is used because this
causes the modem to do a HARD reset when the line disconnects and
DTR is dropped by the uugetty process. A Zillion dollar phone bill
would be a BIG shock!

The &Y0, &W0, and &W1 commands make sure when the modem resets,
it comes up in a known state. My modem had a weird setup stored
in profile 1 (from some other project) and &Y1 was set. Again, it
took a long time to figure out this problem.

The Hayes modem has RTS/CTS local flow control (&K3) and
communicate in error-control mode (&Q5) enabled by default.

+----------------+
| Required Books |
+----------------+
"Managing UUCP and Usenet" by O'Reilly & Associates

+----------------+
| Optional Books |
+----------------+
"UNIX Administration Guide for System V" by Rebecca Thomas &
   Rik Farrow (Very good 106 page chapter on UUCP)
"Using UUCP and Usenet" by O'Reilly & Associates
"The Waite Group's UNIX Communications" by SAMS

+---------+
| Remarks |
+---------+
The hardest part about UUCP is the modem setup, next the chat
script. The first modem on my workstation was a NEC modem that
has about 3,000,000 setup commands and the factory default
configuration makes absolutely no sense! The NEC modem has a
factory default of NO flow control!! About two months of time was
spent trying to get UUCP to work with the NEC modem! When the
NEC modem was replaced with a Hayes modem, UUCP started working
just great!

If you have any comments (good or bad), corrections, question,
PLEASE send me mail! :-)
