Darxus on Tue, 11 Jan 2000 20:28:30 -0500 (EST)


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

Re: [PLUG] dialin server for linux?


On Tue, 11 Jan 2000, lord_dArk wrote:

> I think this can be done with agetty, using a little shell script that
> just does 
> #!/bin/sh
> telnet whereever.com
> and setting the login program to that shell script using the -l option on
> agetty, and the -n option so it doesn't ask for a username..
> I don't know how secure this would be though since the script and telnet
> will be run as root..

That's about what I was thinking, but:

1) I think pretty much any version of getty (plain getty, mingetty,
agetty), although I'm not familiar w/ them all, I think they should all
have a -l option to let you change the login program.

2) You shouldn't need to use a shell script.  You should be able to set
the login program to "telnet host.domain.com".

Reguarding the fact that the telnet program would be run as root -- this
is basically your only option, unless you wish to require the users to go
through another login prompt.

Incase you're not familiar w/ getty, there are lines in your /etc/inittab
that look something like:

T1:23:respawn:/sbin/mgetty -x0 -s 57600 ttyS1
T2:23:respawn:/sbin/mgetty -x0 -s 57600 ttyS2

Change it to something like:

T1:23:respawn:/sbin/getty -l '/usr/bin/telnet hostname' 57600 ttyS1
T2:23:respawn:/sbin/getty -l '/usr/bin/telnet hostname' 57600 ttyS2

There doesn't appear to be a debian agetty package, so I can't easily 
check it's manpage, but I believe to look into the -n lord_dark was
talking about.  But I believe the above will work.  My only concern is..
hmm, just realized I coult try it on a virtual terminal, and it looks like
you'll want that -n.  Okay, getty has it.

Okay, I found something that works on a virtual terminal (should work the
same as a comm port, except it's on port tty9 instead of ttyS1).


Put in your /etc/inittab:

T1:23:respawn:/sbin/getty -n -l /usr/local/bin/telnet.monet 57600 ttyS1

Where /usr/local/bin/telnet.monet contains:

#!/bin/sh
telnet monet.op.net

It wouldn't do it w/out the #!/bin/sh.
Of course, you'll want to change "monet.op.net" to the host you're
actually trying to reach.


The reason I tried it with a script is, depending on the quoting I used,
it either treated "telnet monet.op.net" as the name of a single program to
execute (as apposed to "telnet" being the program, and "monet.op.net"  
being an argument), or it treated "telnet" as the login program
(correctly), but treated "monet.op.net" as another argument to getty,
instead of an argument to telnet.  I'm sure this is why lord_dark was
talking about using a script, but I still feel like there's gotta be a way
to skip that step.  I'm going to the bathroom, then I'll try some more :)


Anyway, I'm certain this can solve your problem.  And remember "man getty"
is your friend.
__________________________________________________________________
PGP fingerprint = 03 5B 9B A0 16 33 91 2F  A5 77 BC EE 43 71 98 D4
            darxus@op.net / http://www.op.net/~darxus
                      "There is no spoon."



______________________________________________________________________
Philadelphia Linux Users Group       -       http://plug.nothinbut.net
Announcements - http://lists.nothinbut.net/mail/listinfo/plug-announce
General Discussion   -   http://lists.nothinbut.net/mail/listinfo/plug