I'm not sure what you want to do once you telnet. As an older geek, Telnet was in my comfort zone, but the younger generation has made me see the joys of scp (secure copy)
and ssh (secure shell). ssh has all the functionality of telnet, plus more. You end up sitting in a
remote shell. I had reason to use scp, because I wanted to copy files
across a network on a regular basis (as a cron job) in an automated way.
What both scp and ssh have in common is that they have a method of
logging on without a password, which eliminates the hassle of needing to type a password in the middle of your shell script.
Here's how the magic happens:
/usr/bin/scp -q firstname.lastname@example.org
#A line from my cron script that copies a file from my local machine to my
#"richard" account on kilgore. The -q suppresses chatter.
Now you ask ... how can this work? Where is the security?
scp and ssh work on private and public keys. There is a command called
ssh-keygen that you have to run both on your local system and on the
system you want to regularly contact without the need to login.
If you run ssh-keygen, your key will be cached locally and on the host machine (securely ... believe it or not, due to the magic of RSA). When your
local machine tries to get to the remote machine, the remote just checks
the already cached key, and lets you in w/o a password. This is secure because you needed passwords on both accounts in order to set this
up to begin with. It assumes that anyone logged on as you on your
machine has rights to any other machines you care to access. That's fair.
It took me several hours to figure out ssh-keygen. If you ask, I'll give you another hint or two, but didn't want to waste time if this whole thing won't work for you. (Like for instance if you're stuck w/ telnet because you're
trying to get to a Windows machine ... then you are SOL, buddy!)