home *** CD-ROM | disk | FTP | other *** search
/ Il CD di internet / CD.iso / HOWTO / TERM-HOW < prev    next >
Encoding:
Text File  |  1995-04-20  |  78.4 KB  |  2,329 lines

  1.   term HOWTO
  2.   Bill Reynolds    bill@goshawk.lanl.gov, Patrick Reijnen
  3.   patrickr@cs.kun.nl
  4.   February 5, 1995
  5.  
  6.   1.  Legal Information
  7.  
  8.  
  9.  
  10.   1.1.    Copyright statement
  11.  
  12.   This document    may be distributed freely as a whole in    any form and
  13.   free of charge. Parts    of this    document may be    distributed, provided
  14.   that this copyright message is included and the reader is informed
  15.   that this is not the full HOWTO document. Furthermore, there is to be
  16.   a pointer as to where    the full document can be obtained. Specifically,
  17.   it may be included in    commercial distributions, without prior    consent.
  18.   However, I would like    to be informed of such usage.
  19.  
  20.   This HOWTO may be translated into any    language, whatsoever, provided
  21.   that you leave this copyright    statement and the disclaimer intact, and
  22.   that a notice    is appended stating who    translated the document.
  23.  
  24.  
  25.   1.2.    DISCLAIMER
  26.  
  27.  
  28.   While    I have tried to    include    the most correct and up-to-date
  29.   information available, I cannot guarantee that usage of the
  30.   information in this document does not    result in loss of data.    I
  31.   provide NO WARRANTY about the    information in this HOWTO and I    cannot
  32.   be made liable for any consequences for any damage resulting from
  33.   using    information in this HOWTO.
  34.  
  35.  
  36.   2.  Introduction
  37.  
  38.  
  39.  
  40.   2.1.    This Document
  41.  
  42.  
  43.  
  44.   This HOWTO attempts to clear up some of the confusion    of using term,
  45.   Michael O'Reilly's remarkable    program    that allows you    to multiplex
  46.   your serial line and set up a    network    connection.  By    and large, the
  47.   documents that come with term    are quite good,    and this HOWTO is not
  48.   intended to replace them. The    intention of this document is to give
  49.   some background on how term works and    detail the steps in getting some
  50.   of the more common networking    services working under term. It    should
  51.   be emphasized    that this document does    not cover everything there is to
  52.   know about term. After reading it, the term manual pages should be
  53.   read,    since they include information not contained here.
  54.  
  55.  
  56.   2.2.    What is    term?
  57.  
  58.   term is a program, written by    Michael    O'Reilly (michael@iinet.com.au),
  59.   that is run over a serial line to allow multiple connections to
  60.   operate concurrently - i.e. you may be down-load a file via your modem
  61.   while    working    on a (different) remote    system via the same modem
  62.   connection. term can also be used to open up X client    windows    over a
  63.   serial connection.  Through the tredir utility and the tudpredir
  64.   utility term can provide almost all of the ``traditional'' TCP/IP and
  65.   UDP network services:    mail, news, ftp, telnet, xarchie, etc.    In a
  66.   sense, term is very much like    other serial protocols such as SLIP or
  67.   PPP. term's advantage    is that    it can be run entirely from user space,
  68.   requiring no support from system or network administrators.
  69.  
  70.   Unlike SLIP or PPP, your machine does    not have its own IP address. All
  71.   incoming traffic must    be addressed to    your remote host, and it will be
  72.   redirected to    your local computer by term.
  73.  
  74.  
  75.   3.  How term works
  76.  
  77.  
  78.   Before experimenting with term it is strongly    advised    to first read
  79.   this complete    chapter    and the    INSTALLATION file provided with    the
  80.   package. Also    take a look at the manual pages    linecheck, (term)test
  81.   and term. This will help you to work easier and faster.
  82.  
  83.  
  84.   3.1.    Nomenclature
  85.  
  86.  
  87.   I assume you are dialling a system through some sort of terminal
  88.   server. I use    the terms ``local'' and    ``remote'' to refer to the home
  89.   and network connected    systems    respectively (unless I use them    to mean
  90.   something else :-).
  91.  
  92.   term provides    the local machine, which has no    network    connection, but
  93.   is connected,    via a serial line, to a    remote machine which is    in turn
  94.   connected to a network with network services.    Let us look at how a
  95.   machine with a ``traditional'' network connection provides these
  96.   services. First the user invokes a program, like ftp or telnet, that
  97.   requests a network service. What these programs do is    make a system
  98.   call requesting network services. The    operating system then obtains
  99.   these    services via its network interface (e.g. it sends and receives
  100.   packets over the ethernet). SLIP and PPP do exactly this, by
  101.   converting your modem    line into a network interface, which is    in
  102.   principle no different from an ethernet. The downside    of this    is that
  103.   these    protocols make the modem-connected machine part    of the network,
  104.   just like any    other machine. This implies all    the administrative
  105.   burdens associated with being    a network node (more actually, since the
  106.   modem    link must also be administered).
  107.  
  108.   In the absence of a network connection like SLIP or PPP, what    does one
  109.   typically do?    Well, you dial your network connected machine, read your
  110.   mail,    your news etc; if you need a file, you first transfer it to the
  111.   remote machine and then download it to your local machine using kermit
  112.   or some other    communication program. This is a bit of    a pain,
  113.   especially since you can only    really do one thing at a time that uses
  114.   your modem link.  The    idea behind term is basically to automate and
  115.   multiplex this process. term is invoked on both the local and    remote
  116.   machines, and    the two    processes communicate with one another over the
  117.   modem    line. When you need a network service, you make    a request to the
  118.   local    term daemon, which forwards the    request    to the term daemon on
  119.   the remote, network-connected, machine. The result is    then returned
  120.   over the modem line.
  121.  
  122.   To be    more concrete, say you want to retrieve    a file by ftp.    First
  123.   you need a version of    ftp that can speak to term. You    invoke this
  124.   termftp as you do a regular ftp, say termftp nethost.gov, but    this
  125.   special version makes    its network request to the local term daemon
  126.   instead of the kernel. The local term    forwards this request, over the
  127.   modem    line, to the remote term, which    opens an ftp connection    to
  128.   nethost.gov, and transmits the data back over    the modem link.    term is
  129.   smart    enough to have many different things going on at once; so you
  130.   can have several different network sessions using the    same modem link,
  131.   e.g. you can be logged into another distant host via termtelnet while
  132.   the termftp transfer is going    on.
  133.   If this is too abstract (or unclear) do not worry; the important piece
  134.   of information to get    out of this section is that there are two copies
  135.   of term running, one on each end of the modem    link.
  136.  
  137.  
  138.   4.  Setting Things Up
  139.  
  140.  
  141.  
  142.   4.1.    What has to be available
  143.  
  144.  
  145.   Before you start building and    using term you have to make sure that
  146.   you have built TCP/IP    support    into the kernel. Furthermore, make sure
  147.   that the TCP/IP loopback interface is    activated. When    this is    the case
  148.   you can go on    with the rest of this section.
  149.  
  150.  
  151.   4.2.    Explanation of concepts
  152.  
  153.  
  154.   In newer term    version    two new    concepts have entered term. These two
  155.   concepts will    be explained in    the next two subsections.
  156.  
  157.  
  158.   4.2.1.  Sharing
  159.  
  160.  
  161.   Starting with    version    1.16 the concept of sharing the    term connection
  162.   with other users has entered term. This means    that when you enable
  163.   shared features, other people    can use    the same term connection you are
  164.   using, i.e. when you are working on your remote machine via your term
  165.   connection (say, from    your local machine you used trsh to get    in)
  166.   another person on your local machine can use the same    term connection
  167.   at the same time to ftp a file to his    login on your local machine from
  168.   an ftp site somewhere    in the world.
  169.  
  170.   When you disable shared features (i.e. you execute term in private
  171.   mode)    you and    only you (we do    not count root :-) can use the term
  172.   connection.
  173.  
  174.   Of course, you only need to install shared term at the end at    which
  175.   you want to allow people to use the same term    connection you are
  176.   using. So, if    other people have a login on your local    machine    and they
  177.   want to use it from somewhere    on your    remote network you enable shared
  178.   features on the remote end of    your term connection. In this way all
  179.   these    people can login on your machine at the    same time sharing the
  180.   same term connection with each other and with    you. (NOTE: the    first
  181.   example needed shared    features to be enabled at the local end    of the
  182.   term connection).
  183.  
  184.   NOTE for installation    as root: When you install term as root you have
  185.   to create a term group first (before compilation) with no member by
  186.   adding the following line in /etc/group:
  187.  
  188.  
  189.   term::16:root
  190.  
  191.  
  192.  
  193.   or any other unused GID than 16 when 16 is already in    use.
  194.  
  195.   After    compilation and    installation make term and its clients SGID
  196.   term:
  197.  
  198.  
  199.   chgrp    term <term_client>
  200.   chmod    g+s <term_client>
  201.  
  202.  
  203.  
  204.   Also any other program that you make term-aware must be made SGID
  205.   term.
  206.  
  207.  
  208.   4.2.2.  Full term networking
  209.  
  210.  
  211.   Starting with    term version 2.0.0 the statement full term networking is
  212.   used.    When your only connection with the outside world is a term
  213.   connection, you have a full term network and you should build    term
  214.   with full term networking. In    this case in the shared    directory a file
  215.   called termnet is placed. This tells term that your only connection to
  216.   the outside world is via term.
  217.  
  218.   When you also    have some other    type of    network    connection beside your
  219.   term connection term-aware programs first try    to fulfil their    job
  220.   using    this network connection. When this fails term is invoked and it
  221.   is tried to fulfil the job via the term connection. To make this more
  222.   clear    now an example is given    in which term-aware telnet is used. This
  223.   telnet should    work both with and without term.
  224.  
  225.  
  226.   telnet localhost
  227.  
  228.  
  229.  
  230.   does not use term to connect,    but
  231.  
  232.  
  233.   telnet zeus.cs.kun.nl
  234.  
  235.  
  236.  
  237.   will use term    only if    you do not have    some other type    of network
  238.   connection.
  239.  
  240.   full term networking also means to lie about the host    name, and say it
  241.   is the remote    host instead.  Furthermore, it causes bind(0) to always
  242.   act on the remote host.  In essence it makes many programs unusable
  243.   when they are    not going through term,    while term is running.
  244.   Unfortunately, most UDP programs and daemons will not    work with term
  245.   without these    nasty tricks.
  246.  
  247.  
  248.   4.3.    Build term
  249.  
  250.  
  251.   When you are lucky, this should just involve a make. Most probably
  252.   however, you need to do more.    Due to new features in newer versions of
  253.   term it is now a bit more complicated    to create your term binary. A
  254.   couple of ways can be    followed to obtain your    binary.
  255.  
  256.   To cover all these ways term can be built this section will be split
  257.   into three parts:
  258.  
  259.  
  260.   1. Build term    up to version 1.15
  261.  
  262.   2. Build term, versions 1.16 up to 1.19
  263.  
  264.  
  265.   3. Build term, versions 2.0.0    and higher
  266.  
  267.  
  268.   4.3.1.  Build    term up    to version 1.15
  269.  
  270.  
  271.   For these versions of    term building should invoke no more than the
  272.   commands
  273.  
  274.  
  275.   make DO=install OS-type
  276.   make installman
  277.  
  278.  
  279.  
  280.   You will find    term, its clients and the manual pages nicely built and
  281.   installed and    ready for use after this.
  282.  
  283.   Furthermore, you need    to create a directory $HOME/term. This directory
  284.   term will use    to look    for its    termrc file.
  285.  
  286.   The only thing you may want to do is change some of the paths    in the
  287.   Makefile or change some of the compiler flags.
  288.  
  289.  
  290.   4.3.2.  Build    term, versions 1.16 up to 1.19
  291.  
  292.  
  293.   To build these versions of term you can now choose one of the
  294.   following ways:
  295.  
  296.  
  297.   1. As    an ordinary user, build    term in    private    mode
  298.  
  299.   2. As    an ordinary user, build    term in    shared mode
  300.  
  301.   3. As    root, build term in private mode
  302.  
  303.   4. As    root, build term in shared mode
  304.  
  305.   Below, it will be explained how to enable/disable shared features
  306.   during the compilation of term.
  307.  
  308.  
  309.   1. You are an    ordinary user (no root access) and you do NOT want to
  310.      SHARE the term connection with other users.
  311.  
  312.      As    a user who does    not want to share the term connection with other
  313.      users you should do the following to build    term:
  314.  
  315.  
  316.      make DO=install OS-type
  317.      make installman
  318.  
  319.  
  320.  
  321.   After    this term, its clients and the manual pages are    built and
  322.   installed.
  323.  
  324.   Furthermore, you need    to create a directory $HOME/.term. This    is the
  325.   directory in which term will look for    its termrc file.
  326.  
  327.   2. You are an    ordinary user (no root access) and you want to SHARE the
  328.      term connection with other    users.
  329.  
  330.      As    a user who wants to share the term connection you should do the
  331.      following:
  332.  
  333.  
  334.      make DO=installshare USERSHARE=$HOME/term OS-type
  335.      make installman
  336.  
  337.  
  338.  
  339.   After    this term, its clients and the manual pages are    built and
  340.   installed.
  341.  
  342.   Furthermore, you will    have a directory $HOME/term (default) with per-
  343.   missions drwxrwxr-x. In this directory you will find at least    the
  344.   socket used by term for its connection (tmp/private/socket=).
  345.  
  346.   3. You are root and you do NOT want to SHARE the term    connection with
  347.      other users.
  348.  
  349.      As    root who does not want the term    connection to be shareable you
  350.      should do the following to    build term:
  351.  
  352.  
  353.      make DO=install OS-type
  354.      make installman
  355.  
  356.  
  357.  
  358.   After    this term, its clients and the manual pages are    built and
  359.   installed.
  360.  
  361.   Furthermore, you now have a directory    called /usr/local/lib/term
  362.   (default) with permissions drwxr-xr-x. In this directory you will at
  363.   least    find the socket    used by    term for its connection
  364.   (tmp/private/socket=).
  365.  
  366.   4. You are root and want to SHARE the    term connection.
  367.  
  368.      First, make sure you have read the    section    about 'sharing'    above.
  369.  
  370.      As    root who wants to share    the term connection you    should do the
  371.      following:
  372.  
  373.  
  374.      make DO=installshare OS-type
  375.      make installman
  376.  
  377.  
  378.  
  379.   After    this term, its clients and the manual pages are    built and
  380.   installed.
  381.  
  382.   Furthermore, you now have a directory    called /usr/local/lib/term
  383.   (default) owned by group term    and with permissions drwxrwxr-x. In this
  384.   directory you    will at    least find the socket used by term for its con-
  385.   nection (tmp/private/socket=).
  386.  
  387.  
  388.   4.3.3.  Build    term, versions 2.0.0 and higher
  389.  
  390.  
  391.   First, make sure you have read the section about 'full term
  392.   networking' above.
  393.  
  394.   For term versions 2.0.0 and higher there are many ways to build the
  395.   term binary and the clients. All of these can    be done    both by    root and
  396.   by ordinary user:
  397.   1. Build term    in private mode    without    full term networking
  398.  
  399.   2. Build term    in private mode    with full term networking
  400.  
  401.   3. Build term    in shared mode without full term networking
  402.  
  403.   4. Build term    in shared mode with full term networking
  404.  
  405.   In these versions of term a new way for compilation has entered term
  406.   using    the script configure. When configure is    run it checks on what
  407.   operating system you are trying to install term, whether the source
  408.   directory is available or not, and if    any runtime options are    set.
  409.   According to the things found    configure then creates a Makefile using
  410.   Makefile.in which is provided    in the term package.
  411.  
  412.   Two of the more important options to configure are --root and    --user
  413.   which    state whether term will    be installed by    root or    an ordinary
  414.   user.    Other options can be used to install term the way you want (non-
  415.   standard paths for example).
  416.  
  417.  
  418.   1. Build term    in private mode    without    full term networking.
  419.  
  420.      To    build term in this way you need    to execute the following
  421.      commands (both for    root and ordinary user):
  422.  
  423.  
  424.      make install installman
  425.  
  426.  
  427.  
  428.   This builds the binaries and installs    these binaries and the manual
  429.   pages.
  430.  
  431.   2. Build term    in private mode    with full term networking.
  432.  
  433.      To    build term in this way you need    to execute the following
  434.      commands (both for    root and ordinary user):
  435.  
  436.  
  437.      make installnet installman
  438.  
  439.  
  440.  
  441.   This builds the binaries and installs    these binaries and the manual
  442.   pages.
  443.  
  444.   3. Build term    in shared mode without full term networking.
  445.  
  446.      To    build term in this way you need    to execute the following
  447.      commands (both for    root and ordinary user):
  448.  
  449.  
  450.      make share    installman
  451.  
  452.  
  453.  
  454.   This builds the binaries and installs    these binaries and the manual
  455.   pages.
  456.  
  457.   4. Build term    in shared mode with full term networking.
  458.  
  459.      To    build term in this way you need    to execute the following
  460.      commands (both for    root and ordinary user):
  461.  
  462.  
  463.      make share    installnet installman
  464.  
  465.  
  466.  
  467.   This builds the binaries and installs    these binaries and the manual
  468.   pages.
  469.  
  470.  
  471.   4.4.    client.a, libtermnet.a,    libtermnet.sa, libtermnet.so
  472.  
  473.  
  474.   With term a library with functions for term clients is provided.
  475.  
  476.   Up to    version    1.16 this library was called client.a. During
  477.   compilation of term this library was built and then used during the
  478.   compilation of the term clients. It was not installed    in another
  479.   directory.
  480.  
  481.   Starting with    version    1.16 the name of the library is    changed    to
  482.   libtermnet.a.    Up to version 1.19 this    library    is created in the term
  483.   directory and    then used during compilation of    the term clients. It is
  484.   not installed    in another directory.
  485.  
  486.   Starting with    version    2.0.0, beside libtermnet.a also    libtermnet.so
  487.   and libtermnet.sa (shared library and    exported initialized library
  488.   data)    are created during compilation of the term package. During the
  489.   installation of all the parts    of the package also these three    library
  490.   files    are installed in the directory /usr/local/lib (default). Then a
  491.   link is made from libtermnet.so.2 to libtermnet.so.2.x.x. Finally,
  492.   ldconfig is run to create the    necessary links    and cache (for use by
  493.   the run-time linker, ld.so) to the most recent shared    libraries found
  494.   in the directories specified on the command line, in the file
  495.   /etc/ld.so.conf, and in the trusted directories (/usr/lib and    /lib).
  496.   If the installation is done correctly    the three library files    can now
  497.   be used by term clients which    are built with dynamic instead of static
  498.   libraries. Also, these libraries can now be used to port your    own
  499.   software to make it term aware (see below).
  500.  
  501.  
  502.   4.5.    Setting    environment variables
  503.  
  504.  
  505.   term knows a couple of environment variables which can be set    by
  506.   users. The first three of those that I will explain are
  507.  
  508.  
  509.   o  TERMDIR
  510.  
  511.   o  TERMSHARE
  512.  
  513.   o  TERMMODE
  514.  
  515.   By setting these variables you can control the way term is run.
  516.  
  517.   For term versions up to 1.15 only the    variable TERMDIR is important
  518.   (these versions do not know the shared mode).    For these versions
  519.   TERMDIR should be set    as follows:
  520.  
  521.  
  522.   setenv TERMDIR $HOME       (csh    or tcsh)
  523.   export TERMDIR=$HOME       (bash)
  524.  
  525.  
  526.  
  527.   Starting with    version    1.16 term also knows the variables TERMSHARE and
  528.   TERMMODE. With these variables term can be told to run in private mode
  529.   or in    shared mode. I will explain how    to set the variables for private
  530.   mode and shared mode.
  531.  
  532.  
  533.   1. Running term in private mode can be done setting the variables
  534.      TERMDIR and TERMMODE in the following way:
  535.  
  536.      For csh or    tcsh
  537.  
  538.      setenv TERMDIR $HOME
  539.      setenv TERMMODE 0
  540.  
  541.  
  542.  
  543.   For bash
  544.  
  545.   export TERMDIR=$HOME
  546.   export TERMMODE=0
  547.  
  548.  
  549.  
  550.   2. When you want to use term in shared mode there are    two ways of
  551.      setting the variables:
  552.  
  553.  
  554.      a.    When term is installed as a SUID program only TERMMODE has to be
  555.     set (??    README in the term package).
  556.  
  557.  
  558.     setenv TERMMODE    'number'    (csh or tcsh)
  559.     export TERMMODE='number'    (bash)
  560.  
  561.  
  562.  
  563.      For 'number' you have to enter 1 when you are using one of    the term
  564.      versions 1.16 upto    1.19 (README.share in the package) and 2 when
  565.      you are using term    version    2.0.0 or higher    (README.security in the
  566.      package).
  567.  
  568.      b.    When term is installed as a SGID program the variables have to
  569.     be set in the following    way:
  570.  
  571.     For csh    or tcsh
  572.  
  573.     setenv TERMMODE    1
  574.     setenv TERMDIR /usr/local/lib/term
  575.     setenv TERMSHARE $TERMDIR
  576.  
  577.  
  578.  
  579.      For bash
  580.  
  581.      export TERMMODE=1
  582.      export TERMDIR=/usr/local/lib/term
  583.      export TERMSHARE=$TERMDIR
  584.  
  585.  
  586.  
  587.      Setting the variables in this way makes it    possible to start old
  588.      clients (clients linked to    an older version of client.a) in shared
  589.      mode.
  590.  
  591.   Starting with    version    2.0.0 term also    knows the variable TERMSERVER.
  592.   You need to set this variable    when you have multiple modems and you
  593.   have more than one connection    at a time. To specify which connection
  594.   to use, you must start term with a server name:
  595.   nohup    term -v    /dev/modem1 Connection1    &
  596.   nohup    term -v    /dev/modem2 Connection2    &
  597.  
  598.  
  599.  
  600.   Users    should then set    the variable TERMSERVER    to the connection name
  601.   they want to use:
  602.  
  603.  
  604.   setenv TERMSERVER Connection1      (csh or tcsh)
  605.   export TERMSERVER=Connection2      (bash)
  606.  
  607.  
  608.  
  609.  
  610.   4.6.    Test term
  611.  
  612.  
  613.  
  614.   Do a make test (or make termtest for newer versions of term) to build
  615.   term's test daemon. (term)test works by running two copies of    term on
  616.   your system, a ``local'' and a ``remote'' copy. Both of these    will
  617.   read your termrc; so you can adjust their behaviour.    Now execute
  618.   (term)test). You should now be able to do a trsh and a tupload (try
  619.    tupload ./term /usr/tmp - you should    get a copy of the term    binary
  620.   in /usr/tmp ). The local term's output should    show up    in local.log,
  621.   the remote's one in remote.log.  You can start term up with a    -d255
  622.   flag to enable debugging output to be    written    to these files,    or
  623.   enable debugging in your termrc.
  624.  
  625.   NOTE:    Run test as ./test  so as to avoid your    system's test.
  626.  
  627.  
  628.   4.7.    Make a Transparent Link
  629.  
  630.  
  631.   Presumably, you can establish    a modem    connection between your    local
  632.   and remote hosts. Typically, you are dialling    into some kind of
  633.   terminal server and connecting to your remote    host from there. You are
  634.   also using some kind of terminal software, such as kermit or seyon to
  635.   talk to your modem (the examples in this document will use kermit,
  636.   since    that is    what its author    uses). If you are having trouble with
  637.   your modem, or your terminal software, take a    look at    the Serial-
  638.   HOWTO; that should help you out.
  639.  
  640.   Having established your link,    you want to make it as transparent as
  641.   possible.  Check the commands    on the terminal    server (help or    ? will
  642.   usually get you started). Go for the 8 bit options whenever possible.
  643.   This may mean    changing the way you log in to a system, e.g. if the
  644.   server uses rlogin, you may have to use it and give it the -8    flag to
  645.   make it transparent.    Especially watch out for xon/xoff flow control.
  646.   You do not want that.    Try to enable rts/cts (hardware) flow control.
  647.   You may need to check    your modem docs    to learn how to    configure it to
  648.   do 8-bit rts/cts communications.
  649.  
  650.  
  651.   4.8.    Run linecheck
  652.  
  653.  
  654.   WARNING: In some of the documents the    command    line options for
  655.   linecheck are    mentioned in an    incorrect order. I have    checked    this and
  656.   found    the order of options mentioned below to    be the correct ones.
  657.  
  658.   NOTE:    starting with term version 2.3.0 linecheck no longer needs to
  659.   have the name    of a log-file on its commandline. It will write    its
  660.   output to the    file linecheck.log in the directory you    start linecheck
  661.   in.
  662.  
  663.   linecheck is a program that is supplied with term.  It checks    the
  664.   transparency of a link, providing configuration information that term
  665.   needs    to run correctly.  linecheck will send each of the 256 possible
  666.   eight    bit characters over the    link and verify    that each was
  667.   transmitted successfully. term needs to be configured    to deal    with
  668.   characters that cannot be transmitted    over the link, and linecheck
  669.   determines what characters these are.    You use    linecheck after    you have
  670.   established as transparent a modem link as possible. To run linecheck,
  671.   do the following
  672.  
  673.  
  674.   1. On    the remote system, run linecheck linecheck.log
  675.  
  676.   2. Escape back to your local system and suspend your comm program (^Z
  677.      under kermit) (otherwise it will steal characters from linecheck).
  678.  
  679.   3. On    the local system run linecheck linecheck.log > /dev/modem <
  680.      /dev/modem
  681.  
  682.   When linecheck is done, you will find    a set of numbers at the    bottom
  683.   of the linecheck.log files. These should be escaped in the termrc at
  684.   the other end    of the link. For example, in my    system my local
  685.   linecheck.log    said nothing and my remote linecheck.log said to escape
  686.   29 and 157.  Therefore, my local termrc escapes these    characters and
  687.   my remote termrc escapes nothing. If I escape    a character at one end,
  688.   I have to also ignore    it at the other; so, in    this example, I    shall
  689.   have to ignore 29 and    157 in my remote system.
  690.  
  691.   If linecheck hangs, try using
  692.  
  693.  
  694.   linecheck linecheck.log 17 19
  695.  
  696.  
  697.  
  698.   on the remote    system and
  699.  
  700.  
  701.   linecheck linecheck.log 17 19    > /dev/modem < /dev/modem
  702.  
  703.  
  704.  
  705.   on the local system. This will escape    your xon/xoff (flow control)
  706.   characters, which will hang your line    if you have got    software flow
  707.   control. If this solves the hanging problems,    you will want to escape
  708.   /ignore 17/19    in both    termrc's. If your terminal server has other
  709.   characters that will shut it down, try running linecheck with    those
  710.   characters escaped, as above.    You can    spot these characters if
  711.   linecheck hangs. If this is the case,    kill it, then look in the
  712.   logfiles. The    last characters    transmitted are    likely to be the
  713.   culprits. Try    it again with these characters escaped.
  714.  
  715.   In summary, my local termrc has the lines
  716.  
  717.  
  718.   escape 29
  719.   escape 157
  720.  
  721.  
  722.   and my remote    termrc has the lines
  723.  
  724.  
  725.  
  726.  
  727.   ignore 29
  728.   ignore 157
  729.  
  730.  
  731.   since    my remote linecheck.log    said to    escape 29 and 157.
  732.  
  733.  
  734.   4.9.    Try Running term
  735.  
  736.  
  737.   Log into the remote system, making the link as transparent as    possible
  738.   (if you have not already done    so).  Fire up term at the remote end.  I
  739.   use the following:
  740.  
  741.   exec term -r -l $HOME/tlog -s    38400 -c off -w    10 -t 150.
  742.  
  743.   Let us run down each option one by one (note that I could just as
  744.   easily have put these    options    in my termrc. I    did it this way    because
  745.   it saves editing a file while    getting    term set up).
  746.  
  747.   exec means to    destroy    your current shell, running the    given program in
  748.   its place.  I    exec things because I do not intend to use my login
  749.   shell    again; so it is    just wasting memory. If    you are    debugging the
  750.   link and can reliably    kill the remote    term, you might    not want to do
  751.   an exec.
  752.  
  753.   The -r option    is needed at exactly one end. term will    then see this
  754.   end as the remote end    of the connection (Note    that term's remote end
  755.   can thus be your local machine). If you do not use this option at one
  756.   end term clients will    spontaneously crash.
  757.  
  758.   -l $HOME/tlog. This logs errors to the file tlog in my home directory.
  759.   Very useful for debugging. No    reason not to do this.
  760.  
  761.   -s 38400 : I have got    a 14400    baud modem, with compression.  For
  762.   optimal compression ratios, I    want to    be able    to push    bits down the
  763.   pipe as fast as possible. For    a slower modem,    you should use something
  764.   lower.  Note that if you have    a slower machine with 16450 uart on your
  765.   serial port, high baudrates can cause    data loss by overloading the
  766.   chip on your serial port. term will recover from this, but if    you see
  767.   a lot    of error messages in your log file, (or    get overrun warnings
  768.   from linux kernel versions 0.99pl15 and up) you again    might want to
  769.   lower    this number.
  770.  
  771.   -c off : This    turns data compression off. I have got a compressing
  772.   modem, and I do not want to compress things twice.
  773.  
  774.   -w 10    -t 150 : Again,    these are options to optimize my fast modem
  775.   link.     I have    set my window to 10 and    my timeout to 150. This    is
  776.   according to the recommendation in the term_setup man    page.
  777.  
  778.   Escape back to your local machine and    suspend    your comm program (^Z
  779.   under    kermit). You do    not want it running while term is running,
  780.   because it will fight    with term over the serial port.    If you can
  781.   convince your    modem to not hang up when you exit your    comm program
  782.   (when    it toggles DTR), you could just    exit the program at this point.
  783.  
  784.   Now run term locally.    I use:
  785.  
  786.   term -c off -l $HOME/tlog -s 38400 -w    10 -t 150 < /dev/modem >
  787.   /dev/modem &
  788.  
  789.   I need to tell term where the    modem is; so I point both standard input
  790.   and output at    /dev/modem (that is what the < and > do). I also run it
  791.   in the background; so    I can use this screen for something else if I
  792.   want to.
  793.   term should work now :-). Try    a trsh,    and see    what happens. If you
  794.   hang,    or your    link seems slow, take a    look at    your tlog at each end.
  795.   Are you getting timeouts or error messages? If so, then you have
  796.   configured something incorrectly. Try    again (after you have finished
  797.   reading this :-). Note that the connection will not seem blazingly
  798.   fast,    especially if you are using compression    - it will be a little
  799.   jumpy. The real speed    comes in during    file transfer and the like.
  800.  
  801.  
  802.   4.10.     Terminate your    term connection
  803.  
  804.  
  805.   Most certainly, after    you have done a    lot of work using term,    you want
  806.   to finish your work and bring    your term connection down. For this to
  807.   be realized there are    four ways:
  808.  
  809.  
  810.   1. Kill the term programs at both sides of the connection. This is the
  811.      least recommended way of terminating your connection.
  812.  
  813.   2. A better way is to    execute    the following command locally:
  814.  
  815.  
  816.      echo '00000' > /dev/modem
  817.  
  818.  
  819.  
  820.   This will nicely terminate your term connection. It will work    for all
  821.   version of term. Make    sure that the sequence of zeros    contains at
  822.   least    five zeros.
  823.  
  824.   3. In    the termrc of term versions 2.0.0 and higher you can now enter a
  825.      statement called terminate    '<some string>'. This sets a string that
  826.      will cause    term to    exit ('00000' by default). It must be at least 5
  827.      characters    long, to avoid accidently terminations.
  828.  
  829.   4. Starting with version 1.14    there is the program tshutdown (actually
  830.      for version 1.14 it is available as a patch, for newer versions it
  831.      is    in the package). Executing tshutdown nicely terminates your term
  832.      connection.
  833.  
  834.  
  835.   4.11.     Optimizing your connection
  836.  
  837.  
  838.   Once you have    got term running, you might want to try    to get things
  839.   optimized. A good way    to measure the speed of    your link is to    run tmon
  840.   in one window    while up/downloading a file in another.    Try both (big)
  841.   text files and compressed files; the plain text should go a factor of
  842.   two-ish faster than the compressed files.  The parameters you    want to
  843.   fiddle with are baudrate (-s), compression (-c), windows (-w), timeout
  844.   (-t) and retrain (-A).
  845.  
  846.   Watch    out with the retrain parameter.    With term version 1.19 I got a
  847.   performance decrease of 80% to 90% compared to running term without
  848.   the retrain parameter. It is not clear if this is a bug in term
  849.   version 1.19 and if this problem exists only with term version 1.19.
  850.  
  851.   Baudrate: the    maximum    number of bits per second term will try    to send
  852.   over the serial link.    term will avoid    sending    characters at a    higher
  853.   datarate than    this. The default is to    use the    speed of your computer's
  854.   serial port, but be warned that this may be too high if your modem
  855.   runs at a lower rate over the    phone line. The    baudrate option    is
  856.   intended for systems that buffer output to the modem.    During setup and
  857.   tuning it is better to use a small baudrate rather than one which is
  858.   too large. For high speed links (> 38400), making it unlimited is
  859.   probably advantageous. This is achieved by using the value 'off'. term
  860.   will then rely solely    on your    kernel to do flow control.
  861.  
  862.   Compression: you want    this on    if you do not have a compressing modem.
  863.   If you do have such a    modem, turn compression    off, otherwise you will
  864.   be compressing things    twice, which typically increases the amount of
  865.   data transmitted. Compressing    modems are those that use the MNP-5 or
  866.   V42.bis protocols. Check your    modem documentation and    the message when
  867.   your modem connects.
  868.  
  869.   Windows: this    is the number of chunks    of data, or packets, that term
  870.   will let go over the line before it gets an acknowledgment (or ack)
  871.   from the remote term.    For fast modems, increasing this can be    a win;
  872.   for slower links this    can overwhelm the remote end.
  873.  
  874.   Timeout: the time term will wait for an ack. If you have increased
  875.   windows, and you are getting timeouts    in your    logfile, try increasing
  876.   this.
  877.  
  878.   For 14400/V42.bis, I use -c off -w 10    -t 150.    I get around 1700 cps on
  879.   compressed files and 3500 cps    on ascii files using tupload.
  880.  
  881.  
  882.   4.12.     Troubleshooting
  883.  
  884.  
  885.   In this section some thoughts    are given about    what to    check when you
  886.   have problems    executing term or one of its clients.
  887.  
  888.  
  889.   o  Did you clean up the term directory structure? With newer versions
  890.      of    term the structure of the directory tree under
  891.      /usr/local/lib/term has changed a couple of times.    If you are not
  892.      aware of this, it can cause all kinds of error messages. The best
  893.      thing to do is to delete the directory tree under
  894.      /usr/local/lib/term (save your termrc) and    then install your new
  895.      term version. This    way, you avoid the struggle with a messed up
  896.      directory tree.
  897.  
  898.   o  Did you remove old    sockets? When you update your term version
  899.      remove all    the sockets (called socket=) created by    term. No doing
  900.      this can cause strange problems. To find out what socket term is
  901.      listening to you can use the "netstat" program.
  902.  
  903.   o  term does not compile correct on sunOS 4.1.3? You have configured
  904.      term with './configure --user'. During compilation    you are    getting
  905.      a assembler error on a unknown '-k' flag. The reason of this error
  906.      is    unknown. The solution to this error is to configure term with
  907.      static libraries. So, you have to do './configure --user --static'
  908.      and then continue with the    compilation process the    way you    normally
  909.      do. Now term should compile correct.
  910.  
  911.   o  Are you running the right binary? term has    been updated quite a
  912.      lot, and many systems have    different versions of the programs
  913.      floating around. Make sure    you are    using the right    version. Note
  914.      that this applies to linecheck too. You can use bash's type -a or
  915.      the whereis command to find which program is being    run.  term
  916.      versions after 1.11 should    print out their    version    number when they
  917.      start up.    (Although version 1.14 claims to be 1.12.  Sigh.)
  918.  
  919.   o  Do    you have the right termrc in the right place? Depending    on the
  920.      version of    term you are running and the way you installed term
  921.      (being root or user) this file has    to be in one of    the following
  922.      directories:
  923.  
  924.  
  925.      $HOME/.term/termrc
  926.      $HOME/.term/termrc.<server>
  927.      $HOME/term/termrc
  928.      $HOME/term/termrc.<server>
  929.      /usr/local/lib/term/termrc
  930.      /usr/local/lib/term/termrc.<server>
  931.      /etc/termrc
  932.      /etc/termrc.<server>
  933.  
  934.  
  935.  
  936.   Some systems have pre-installed termrc's; make sure they are gone
  937.   before you set things    up. If you are running things as root, lookout
  938.   for /.term. term creates files (sockets actually) while it is    running;
  939.   so it    has its    own directory, ~/.term,    where the file termrc goes
  940.   (note, there is no leading dot in termrc!).
  941.  
  942.   o  Does term find its    termrc file? when you start up term at both
  943.      sides, you    should see messages like the one below:
  944.  
  945.  
  946.      Term version: 2.2.9
  947.      Reading file:  /usr/local/lib/term/termrc
  948.      Using shared mode.
  949.  
  950.  
  951.  
  952.   When the second line is missing term cannot find its termrc file and
  953.   you know that    something is gone wrong    during the installation    (unless
  954.   you are not using a termrc file and enter all    the options to the com-
  955.   mandline :-).    Check the place    and the    permissions of the termrc file
  956.   on the site term cannot find its termrc file.
  957.  
  958.   o  Is    you term or .term directory mounted with NFS? If your term or
  959.      .term directory is    mounted    with NFS you need to set the flag
  960.      -DTERM_NFS_DIR in the CFLAGS line of the Makefile.    Alas, for the
  961.      author this flag causes a compile error when term 1.19 is compiled
  962.      on    a machine running sunOS    4.*.
  963.  
  964.   o  Are all files and directories owned by the    correct    user and group
  965.      and do they have the correct permissions? This should be no
  966.      problems as these permissions are set during the installation
  967.      phase. However, when you port your    own programs to    term you must be
  968.      aware of this. Also when you change the mode term is working in
  969.      (i.e. from    private    mode to    shared mode) file and directory
  970.      ownerships    and permissions    have to    be adapted.
  971.  
  972.   o  You are getting the error gethostbyname: <hostname>: Non-
  973.      authoritative `host not found', or, server    failed
  974.  
  975.      To    solve this you have to check the following things:
  976.  
  977.  
  978.      1.    Is the file /etc/hosts configured correctly? <hostname>    is not
  979.     the name of your host (old SLS releases    and some old and new
  980.     Slackware releases are shipped with hostname 'darkstar'    for
  981.     example). Change this in this file. It must at least contain a
  982.     line like below    (the format is described above it):
  983.  
  984.  
  985.     # Local    Hosts Format:
  986.     #  IP_NUMBER        HOSTNAME    ALIASES
  987.     #
  988.     # Here is the name of your host, first,    followed by any    aliases
  989.     127.0.0.1    localhost    linuxpc.domain    linuxpc
  990.  
  991.      2.    Are your /etc/rc* and /etc/resolv.conf files world readable
  992.     (chmod ugo+r)?
  993.  
  994.      3.    Last, make sure    that you have installed    the TCP/IP loopback-
  995.     interface on your machine.
  996.  
  997.   o  Are you getting all kinds of 'timed out' messages in your term log
  998.      files?  This means    that your term connection is not optimized. A
  999.      small number of these messages every now and then is not a    problem.
  1000.      These are most certainly due to temporal factors influencing the
  1001.      physical connection between your local and    remote hosts.
  1002.  
  1003.      When you get a lot    of these messages all the time your connection
  1004.      will slow down considerably. You have to fiddle with the parameters
  1005.      mentioned in the section 'Optimizing your connection' above. Alas,
  1006.      this part of the installation is a    process    of trial and error. No
  1007.      hard rules    can be given about the numbers to be presented to the
  1008.      various parameters    as many    factors    have an    influence on the
  1009.      connection. These factors differ between the connections and even
  1010.      in    time.
  1011.  
  1012.   o  Normal FTP    with redirected    ports does not work for    you? Alas, it is
  1013.      a known problem that redirection of the ports needed by FTP (20 and
  1014.      21) does not give you a working FTP. The only solution is to get a
  1015.      term-aware    ftp or ncftp version. Alas, also some term-aware ftp
  1016.      versions seem not to work.
  1017.  
  1018.  
  1019.   5.  term clients
  1020.  
  1021.  
  1022.   term provides    several    default    clients. They include trsh, tmon,
  1023.   tupload, tredir, txconn and in newer versions    trdate,    trdated.
  1024.   Furthermore, starting    with version 2.0.0 tudpredir is    available and
  1025.   from version 2.1.0 tdownload is available. This section will deal with
  1026.   trsh,    tmon, tupload, tdownload, trdate and trdated.  The others each
  1027.   have their own section.  No term client will work until you have
  1028.   established a    term link.
  1029.  
  1030.   tmon is a simple utility to monitor the statistics of    your link.  It
  1031.   prints a time    histogram of characters    transmitted and    received. It is
  1032.   invoked simply as tmon. Since    around version 1.11, tmon has had a bug
  1033.   that causes some information to be garbled (??).
  1034.  
  1035.   trsh is similar to rsh. Without arguments, it    spawns an interactive
  1036.   shell    on the remote system (i.e. it logs you in).  trsh is one of the
  1037.   primary means    of accessing the remote    end of the link    via term. If
  1038.   given    an argument, trsh executes that    argument as a command on the
  1039.   remote system. For example trsh ls would give    you a listing of the
  1040.   files    in your    home directory on the remote system.
  1041.  
  1042.   tupload will transfer    a file,    given as its first argument, from local
  1043.   to remote. By    default, the files will    be put in the same directory
  1044.   that you invoked term    from at    the other side.    To put files in    another
  1045.   directory, give their    names as a second argument to tupload. For
  1046.   example, if I    want to    put a copy of the file term114.tar.gz in
  1047.   /usr/tmp on the remote system, I would type tupload term114.tar.gz
  1048.   /usr/tmp.
  1049.  
  1050.   When you use tupload you can use wildcards like in 'tupload a.*'. The
  1051.   shell    expands    the wildcard and tupload is called as 'tupload a.1 a.2
  1052.   ......'.
  1053.  
  1054.   tdownload will transfer a file, given    as its first argument, from
  1055.   remote to local. By default, the files will be put in    the same
  1056.   directory that you invoked term from at the local side. To put files
  1057.   in another directory,    give their names as a second argument to
  1058.   tdownload. For example, if I want to put a copy of the file
  1059.   term114.tar.gz in /usr/tmp on    the local system, I would type tdownload
  1060.   term114.tar.gz /usr/tmp.
  1061.  
  1062.   When you use tdownload you cannot use    wildcards like in 'tdownload
  1063.   a.*'.    Reason for this    is that    the remote directory is    not available to
  1064.   your local shell when    you use    tdownload; so your local shell cannot
  1065.   expand the wildcards.
  1066.  
  1067.   trdate is a time setting utility. It reads the time on the remote
  1068.   machine and sets the local clock to the remote time. It must be run as
  1069.   root.
  1070.  
  1071.   trdated is the daemon    version    of trdate. When    it is started in
  1072.   rc.local it is run as    daemon in which    case it    updates    the time every 5
  1073.   minutes (default). Even when there is    no term    connection, this daemon
  1074.   will start up    when set in the    rc.local. Once a term connection is
  1075.   created it starts updating the time.
  1076.  
  1077.  
  1078.   6.  X    and term
  1079.  
  1080.  
  1081.   term allows users to open up X windows on the    local machine from
  1082.   clients that are running on a    machine    on the network.    This is    done by
  1083.   using    the txconn client. txconn is executed on the remote, network-
  1084.   connected machine; it    is invoked simply as txconn. It    goes into the
  1085.   background and returns a number on the standard output; this number is
  1086.   the display number that clients should use to    access the X server on
  1087.   the local machine. An    example    should make this clear.     I am logged in,
  1088.   via trsh, to my remote term host, named foo. On foo, I do the
  1089.   following
  1090.  
  1091.  
  1092.  
  1093.   foo$ txconn
  1094.   Xconn    bound to screen    10
  1095.   :10
  1096.   foo$
  1097.  
  1098.  
  1099.  
  1100.   Now, on any host that    I wish to run an X client on, that is to display
  1101.   on my    local machine's    X server, I do
  1102.  
  1103.  
  1104.   setenv DISPLAY foo:10
  1105.  
  1106.  
  1107.  
  1108.   (for bash you    should use export DISPLAY=foo:10). In some cases it can
  1109.   furthermore be necessary to do a xhost + foo on your local machine.
  1110.   Now when I start the client, it will try to connect to screen    10 on
  1111.   machine foo, but txconn is listening to this screen, and will    forward
  1112.   all X    protocol packets via term to the X server on the local host -
  1113.   i.e. the window will open up on your local machine.
  1114.  
  1115.   It is    possible to go the other way - run a client on your local
  1116.   machine and have it open up a    window on a remote machine on the
  1117.   network; however we will defer explaining this until after we    have
  1118.   discussed tredir.
  1119.  
  1120.   txconn is not    terribly secure; anyone    can connect to your local server
  1121.   via term and perform all sorts of mischief. If you are worried about
  1122.   this sort of thing, it might be a good idea to consider using    xauth to
  1123.   authorize your connections. Consult the xauth    man page.
  1124.  
  1125.   The X    protocol is not    very efficient;    it wastes some bandwidth. This
  1126.   is usually not a problem over    an ethernet, but can be    murder over a
  1127.   modem. X11R6 is supposed to introduce    a low bandwidth    version    of the X
  1128.   protocol, LBX. If however you    are using X11R5    you can    use a utility
  1129.   named    sxpc which compresses the X protocol, improving    response over
  1130.   serial lines.    sxpc includes a    write-up on how    to get it working with
  1131.   term,    and is recommended. The    sxpc package also explains how to use
  1132.   xauth; so it is doubly recommended.
  1133.  
  1134.  
  1135.   7.  tredir
  1136.  
  1137.  
  1138.   tredir is one    of term's most powerful    utilities, allowing most
  1139.   important network services to    be performed over a term link. Before we
  1140.   explain how to use tredir, it    is necessary to    give some background on
  1141.   network services. We have talked about network services before, but we
  1142.   have not said    exactly    what they are. Services    are just that -    services
  1143.   that are provided by the network. Examples of    services include telnet,
  1144.   which    provides logins    between    machines, the File Transfer Protocol,
  1145.   ftp, which transfers files between machines, and smtp, the Simple Mail
  1146.   Transfer Protocol, which is used whenever you    send electronic    mail.
  1147.   Each network service has a port number associated with it.  The
  1148.   mapping of port numbers to services is given in the file
  1149.   /etc/services. This file should be the same on all internet-connected
  1150.   machines.
  1151.  
  1152.   How are these    services invoked? Each networked machine runs a    daemon
  1153.   called inetd,    which listens for attempts to connect to the network
  1154.   ports. These requests    can come from either the network or the    local
  1155.   machine. A network service is    obtained by connecting to a particular
  1156.   inetd    port.  When a network request is made, inetd knows exactly which
  1157.   service is involved by the port number the request is    made on. If
  1158.   inetd    is configured to do so,    it provides the    relevant service to the
  1159.   requesting connection. inetd's configuration is given    by the file
  1160.   /etc/inetd.conf, which has a list of the services that inetd provides.
  1161.   For more information,    see the    man pages for inetd and    inetd.conf.
  1162.  
  1163.   You can communicate directly with network services by    using telnet
  1164.   (n.b.    not termtelnet). For example, to talk to the sendmail, (or smtp)
  1165.   daemon on machine machine_name, you can do a telnet machine_name smtp,
  1166.   or telnet machine_name 25, (since 25 is the number assigned to smtp in
  1167.   /etc/services). You should get a polite greeting from    the daemon on
  1168.   the remote machine. This is a    very useful trick for debugging    network
  1169.   problems and checking    ports redirected with tredir (see below).
  1170.  
  1171.   tredir works very much like inetd. It    runs in    the background as a
  1172.   daemon, listening to the network ports, waiting for a    request. When a
  1173.   request for a    service    is made, instead of providing that service, as
  1174.   inetd    does, tredir forwards the request over the term    link to    the
  1175.   remote term, which makes the request over the    network, returning the
  1176.   result back over the link to the local client. tredir    can forward the
  1177.   request to any machine on the    network, but by    default    sends it to the
  1178.   machine at the other end of the term link.  tredir ``redirects'' TCP
  1179.   (Transmission    Control    Protocol) network services over    the term link.
  1180.  
  1181.   The common command format of tredir is:
  1182.  
  1183.  
  1184.   tredir [this_computer:]port [that_computer:]port
  1185.  
  1186.  
  1187.  
  1188.  
  1189.   An example should make this clear. Let us redirect a local port to the
  1190.   telnet port on the remote machine. To    do this    we would do tredir 2023
  1191.   23. Now, anyone who connects to port 2023 on the local machine will be
  1192.   redirected to    port 23    (telnet) on the    remote machine.     Here is an
  1193.   example session; the local machine is    mymachine.modem.home and the
  1194.   remote machine is netsun.
  1195.  
  1196.  
  1197.  
  1198.   $ tredir 2023    23
  1199.   Redirecting 2023 to 23
  1200.   $ telnet localhost 2023
  1201.   Trying 127.0.0.1...
  1202.   Connected to mymachine.modem.home
  1203.   Escape character is '^]'.
  1204.  
  1205.  
  1206.   SunOS    UNIX (netsun)
  1207.   login:
  1208.  
  1209.  
  1210.  
  1211.   This example is actually quite useful. If I were instead to do the
  1212.   tredir on netsun. I could then telnet    in to mymachine    from the network
  1213.   simply by connecting to the redirected port on the networked machine
  1214.   (using telnet) - i.e.    telnet netsun 2023.
  1215.  
  1216.   The general principle    in using tredir    is to redirect the desired
  1217.   service to a machine on the network. Our next    example    will allow us to
  1218.   read news on the local machine over our term link from a news    server
  1219.   on the network. News is provided by the nntp service,    port number 119.
  1220.   All decent news readers allow    you to specify what port number    they
  1221.   will use, either via a configuration file or an environment variable.
  1222.   Let us specify this local port to be 2119. Now, let us say that our
  1223.   news server is news.domain.org. We will redirect port    2119 to    port 119
  1224.   on news.domain.org; we will then tell    our news reading software that
  1225.   the nntp server is located at    port 2119 on the local host. Since this
  1226.   will depend on the news reader that you use, I will just test    the link
  1227.   with telnet instead of firing    up a news reader:
  1228.  
  1229.  
  1230.   $ tredir 2119    news.domain.org:119
  1231.   Redirecting 2119 to news.domain.org:119
  1232.   $ telnet localhost 2119
  1233.   Trying 127.0.0.1...
  1234.   Connected to mymachine.modem.home.
  1235.   Escape character is '^]'.
  1236.   200 news.domain.org InterNetNews NNRP    server INN 1.4 07-Dec-41 ready
  1237.   (posting ok).
  1238.  
  1239.  
  1240.  
  1241.   If you can get this far, all you have    to do is configure your    news
  1242.   reader to be able to read news via term. (n.b., if you read news like
  1243.   this,    be sure    that in    all your posts you set a Reply-To: header to an
  1244.   network email    address    that you can be    reached    at, otherwise people who
  1245.   want to get in touch with you    will be    sending    mail to    whatever (wrong)
  1246.   data your newsreader puts in the From: header).
  1247.  
  1248.  
  1249.   7.1.    tredir can bite!
  1250.  
  1251.  
  1252.   The astute reader, after reading the last example will be wondering
  1253.   why port 2119    was redirected to port 119 - since newsreaders default
  1254.   to port 119, why could I not do a tredir 119 news.domain.org:119 and
  1255.   skip the newsreader configuration? The answer    is that    all ports
  1256.   numbered less    than 1024 are ``reserved ports'', and only the superuser
  1257.   can listen to    them. If one is    willing    to take    a security risk    and make
  1258.   tredir an suid program, or run tredir    as root, then one can redirect
  1259.   reserved ports and avoid the hassle of renaming services.
  1260.  
  1261.   Another problem with using reserved ports is that inetd is often
  1262.   already listening to these ports, and    only one program at a time can
  1263.   listen to a port. In order to    use such a port, you must change
  1264.   inetd.conf so    that inetd no longer listens to    the port you want to
  1265.   redirect. This is most easily    done by    commenting out the line    with the
  1266.   offending service by putting a # character at    the beginning of the
  1267.   line.    The superuser must then    send inetd a HUP signal    (kill -1 inetd-
  1268.   pid) to get it to reread its configuration.
  1269.  
  1270.  
  1271.   7.2.    Stupid tredir tricks
  1272.  
  1273.  
  1274.   In this section we will describe some    of the more common uses    for
  1275.   tredir. We have already described how    to redirect nntp and telnet
  1276.   services; here we will give some more    complicated examples.
  1277.  
  1278.  
  1279.   7.2.1.  X windows
  1280.  
  1281.  
  1282.   In a previous    section, we described how to get an X client running on
  1283.   the network to open a    window on your home machine using txconn. The
  1284.   same technique could be used on your home machine to display a client
  1285.   on the machine at the    remote end of your term    link.  But how does one
  1286.   display an X client on a network machine that    is not the remote end?
  1287.   The answer lies in knowing that X uses a particular network service
  1288.   just like the    other programs we have been discussing.    An X server
  1289.   listens for a    network    request    on a port whose    number is given    by the
  1290.   formula  port    = 6000 + display number, e.g. an X server managing
  1291.   screen 0 on a    machine    would listen to    port 6000, if it were managing
  1292.   screen 2, it would listen to port 6002.  When    you set    your DISPLAY
  1293.   environment variable to xmachine:n, your X clients will try to connect
  1294.   to port 6000 +n on xmachine.
  1295.  
  1296.   We can use this to trick X clients on    your local machine to open up
  1297.   windows on remote displays. Let us say I want    to open    up an xterm,
  1298.   running on my    local machine, on display 0 of machine xmachine, which
  1299.   is running some place    on the network.     I first pick a    local display
  1300.   number, say 2    (do not    use 0, since that is what your local X server
  1301.   will be using). I will map this display to display 0 on xmachine. In
  1302.   terms    of ports, this means I want to redirect    the local port 6002 to
  1303.   the remote port 6000.     I do the following
  1304.  
  1305.  
  1306.  
  1307.   $ tredir 6002    xmachine:6000
  1308.   $ setenv DISPLAY localhost:2
  1309.   $ xterm
  1310.  
  1311.  
  1312.  
  1313.  
  1314.   This should open up an xterm on machine xmachine.  Note that I set the
  1315.   DISPLAY to localhost:2. This is because X clients will sometimes use
  1316.   unix domain sockets instead of internet domain sockets, at their own
  1317.   option, when connecting to a local display, if DISPLAY is set    to :2.
  1318.   localhost:2  says to use a tcp connection.
  1319.  
  1320.  
  1321.   Note that as far as xmachine is concerned, the X request is coming
  1322.   from the machine on the remote end of    your term link (remotemachine) -
  1323.   so if    you need to authorize the connection, you should either    do an
  1324.   xhost    + remotemachine    on xmachine or use xauth to update the
  1325.   .Xauthority file on your local machine for display number 2, using the
  1326.   key from xmachine.
  1327.  
  1328.   Again, to speed up X connections, you    can use    the program sxpc, which
  1329.   includes an explanation of how to use    tredir to establish the    link and
  1330.   authorize it using xauth.
  1331.  
  1332.  
  1333.   7.2.2.  Mail with term
  1334.  
  1335.  
  1336.   Well,    you asked for it. Electronic mail has the justifiable reputation
  1337.   of being one of the most difficult things to get working right on a
  1338.   UNIX system. To really get term working correctly with mail means that
  1339.   you have to understand how mail works, which is beyond the scope of
  1340.   this document. To learn more about mail, you should consult a    book on
  1341.   UNIX system administration and/or the    comp.mail.misc FAQ, available
  1342.   for anonymous    ftp on rtfm.mit.edu in pub/usenet/comp.mail.misc. There
  1343.   are also currently two packages available for    anonymous ftp on
  1344.   sunsite.unc.edu that will help you get mail running under term - they
  1345.   are term.mailerd+smail by Byron A. Jeff and the BCRMailHandlerXXX by
  1346.   Bill C. Riemers.
  1347.  
  1348.   That being said, we will give    a thumbnail description    of how mail
  1349.   works.  There    are two    parts to getting mail running, sending messages
  1350.   and receiving    messages. We will begin    with sending messages from your
  1351.   local    box to the network.
  1352.  
  1353.   There    are two    classes    of mail    programs. The first is the mail    user
  1354.   agent    (MUA). MUA's help you read, compose and    send messages. Examples
  1355.   of MUA's are elm, pine, Mail and vm.    MUA's do not really do any
  1356.   networking; they just    put the    messages together - the    real work of
  1357.   sending mail is done by the second class of mail programs, the mail
  1358.   transfer agents (MTA's). These are invoked by    the MUA's. They    take the
  1359.   message, decide where    to send    it by looking at the address, and then
  1360.   actually deliver it over the network.
  1361.  
  1362.   The two most common MTA's on Linux systems are sendmail and smail. The
  1363.   basic    idea is    to get your MTA    to connect to another MTA running on a
  1364.   machine on the net that will know what to do with your message. This
  1365.   is done by redirecting a local port to the smtp port on the net
  1366.   machine. You then have to tell you MTA to take any message it    does not
  1367.   know what to do with,    and send it out    over the redirected port on your
  1368.   local    machine    to the MTA on the remote machine, which    will then route
  1369.   your message to its correct destination.
  1370.  
  1371.   How do we do this using smail?  We first redirect a port to the smtp
  1372.   port on the network mail machine (mailhost):
  1373.  
  1374.   tredir XXXX mailhost:25
  1375.  
  1376.   here XXXX is the port    number that the    smail on the localhost will
  1377.   connect to (note that    I have to give this port a name    in my
  1378.   /etc/services    to get smail to    recognize it). smail has several
  1379.   configuration    files that usually live    in /usr/local/lib/smail. The
  1380.   ones we care about are config, routers and transports. Note that I am
  1381.   assuming you have already got    smail configured correctly for local
  1382.   mail - delivery to files and pipes and such things.  Again, consult
  1383.   the documentation if you have    not.
  1384.  
  1385.   In the file config, we put the following definition:
  1386.  
  1387.   smart_path=localhost
  1388.  
  1389.  
  1390.  
  1391.   localhost is the machine that    smail connects to when it does not know
  1392.   what to do with a message.
  1393.  
  1394.   In routers we    put
  1395.  
  1396.  
  1397.  
  1398.   smart_host:
  1399.   driver=smarthost,
  1400.   transport=termsmtp;
  1401.   path = localhost
  1402.  
  1403.  
  1404.  
  1405.   In transports    we put
  1406.  
  1407.  
  1408.  
  1409.   termsmtp:       driver=tcpsmtp,
  1410.       inet,
  1411.       return_path,
  1412.       remove_header="From",
  1413.       append_header="From: YOUR_NET_ADDRESS",
  1414.       -received,
  1415.       -max_addrs, -max_chars;
  1416.       service=YOUR_SMTP_SERVICE,
  1417.  
  1418.  
  1419.  
  1420.   In the above,    the header lines change    the From header    in all your
  1421.   outgoing mail    to the address,    YOUR_NET_ADDRESS, which    is the network
  1422.   address you want mail    sent to. If more than one user is going    to be
  1423.   using    your term link,    you will have to do something more fancy, like
  1424.   keep a database of local user's network addresses and    insert these in
  1425.   the From: headers.
  1426.  
  1427.   The service line is the name of the local port number    that you have
  1428.   redirected to    the smtp port on the network connected machine.    In my
  1429.   version of smail, I cannot just set this to a    number,    I have to set it
  1430.   to a name, like ``foo'', and then define ``foo'' in my /etc/services
  1431.   to be    the number of my redirected port. If you use a suid tredir and
  1432.   just redirect    the smtp port (25), you    do not need to define this.
  1433.  
  1434.   This should be enough    to get you going. If you decide    to use sendmail,
  1435.   the principles are the same but the details differ.  Ronald Florence
  1436.   (ron@mlfarm.com) told    me that    the stock Sun sendmail will not    send
  1437.   multiple queued messages over    a redirected port; BSD sendmail    8.6.9
  1438.   works    fine.  He made the following changes to    sendmail.cf to get it
  1439.   working with term. In    his case, the default sendmail port (25) is used
  1440.   for SMTP traffic over    a local    ethernet so Internet mail is forwarded
  1441.   to a redirected TCP port.
  1442.  
  1443.  
  1444.   #
  1445.   #Create the termsmtp mailer, which sends mail    via a re-directed TCP port
  1446.   #
  1447.   Mtermsmtp,P=[TCP], F=mDFMuCXe, S=22, R=22, A=TCP $h PORTNUMBER
  1448.  
  1449.  
  1450.  
  1451.   Here,    PORTNUMBER is the number of the    redirected port    on the local
  1452.   machine. This    should be an unused port over 2000. We next tell
  1453.   sendmail which machine to connect to,    and set    termsmtp as the    default
  1454.   mailer.
  1455.  
  1456.  
  1457.   #
  1458.   # major relay    mailer
  1459.   #
  1460.   DMtermsmtp
  1461.   #
  1462.   # major relay    host: use the $M mailer    to send    mail to    other domains
  1463.   #
  1464.   DR HOSTNAME
  1465.   CR HOSTNAME
  1466.  
  1467.  
  1468.  
  1469.   Here HOSTNAME    is the name of your local host (does localhost work?).
  1470.   The last entry goes under Rule 0 to forward Internet mail.
  1471.  
  1472.  
  1473.   # Pass other valid names up the ladder to our    forwarder
  1474.   R$*<@$*.$+>$*          $#$M      $@$R $:$1<@$2.$3>$4      user@any.domain
  1475.  
  1476.  
  1477.  
  1478.   When the term    connection is established to the Internet host,    run the
  1479.   following commands on    the local machine.
  1480.  
  1481.  
  1482.   tredir PORTNUMBER internet.host:25
  1483.   /usr/lib/sendmail -q
  1484.  
  1485.  
  1486.  
  1487.   We now turn to receiving electronic mail using term. We will assume
  1488.   that mail is sent to your account on the network machine mailhost. The
  1489.   simplest solution is to just use trsh    or termtelnet to log on    to
  1490.   mailhost and read your mail on there.     However, it is    also possible to
  1491.   have your mail automatically downloaded to your local    machine. One way
  1492.   to do    this is    to use the Post    Office Protocol, (POP).     POP was
  1493.   designed for exactly this purpose: to    deliver    mail to    machines that
  1494.   have intermittent network connections. To use    POP, you must have a POP
  1495.   server installed on mailhost.    Assuming that you do, you can then use a
  1496.   POP client to    download your mail every few minutes. This is done, as
  1497.   you might expect, using tredir. The POP service is 110 (note that
  1498.   there    is an older protocol, POP-2, which uses    port 109; in this
  1499.   document we describe POP-3, which is the latest version of POP). There
  1500.   are several POP clients available. One, written in the script    language
  1501.   perl is pop-perl-1.X,    written    by William Perry and maintained    by
  1502.   myself - it can be found on sunsite in /pub/Linux/system/Mail.
  1503.  
  1504.   To use POP, you redirect a local port    to port    110 on mailhost    and
  1505.   configure your client    to retrieve your mail from localhost using the
  1506.   local    port. As an example, we    will assume that there is a POP    server
  1507.   running on mailhost. We will redirect    the local port 2110, and fire up
  1508.   the pop-perl client:
  1509.  
  1510.  
  1511.  
  1512.  
  1513.  
  1514.  
  1515.  
  1516.  
  1517.  
  1518.  
  1519.   $ tredir 2110    mailhost:110
  1520.   Redirecting 2110 to mailhost:110
  1521.   $ pop
  1522.   Username: bill
  1523.   Password: <enter your    password for mailhost>
  1524.   Pop Host: name of local
  1525.   Pop Port: 2110
  1526.   Starting popmail daemon for bill
  1527.  
  1528.  
  1529.  
  1530.   If you do not    have a POP server available, the BCRMailHandler    package
  1531.   has a    program    to download your mail over a term link to your local
  1532.   machine. I have not used it, but anyone who has is welcome to    comment.
  1533.   You can also use the term.mailerd+smail package for this purpose.
  1534.   Alas,    both BCRMailHandler and    the term.mailerd.smail package do not
  1535.   work anymore with term versions 2.0.0    and higher.
  1536.  
  1537.  
  1538.   8.  tudpredir
  1539.  
  1540.  
  1541.   tudpredir is similar to tredir when you look at what these programs do
  1542.   and how they are executed. The big difference    between    the two    programs
  1543.   is that tredir is used to redirect TCP network services while
  1544.   tudpredir redirects UDP (User    Datagram Protocol) network services over
  1545.   the term link. One more important difference between the two programs
  1546.   is that tredir becomes a background daemon once it has successfully
  1547.   established the local    port, while tudpredir commands must be placed in
  1548.   the background manually.
  1549.  
  1550.   The common command format of tudpredir is:
  1551.  
  1552.  
  1553.   tudpredir [this_computer:]port [that_computer:]port
  1554.  
  1555.  
  1556.  
  1557.  
  1558.   9.  Automating Things
  1559.  
  1560.  
  1561.  
  1562.   Now that you know how    to get all your    network    services over term, it
  1563.   would    be nice    to set things up in such a way that your link is set up
  1564.   and configured automatically.    There are basically an infinite    number
  1565.   of ways of doing so, depending on what communication program you use
  1566.   and how you log in to    your remote system.
  1567.  
  1568.   One program that I have not used, but    I have heard is    quite nice, is
  1569.   fet: a front end for term. It    is designed to log you into a remote
  1570.   system and fire up term and all your tredir's.  Any comments on fet
  1571.   would    be most    welcome.
  1572.  
  1573.   I shall now give an example of a set of commands that    use kermit to
  1574.   log into the remote system and then performs all of the term
  1575.   initializations. Obviously, if you use these examples, you will have
  1576.   to modify them for your own login procedures.
  1577.  
  1578.   The command which is actually    invoked    is the shell script knet, given
  1579.   by:
  1580.  
  1581.  
  1582.  
  1583.  
  1584.  
  1585.   #!/bin/sh
  1586.   /usr/bin/kermit -y $HOME/.kerm_term >    $HOME/klog < /dev/null 2>& 1
  1587.   exec $HOME/bin/tstart    >> $HOME/klog 2>& 1
  1588.  
  1589.  
  1590.  
  1591.   The script .kerm_term    is given by:
  1592.  
  1593.  
  1594.  
  1595.   pause    2
  1596.   # The    number you want    to dial
  1597.   output atdtXXXXXXX \13
  1598.   # Login to the terminal server
  1599.   input    145 {name: }
  1600.   output MYNAME    \13
  1601.   input    3 {word: }
  1602.   output MYPASSWORD \13
  1603.   input    5 {xyplex>}
  1604.   # Make the line transparent
  1605.   output term telnet-t \13
  1606.   output term stopb 1 \13
  1607.   # Connect to the remote host
  1608.   output telnet    remotehost.somedomain.org \13
  1609.   input    10 {ogin: }
  1610.   output MYOTHERNAME \13
  1611.   input    3 word:
  1612.   output MYOTHERPASSWORD \13
  1613.   pause    5
  1614.   # Fire up term on the    remote host
  1615.   output exec term -s 38400 -l $HOME/tlog -w 10    -t 150    \13
  1616.   ! /usr/bin/term -r -l    $HOME/tlog -s 38400 -c off -w 10 -t 150    < /dev/modem > /dev/modem &
  1617.   # Open other clients here
  1618.   suspend
  1619.   !killall -KILL term
  1620.  
  1621.  
  1622.  
  1623.   and finally, the script tstart which fires up    the term clients is
  1624.   given    by
  1625.  
  1626.  
  1627.  
  1628.   #!/bin/sh
  1629.   #
  1630.   # This lets mail get out, can    read news here,    can pick up my mail here
  1631.   #
  1632.   /usr/local/bin/tredir    2025 25    2119 newshost:119 2110 pophost:110
  1633.   #
  1634.   # So I can open up Xwindows here
  1635.   #
  1636.   /usr/local/bin/trsh -s txconn
  1637.   #
  1638.   # So I will receive mail....
  1639.   #
  1640.   /usr/local/bin/pop
  1641.   #
  1642.   # Clean out the queue, in case of boo-boos
  1643.   #
  1644.   /usr/bin/runq
  1645.   #
  1646.   # Done now
  1647.   #
  1648.   echo ^G^G > /dev/console
  1649.  
  1650.  
  1651.   When finally you want    to close the connection, you resume and
  1652.   terminate kermit. The    last line of the script    kills the local    term and
  1653.   returns the system in    its initial state.
  1654.  
  1655.   ( Note of the    author:    instead    of doing '!killall -KILL term',    I think
  1656.   it should be possible    just to    do '!tshutdown'. This should also work?)
  1657.  
  1658.   As I said, there are zillions    of ways    to do so; these    are just meant
  1659.   as examples to get you started. Other    examples can be    found in the
  1660.   packages autoterm and    JoelTermStuff.
  1661.  
  1662.  
  1663.   10.  Porting software    for use    with term
  1664.  
  1665.  
  1666.   In principle,    all programs that can be used over a network can also be
  1667.   used in combination with term. Some of them you can get as binaries
  1668.   with term support already built in. These include telnet, (nc)ftp,
  1669.   Mosaic and many others. Most of these    programs are compiled for term
  1670.   1.17 or earlier. They    should,    however, still work with the newer
  1671.   versions of term.
  1672.  
  1673.   Another way to make programs term aware is to    port them yourself. This
  1674.   process will be described in the next    subsection.
  1675.  
  1676.   The last way to make your programs term-aware    is to termify them.
  1677.  
  1678.  
  1679.   10.1.     Port and compile the sources
  1680.  
  1681.  
  1682.   Porting software to term can be done using a fairly simple porting
  1683.   procedure:
  1684.  
  1685.   If installed in /usr/local by    root:
  1686.  
  1687.  
  1688.   1. Add to the    compile    flags -include /usr/local/include/termnet.h
  1689.  
  1690.   2. and add to    the library list -ltermnet
  1691.  
  1692.   If installed in your home directory:
  1693.  
  1694.  
  1695.   1. Add to the    compile    flags -include ~/term/termnet.h
  1696.  
  1697.   2. and add to    the library list -L~/term -ltermnet
  1698.  
  1699.   Now compile the software as described    in the INSTALL or README
  1700.   document that    came with the software.    That should do!
  1701.  
  1702.   At this point    the commands should work both with and without term.
  1703.  
  1704.  
  1705.     telnet localhost
  1706.  
  1707.  
  1708.  
  1709.   does not use term to connect,    but
  1710.  
  1711.  
  1712.     telnet bohr.physics.purdue.edu
  1713.  
  1714.  
  1715.  
  1716.  
  1717.   will use term    only if    you do not have    some other type    of network
  1718.   connection.
  1719.  
  1720.   Some commands    like rlogin can    only be    executed by root and the owner
  1721.   of the term connection (privileged persons).
  1722.  
  1723.   Some term commands will be term transparent and only use term    when
  1724.   there    is not another option.    Some common examples are telnet    and ftp.
  1725.  
  1726.   Others require an external flag to tell them it is alright to    use
  1727.   term.    These programs include xarchie,    fsp and     ytalk.
  1728.  
  1729.   You can either flag these programs to    use term by setting the
  1730.   environmental    variable TERMMODE as specified in README.security, or
  1731.   running make installnet. Eventually, the termnet file    created    will
  1732.   contain special networking instructions, but for now only its
  1733.   existence is checked.
  1734.  
  1735.   If you add an    ethernet connection, you can then simply remove    the
  1736.   termnet file and continue to use the same binaries!
  1737.  
  1738.   NOTE:    Programs that were ported back in the days of client.a,    can
  1739.   still    be recompiled for use with newer versions of term simply by
  1740.   changing the client.a    reference to libtermnet.a.
  1741.  
  1742.  
  1743.   10.2.     Termify
  1744.  
  1745.  
  1746.   This package will convert dynamically    linked binaries    for term use.
  1747.  
  1748.   Before you can use termify you have to make sure that    you have term
  1749.   version 2.2i (is this    version    2.2.8?)    or later and libc.so.4.5.26 or
  1750.   later. Then you have to create the file libt.so.4 in the directory
  1751.   /lib (see the    README file in the package).
  1752.  
  1753.   Problem at this moment is that you have to remake the    file libt.so.4
  1754.   every    time you upgrade term versions.
  1755.  
  1756.   After    you have created the library you can let termify 'crunch' the
  1757.   program you want to make term-aware, by using    the command:
  1758.  
  1759.  
  1760.   termify <command name>
  1761.  
  1762.  
  1763.  
  1764.   When you do not like the result you can 'un'termify the program you
  1765.   have just termified using the    command:
  1766.  
  1767.  
  1768.   termify -u <command name>
  1769.  
  1770.  
  1771.  
  1772.   Last,    the package also contains a script for completely termifying
  1773.   'smail'; so no special transport definitions are necessary. The only
  1774.   thing    you possibly want to change is the 'From: ' address.
  1775.  
  1776.  
  1777.   11.  Term clients
  1778.  
  1779.  
  1780.  
  1781.  
  1782.  
  1783.   11.1.     Term clients available    on ftp sites.
  1784.  
  1785.  
  1786.   Below    a list of application running with term    is given. I am not
  1787.   stating that this list is complete; so any completion    is welcome. As
  1788.   far as possible I will present the site and directory    where the
  1789.   application can be found (all    to my knowledge). When I state
  1790.   sunsite.unc.edu as the place to find the application I mean that you
  1791.   can find it in one of    the following two directories:
  1792.  
  1793.  
  1794.   1. /pub/Linux/apps/comm/term/apps
  1795.  
  1796.   2. /pub/Linux/apps/comm/term/extra
  1797.  
  1798.   Here we go :-)
  1799.  
  1800.   term package:
  1801.  
  1802.  
  1803.  
  1804.        tupload
  1805.        tdownload       (versions 2.1.0 and higher)
  1806.        trsh
  1807.        tmon
  1808.        tredir
  1809.        tudpredir       (versions 2.0.0 and higher)
  1810.        txconn
  1811.        trdate(d)
  1812.        tshutdown
  1813.        libtermnet
  1814.  
  1815.  
  1816.  
  1817.  
  1818.   File transfer:
  1819.  
  1820.  
  1821.  
  1822.        ftpd           sunsite.unc.edu
  1823.        termncftp       sunsite.unc.edu
  1824.        ncftp185           sunsite.unc.edu:/pub/Linux/system/Network/file-transfer
  1825.        fsp           sunsite.unc.edu:/pub/Linux/system/Network/file-transfer
  1826.  
  1827.  
  1828.  
  1829.  
  1830.   Information systems:
  1831.  
  1832.  
  1833.  
  1834.        lynx
  1835.        Mosaic           sunsite.unc.edu:/pub/Linux/system/Network/info-systems/Mosaic
  1836.        chimera
  1837.        netscape           sunsite.unc.edu:/pub/Linux/system/Network/info-systems
  1838.        httpd
  1839.        xgopher
  1840.        gopher           sunsite.unc.edu
  1841.  
  1842.  
  1843.  
  1844.  
  1845.   Remote login:
  1846.  
  1847.  
  1848.  
  1849.   termtelnet          sunsite.unc.edu
  1850.   rlogin          physics.purdue.edu:/pub/bcr/term/extra
  1851.   rsh              physics.purdue.edu:/pub/bcr/term/extra
  1852.  
  1853.  
  1854.  
  1855.  
  1856.   Netnews:
  1857.  
  1858.  
  1859.  
  1860.        tin 1.3           sunsite.unc.edu:/pub/Linux/system/Mail/news
  1861.        news2           sunsite.unc.edu
  1862.  
  1863.  
  1864.  
  1865.  
  1866.   Mail:
  1867.  
  1868.  
  1869.  
  1870.        slurp           sunsite.unc.edu
  1871.        smail           sunsite.unc.edu
  1872.        term.mailerd+smail  sunsite.unc.edu
  1873.        BCRMailHandlerXXX   physics.purdue.edu:/pub/bcr/term
  1874.  
  1875.  
  1876.  
  1877.  
  1878.   Automating scripts:
  1879.  
  1880.  
  1881.  
  1882.        JoelTermStuff       sunsite.unc.edu
  1883.        autoterm           sunsite.unc.edu
  1884.        fet           sunsite.unc.edu
  1885.  
  1886.  
  1887.  
  1888.  
  1889.   Other    programs:
  1890.  
  1891.  
  1892.  
  1893.        inetd           sunsite.unc.edu
  1894.        rdate           sunsite.unc.edu
  1895.        xgospel           sunsite.unc.edu:/pub/Linux/games/x11/networked
  1896.        termify           physics.purdue.edu:/pub/bcr/term/extra
  1897.        xboard           sunsite.unc.edu
  1898.        ircII           sunsite.unc.edu:/pub/Linux/system/Network/chat
  1899.        whois
  1900.        xwebster           sunsite.unc.edu
  1901.        sxpc           ftp.x.org:/R5contrib
  1902.        xztalk           sunsite.unc.edu:/pub/Linux/apps/sound/talk
  1903.  
  1904.  
  1905.  
  1906.  
  1907.  
  1908.   11.2.     The termnet package
  1909.  
  1910.  
  1911.   The package termnet-2.0.4-Linux-bin.tar.gz
  1912.   (sunsite.unc.edu:/pub/Linux/apps/comm/term) contains a couple    of
  1913.   precompiled term clients and a couple    of scripts, manual pages and
  1914.   libtermnet.so.2.00.04. The clients are compiled using    this version of
  1915.   libtermnet.so. The package contains the following clients:
  1916.  
  1917.  
  1918.  
  1919.        fet       perl           sperl4.036  tmon           tshutdown   xgopher
  1920.        finger       perl4.036   suidperl       trdate      tudpredir   ytalk
  1921.        ftp       rcp           taintperl   trdated     tupload
  1922.        fwhois       rlogin      telnet       tredir      txconn
  1923.        ncftp       rsh           term       trsh           xarchie
  1924.  
  1925.  
  1926.  
  1927.  
  1928.   WARNING: The package also contains the complete set of compiled
  1929.   clients of term 2.0.4    including term itself. Do not install this
  1930.   package before you are sure about what you want. You will destroy
  1931.   other    versions of term and its clients when you start    moving
  1932.   executables around.
  1933.  
  1934.  
  1935.   11.3.     Asked for but not yet supported
  1936.  
  1937.  
  1938.  
  1939.   1. DOOM: The problem with this game seems to be the fact that    it uses
  1940.      port 5029 both as client and as server.
  1941.  
  1942.   2. NFS: The NFS server is only supposed to accept requests if    the
  1943.      socket requesting the connection is bound to a port below 1024.
  1944.      This seems    to be troublesome. However, some NFS servers have an
  1945.      'insecure'    option.     In this case NFS might    work eventually, if RPC
  1946.      support is    added to Term.
  1947.  
  1948.  
  1949.   12.  Term and    Security
  1950.  
  1951.  
  1952.   In this section I will point to some security    aspects    of term. The
  1953.   problems will    be explained and a way to improve security will    be
  1954.   given.
  1955.  
  1956.  
  1957.   12.1.     trsh
  1958.  
  1959.  
  1960.   trsh is insecure when    it is used to access the local Linux box from
  1961.   the remote system. The problem with term and its clients is that
  1962.   beside the owner of the term connection also 'root' can execute term-
  1963.   aware    programs over the connection.
  1964.  
  1965.   This also means that 'root' on the remote system can execute trsh and
  1966.   thus can enter the login which owns the term connection quite    easy. If
  1967.   this owner on    the local box is 'root'    then you will be in hell.
  1968.  
  1969.   The solution to this problem is easy:    you just have to put the
  1970.   following line in the    termrc file on the local box:
  1971.  
  1972.  
  1973.   denyrsh on
  1974.  
  1975.  
  1976.  
  1977.   With this set    in the termrc file, nobody can use trsh    on the remote
  1978.   site anymore to access your machine. When you    and others want    to
  1979.   access your local Linux box over the term connection this can    still be
  1980.   done using telnet and    redirected ports.
  1981.   12.2.     sxpc, xhost and xauth
  1982.  
  1983.  
  1984.   sxpc in combination with 'xhost +' is    very dangerous when you    are not
  1985.   using    xauth.
  1986.  
  1987.   Using    xauth is very important    to maintaining security    when using sxpc.
  1988.   If you do not    use xauth when using sxpc all the dangers of running
  1989.   with 'xhost +' apply.    These dangers include but are not limited to:
  1990.  
  1991.  
  1992.   o  Someone watching what is displayed    on your    screen
  1993.  
  1994.   o  Someone watching what you type
  1995.  
  1996.   o  Someone typing in one of your windows (for    example: a command to
  1997.      delete all    your files :-(
  1998.  
  1999.   xauth    is available in    X releases R4 and later. Here I    will describe
  2000.   how to set up    basic usage of xauth.  This configuration is vulnerable
  2001.   to network snooping, but if you can live with    that it    should be fine.
  2002.  
  2003.   NOTE:    when using xauth your $DISPLAY variable    must NOT be set    to
  2004.   localhost (or    localhost:whatever). If    your $DISPLAY variable does use
  2005.   localhost the    clients    will be    unable to find the appropriate
  2006.   authorization    information. The workaround is to use the real hostname
  2007.   of the machine. If you follow    the compilation    instructions in    the
  2008.   README, and compile without -DNOGETHOSTNAME then everything should
  2009.   work.
  2010.  
  2011.   The machine where you    will be    running    clients    will be    called C, the
  2012.   machine where    you wish to display them will be called    D.
  2013.  
  2014.   First    choose a 'key',    up to 16 pairs of hexadecimal digits (so an even
  2015.   number of characters from the    ranges 0-9 and a-f).  You will need to
  2016.   supply this key in place of <key> in the example below.
  2017.  
  2018.   On C:
  2019.  
  2020.  
  2021.   % xauth
  2022.   xauth:  creating new authority file $HOME/.Xauthority
  2023.   Using    authority file $HOME/.Xauthority
  2024.   xauth> add Chostname:8 MIT-MAGIC-COOKIE-1 <key>
  2025.   xauth> exit
  2026.  
  2027.  
  2028.  
  2029.   On D:
  2030.  
  2031.  
  2032.   % xauth
  2033.   xauth:  creating new authority file $HOME/.Xauthority
  2034.   Using    authority file $HOME/.Xauthority
  2035.   xauth> add Dhostname/unix:0 MIT-MAGIC-COOKIE-1 <key>
  2036.   xauth> add Dhostname:0 MIT-MAGIC-COOKIE-1 <key>
  2037.   xauth> exit
  2038.  
  2039.  
  2040.  
  2041.   When starting    the X server on    D you should give the flag -auth
  2042.   $HOME/.Xauthority.  You may need to edit or create a $HOME/.xserverrc
  2043.   to control how the X server is started.  For example:
  2044.  
  2045.  
  2046.  
  2047.   #!/bin/sh
  2048.   exec X  -auth    $HOME/.Xauthority $*
  2049.  
  2050.  
  2051.  
  2052.   Make sure that your .Xauthority file is readable only    by you on both C
  2053.   and D.
  2054.  
  2055.  
  2056.   13.  Things to remember
  2057.  
  2058.  
  2059.   In this section I try    to present you with a list of useful ftp
  2060.   addresses, URL's etc.    where you can find software and    information
  2061.   about    term.
  2062.  
  2063.   ftp:
  2064.  
  2065.  
  2066.   sunsite.unc.edu:/pub/Linux/apps/comm/term/<whole-directory-tree>
  2067.   sunsite.unc.edu:/pub/Linux/docs/HOWTO
  2068.   physics.purdue.edu:/pub/bcr/term/<whole-directory-tree>
  2069.  
  2070.  
  2071.  
  2072.   URL:
  2073.  
  2074.  
  2075.   http://sunsite.unc.edu/mdw/HOWTO/Term-HOWTO.html
  2076.   http://zeus.cs.kun.nl:4080/term-howto/Term-HOWTO.html
  2077.   http://physics.purdue.edu/~bcr/homepage.html
  2078.  
  2079.  
  2080.  
  2081.   netnews:
  2082.  
  2083.  
  2084.   comp.os.linux.announce       announce of new term    versions and Term-HOWTO
  2085.   comp.os.linux.help           ask your questions about term here
  2086.   comp.os.linux.misc           or here
  2087.   comp.protocols.misc           answers to term questions are also posted here.
  2088.  
  2089.  
  2090.  
  2091.   When you start asking    questions on netnews please make sure that you
  2092.   give people in the groups as much information    as they    need to    solve
  2093.   your problem (term version number, way you set up your connection
  2094.   etc.). At this moment    many term versions are in use and all have their
  2095.   specific and common problems.    Therefore, when    you want a useful
  2096.   answer, at least state the version of    term you are using. Otherwise,
  2097.   in some cases    only wild guesses are possible to help you solve your
  2098.   problems.
  2099.  
  2100.  
  2101.   14.  Reliability of term versions
  2102.  
  2103.  
  2104.   Many versions    of term    are around now.    The maintainer of term,    Bill
  2105.   Riemers, has made a list of term versions stating what versions are
  2106.   reliable and what versions you had better avoid. This    list is    the
  2107.   following:
  2108.  
  2109.  
  2110.  
  2111.  
  2112.  
  2113.       term110       --> cannot really say
  2114.       term111       --> cannot really say
  2115.       term112       --> cannot really say
  2116.       term113       --> cannot really say
  2117.       term114       --> fairly stable BETA version
  2118.       term115       --> unstable    BETA version
  2119.       term116       --> unstable    BETA version
  2120.       term117       --> unstable    BETA version
  2121.       term118       --> semi-stable BETA    version
  2122.       term119       --> stable GAMMA version
  2123.       term-2.0.X       --> semi-stable BETA    versions
  2124.       term-2.1.X       --> more stable BETA    versions
  2125.       term-2.2.X       --> new BETA    versions
  2126.       term-2.3.X       -->
  2127.  
  2128.  
  2129.  
  2130.  
  2131.  
  2132.  
  2133.   15.  Term speed table
  2134.  
  2135.  
  2136.   Thanks to Bill McCarthy we now have a    table with term    speed
  2137.   information for different modems, term versions and connection
  2138.   conditions. Its purpose is to    give new and experienced users some idea
  2139.   what other people are    using and the results they are getting.
  2140.  
  2141.  
  2142.  
  2143.  
  2144.  
  2145.  
  2146.  
  2147.  
  2148.  
  2149.  
  2150.  
  2151.  
  2152.  
  2153.  
  2154.  
  2155.  
  2156.  
  2157.  
  2158.  
  2159.  
  2160.  
  2161.  
  2162.  
  2163.  
  2164.  
  2165.  
  2166.  
  2167.  
  2168.  
  2169.  
  2170.  
  2171.  
  2172.  
  2173.  
  2174.  
  2175.  
  2176.  
  2177.  
  2178.  
  2179.                  LINUX TERM    CHART 8/14/94
  2180.  
  2181.  
  2182.   |___modem speed/make___|___line speed__|__avg    cps__|__high__|__term ver_|
  2183.   | 1)    USR SP 14.4     |   9600     |  950         |    963   |    1.17      |
  2184.   | 2)    USR SP 14.4     |  14400     | 1376         |    n/a   |    1.18p06      |
  2185.   | 3)    Zoom 2400     |   2400     |  220         |    230   |    1.19      |
  2186.   | 4)    Boca V.32bis 14     |  57600     | 1400         |    n/a   |    1.01/09?  |
  2187.   | 5)    Viva 14.4     |  14400     | 1300         |    n/a   |    1.16      |
  2188.   | 6)    USR SP 14.4     |  14400+     | 1550         | 1680   |    1.19      |
  2189.   | 7)    Intel 14.4 Fax     |  14400     | 1400         | 1650   |    2.0.4      |
  2190.   | 8)    cable tv hookup     |  57600     | 1500         | 1800   |    1.18p06      |
  2191.   | 9)    Twincom    144/DFi     |  57600     | 1500         | 4000?  |    2.0.4      |
  2192.   | 10)    USR SP 14.4     |  14400     | 1200         | 1500   |    1.08      |
  2193.   | 11)    cable tv hookup     |  19200     | 1300         | 1800   |    1.19      |
  2194.   |-----------------------------------------------------------------------|
  2195.  
  2196.   +Command flags/termrc    settings:
  2197.  
  2198.   1) default escapes   2) window 5     3) baudrate 2400    4)    n/a
  2199.      baudrate 9600      timeout 200        window 3
  2200.      window 10                    noise on
  2201.      timeout 150
  2202.  
  2203.   5) compress off      6) baudrate 19200  7) ignore 19+17    8)    compress off
  2204.      window 10          compress on         window 4        escape 0, 13,
  2205.      timeout 150                 timeout 90        16-19, 255
  2206.      baudrate 38400                        baudrate 0
  2207.                                 shift 224
  2208.                                 flowcrtl 500
  2209.                                 window 10
  2210.                                 timeout    70
  2211.                                 retrain    on
  2212.                                 breakout 24
  2213.   9) compress off     10) compress off        11)    baudrate 19200
  2214.      baudrate 57600      baudrate 38400    compress on
  2215.      window 10          escape 17, 19        shift 224
  2216.      timeout 200      remote        escape 0, 13 16-17
  2217.      noise on                    19, 255
  2218.      share on                    window 10
  2219.      remote                    timeout    40
  2220.  
  2221.   Escaping characters at one end also implies ignoring them on the other end.
  2222.  
  2223.  
  2224.  
  2225.  
  2226.  
  2227.   16.  Hints and Tricks    found on the net
  2228.  
  2229.  
  2230.   In the Linux related newsgroups many questions about term are    coming
  2231.   back every couple of weeks, together with the    answers    to these
  2232.   questions. To    reduce traffic to the newsgroup, in this section I shall
  2233.   try to make a    composition of these questions and the answers to them.
  2234.   Some of the answers have been    checked    by me as I also    had related
  2235.   problems. Others, I have just    taken from the newsgroups without
  2236.   testing them.
  2237.  
  2238.  
  2239.   o  Many people, especially those who are using Ultrix, seem to have
  2240.      trouble with vi presenting    less than 24 lines on a    window with 24
  2241.      lines. There are two ways to get rid of this problem:
  2242.  
  2243.  
  2244.  
  2245.      1.    Log in into the    remote system using: trsh -s telnet < hostname>
  2246.  
  2247.      2.    Put 'resize; clear' in your .login file
  2248.  
  2249.      3.    The best solutions seems to be to enter    the following remote:
  2250.     stty 38400
  2251.  
  2252.   o  Many people seem to have problems with crashing term connections,
  2253.      whatever may be the reason    of the crashes.    So before starting
  2254.      applications people want to know whether their term connection is
  2255.      still alive or not. This can be checked using the following small
  2256.      shell script examples:
  2257.  
  2258.  
  2259.      When you are using    tcsh:
  2260.  
  2261.      if    ( { trsh -s true } ) then
  2262.        ...
  2263.      endif
  2264.  
  2265.  
  2266.  
  2267.   When you are using bash:
  2268.  
  2269.  
  2270.   if trsh -s true; then
  2271.     ...
  2272.   fi
  2273.  
  2274.  
  2275.  
  2276.   o  The new WWW browser called    Netscape is causing people problems to
  2277.      get it to work with term. The good    news is    that it    will work under
  2278.      term. Here    is how:
  2279.  
  2280.  
  2281.          1.    Termify    netscape
  2282.          2.    Edit /etc/services to declare port 1080    (or another port if you
  2283.         like) for http like:
  2284.            Service         Portno./kind         Used by
  2285.            http             1080/tcp             term
  2286.          3.    execute    'tredir    1080 80'
  2287.          4.    Fire up    termnetscape
  2288.            under Options | Preferences | Mail/Proxys
  2289.            leave _all_ of the proxy boxes blank
  2290.            set the SOCKS box to    'term' & 1080
  2291.  
  2292.  
  2293.  
  2294.   When you exit    the Options menu, you will get a warning about 'unknown
  2295.   socks    server'; just ignore it.
  2296.  
  2297.  
  2298.   17.  Other Things
  2299.  
  2300.  
  2301.   Some things that might be included:
  2302.  
  2303.  
  2304.   o  Extension of troubleshooting
  2305.  
  2306.   o  Extension of security issues
  2307.  
  2308.   o  Termwrap
  2309.  
  2310.  
  2311.   o  Suggestions
  2312.  
  2313.   Anyway, if you have suggestions, criticism, suggestions, or anything
  2314.   else to say about this document, please fire away. As    Bill Reynolds is
  2315.   very busy at the moment I, Patrick Reijnen, have taken over the
  2316.   authorship of    the Term-HOWTO.    I can (currently) be reached at
  2317.   patrickr@cs.kun.nl or    patrickr@sci.kun.nl.
  2318.  
  2319.  
  2320.   18.  Acknowledgements
  2321.  
  2322.  
  2323.   A lot    of people have to be thanked. First and    foremost Michael
  2324.   O'Reilly and all the developers of term, who have provided us    with
  2325.   such a great tool. I would also like to thank    everyone who gave
  2326.   feedback and contributed to this HOWTO. They include Ronald Florence,
  2327.   Tom Payerle, Bill C. Riemers,    Hugh Secker-Walker, Matt Welsh,    Bill
  2328.   McCarthy, Sergio, Weyman Martin and everybody    I forgot to mention.
  2329.