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

Re: Passing parameters to a telnet session?



Marc Shapiro <m_shapiro@bigfoot.com> writes:
>
> Does anyone know if there is a way to pass a parameter to a telnet session?

A mechanism exists for the "telnet" client to send arbitrary
environment variables to the "telnetd" server.  The Debian version of
the client will send USER (if "-a" or "-l" is specified on the command
line), PRINTER, and DISPLAY by default.  It also sends TERM, though
via a technically different mechanism.  It can also be told, via an
"environment export ..." command at the "telnet>" command prompt or in
an /etc/telnetrc or .telnetrc file, to send other environment
variables.

The Debian version of the server, however, for security reasons, will
only accept values set for USER, LOGNAME, DISPLAY, POSIXLY_CORRECT,
and TERM.

You can't overload USER, because that's the value the "-l" is sending,
and you can't generally overload TERM because it undergoes some
processing that changes its value to "unknown" if it isn't recognized.
So, the easiest one to use (the one that the client sends by default
and that the server accepts without question) is DISPLAY, so if you
do:

        DISPLAY=format_harddisk telnet hostname -l username
        DISPLAY=destroy_universe telnet hostname -l username

you're all set.  The only caveat is that the value shouldn't start
with ":" or "unix:" since that will result in the local hostname being
stuck in there.

> I have set up a user on one box that does not require a password to
> log in.

This is generally considered dangerous if the user's shell is an
unrestricted shell such as Bash, even if you create a special-purpose
".bash_profile" to try and restrict the user's activities.  For
example, while Bash is reading ".bash_profile", if it receives a
keyboard interrupt (i.e., a SIGINT signal), it will stop processing
and drop the user to a shell prompt.  Oops!

-- 
Kevin <buhr@telus.net>



Reply to: