advanced shell question (?)

Jay Moore jaymo at mail.bokler.com
Sun Jan 30 21:30:54 UTC 2005


I have some embedded boxes that I need to manage remotely. They don't
support ssh, only telnet is available. To address this security issue,
my plan was to co-locate a "real" computer with the embedded devices so
that I could ssh to the "real" computer, and then telnet from there over
the local network to the embedded boxes.

The way that I want to set this up is to create user accounts on the
"real" computer that correspond to each of the embedded boxes. Then,
when I log in as that user I want my shell configured to start a telnet
session to the corresponding embedded box. 

To test this idea I created a simple script as follows. It starts the
telnet session, and gets me logged in - problem is that the script
completes, and then the telnet session is gone. What I need then is some
way to spawn an interactive shell from a shell script (I think). I've
read that the "expect" program will handle such things, but I really
prefer to do it using only the shell.

#! /bin/sh

    (sleep 3;
    echo "password";
    sleep 3;
    echo "ls -la";
    sleep 3;
    ) | telnet -l user 192.168.0.2

How do I do this (or can it be done at all)??

Thanks,
Jay




More information about the users mailing list