[Prev][Next][Index][Thread]

Re: modem in and out



Eli Algranti wrote:
> 
> Hi!
> > > How the hell do I set up getty to listen on my modem and still be
> > > able to use the line to call out?
> >
> > For this you need uugetty and NOT getty. It simply a matter of putting the
> 
> I meant the ps_getty package in general, tried both getty and
> uugetty to no avail.
> [...]
> > right line in /etc/inittab and making the right /etc/conf.uugetty.ttys?
> 
> And what right line is this? [...]
> Have you tried using uugetty? Does it work in your site? If so, can
> you supply me with your conf.uugetty.*. Messages with "There is a
> way!" with no additional information serves only to annoy.
> 

 a friend (peter) and me managed the same thing just yesterday evening. after two weeks of configuration 
battles and a long evening of calling again and again peter arrived at the attached uugetty-howto. i hope this 
can help eli and others.
> >
> > For further details the Serial-Howto is a great source of information.
> 
> Read it, tried it, didn't work.
> so did we. it's not quite perfect. neither is this one. comments, questions are welcome.
here it is (i'll try not to interrupt too much in the middle):

Peter's uugetty howto
---------------------

WHAT:

	This is the result of my setting up a uugetty remote login on my
Linux system in August 1996 with the help of Eran ( limbo@actcom.co.il ).
I am Peter, email: 100310.2360@compuserve.com . Feel free to email me about
this. I'm especially interested in feedback from people who run more than
one dialin line using uugetty. If you are in the Tel Aviv area and are
trying to set up such a thing then send me an email and we'll set up a
shedule for cooperation. I answer emails to within 1 week at most, usually 2
days.

HOW TO:

This describes the steps to take one by one.

1. Login as root. Set up a new user account. Use adduser or useradd. Set up a password for
the new user using passwd. Verify that the home directory /home/$user exists
and that it has uid=$user and gid=users. Verify that the file
/var/spool/mail/$user exists and that it has uid=$user and gid=mail. The
permissions on the mail file and on the home file should both be 660, i.e.
-rw-rw---. Verify in /etc/passwd that the new user has home directory
/home/$user and the login shell /bin/sh.

2. Verify that you can log in as $user at another virtual terminal using
Alt-Fn where n is a number from 2 to 5 ( do not run X when you do this - I 
haven't tried it from X ). Remain logged in at that terminal as $user.

3. Verify that the new user can create files by opening a text processor (
or doing $user@machine~# cat >mytestfile </etc/hosts : rm mytestfile ). You
should get no errors. Send mail to root using mail root ... . Change to root
and send mail to $user. Change to $user and type mail. You should get the
mail from root. Change to root and type mail. You should get the mail from
$user. ( NOTE: All the login names MUST be lowercase, otherwise sendmail
will report 'unkonwn user' - this is a bug I have discovered recently ).

4. Setup uugetty. uugetty is set up as follows:

*** In file /etc/default create this file:

/etc/default/uugetty.dialin

#
# Remote login uugetty file
#

# alternate lockfile to check... if this lockfile exists, then uugetty is
# restarted so that the modem is re-initialized
ALTLOCK=cua0

# timeout to disconnect if idle...
TIMEOUT=100

# modem initialization string... Sets the modem to auto-answer
#
# format: <expect> <send> ... (chat sequence)
INIT="" \d+++\dATZ\r OK\r\n ATH0\r\n OK\r\n ATM0E1Q0V1X4S0=0&D1&C1&S0\r\n OK\r\n
WAITFOR=RING
CONNECT="" ATA\r\n CONNECT
 
	***NOTE FROM ERAN: here i can't help my self, this is (i think) one of the major diffs from the Serial
	-howto. they used CONNECT\s\A which should wait for a string like CONNECT 300 (yeah :) ). now when the
	modem sends something else (CONNECT 14000 MNP 5 v42 bis. whatever) it might fail. at one time i 
	(dialing in to peter's machine) connected but got no login prompt. only after i manually typed CONNECT
	i got a (very) surprising login: prompt.
	***END OF DISRUPTION
the file can be root/root and -rw-rw---

NOTE: Change the entry 'cua0' to 'cuaX' where X is your serial port where
the modem is minus 1 ( i.e. COM1 = cua0 etc ).

You may have to change the settings in the INIT string. Read the
Serial-HOWTO and use the modem manual to decipher my INIT. It is for a 14400
fax / voice modem with voice mail ( which is not used here ).
 
*** In file /etc/gettydefs

Assuming that the modem you have is 14400 baud, add this block using a text
editor:

###############################################################################
### 19200 fixed modem entry, mine ( PETER )
###############################################################################
F19200# B19200 CS8 HUPCL CRTSCTS # SANE B19200 CS8 HUPCL CRTSCTS #@S login: #F9600

F9600# B9600 CS8 HUPCL CRTSCTS # SANE B9600 CS8 HUPCL CRTSCTS #@S login: #F9600

F4800# B4800 CS8 HUPCL CRTSCTS # SANE B4800 CS8 HUPCL CRTSCTS #@S login: #F2400

F2400# B2400 CS8 HUPCL CRTSCTS # SANE B2400 CS8 HUPCL CRTSCTS #@S login: #F19200

###############################################################################

NOTE: make sure that there are no other lines with 'Fxxxx' anywhere in the
file. If there are then change the lines above to 'Gxxxx' or whatever to
avoid a conflict. Note that the lines above are chained. uugetty tries to
match the line speed with these lines. For 28800 you will add a line like:

F38600# B28800 CS8 HUPCL CRTSCTS # SANE B28800 CS8 HUPCL CRTSCTS #@S login: #F19200

and edit the last entry in the line with 'F2400# ' from '#F19200' to
'#F38600'.

*** In file /etc/inittab add the entry:

# ### CHANGED BY PETER
S0:345:respawn:uugetty -d /etc/default/uugetty.dialin ttyS0 F19200 vt100

after the section marked 'system daemons'. That is, after where the 'getty
VC' lines are. Change ttyS0 to ttySx where x is your serial port where the
modem is minus 1 ( i.e. COM1 = ttyS0 ). Change the entry at F19200 to the
highest speed supported by your modem ( see modem manual, usually the next
higher 'rounded' baud speed than the actual line speed of the modem - for
14400 this is F19200, for 28800 F38600 I think ). Change the second entry
after 'S0:' from '345' to anything that contains your runlevel which will
allow dialin ( 345 allows dialin for runlevels 3,4 and 5 ).

If you have used something other than 'F' in /etc/default/uugetty.dialin
then change 'F19200' to '<whatever>xxxx' where <whatever> is a letter and
xxxx the highest modem speed you have.

*** Clear the file /var/adm/uugetty.log if it exists.

*** Clear the file /var/adm/critical if it exists.

*** Clear the file /var/adm/notice if it exists.

NOTE: Clearing is *NOT* deleting. Do cat >this_file <<EOF 

Now, reboot the system. Login as root and type ps -a. You should see a
process with uugetty -d ... in it, stopped. Ask a friend to dial in and
login ( give him the password and the login name first ). 

When he is online type 'talk $user'. If all is ok then you can chat, you're
done. Test the mail both ways and that's it. Wear this in good health.

WARNING: This file does not assume any kind of protection or system
administration security. I decline any responsability for any damage that
may happen as a result of the use of the information in this file, directly
or indirectly as well as any circumstantial damage that may incur.

*** If he can't login:

Do ps -a again. If the uugetty process now has another PID then something
was wrong. Check that the modem is on hook. If it isn't do cat >/dev/cua0
and then type ATH<ENTER><^C>. This should put the modem on hook.

Read /var/adm/critical and /var/adm/notice as well as /var/adm/uugetty.log
to find out what happened and go back over this.

I hope that this helps somebody.

NOTES:

This script setup sets up the highest speed for the modem/kernel
communication and allows the modem to auto-detect the baud rate from the
remote host ( supported only on modems with that feature - read the modem
manuals ). It uses only one entry in /etc/gettydefs. To use the /a feature
in uugetty CONNECT read the getty man page and the Serial HOWTO.

When the remote user logs in then he sees the text in /etc/issue first. Edit
this to suit your system. After logging in he sees the text in /etc/login
which can have some interesting features added, like his user name, serial
speed and other things. See the man page for getty.

CREDITS:

Eran ( limbo@actcom.co.il ) who spent about 4 hours on the phone until it started ticking and
helped a lot, Paul Suthcliffe <paul@devon.lns.pa.us> who wrote getty and the
manpage for it, Mark Komarinski who wrote the 'intro-sys-admin.doc' that
comes with some Slackwares ( 1992 ) and the Serial HOWTOs. 

I hope that there aren't many typos in here, english is not my first
language :-)

Good luck, Peter 
email: 100310.2360@compuserve.com
8/8/1996
 
----- CUT HERE -------

OK, that's it. i too hope it helps.

Seeya.
Eran.


References: