Link to home
Start Free TrialLog in
Avatar of dryzone
dryzone

asked on

Automated telnet -and yes!! I am crazy.

I have several machines on an internal network that is DMZ and some level of promisquiety is allowed.

Is it possible to write a script that can automatically feed a Telnet prompt Username and Password ?
Username is easy but password is a bit troublesome.

Please present a script which will when executed log you in if you have password and username as variables in the script.
Avatar of superschlonz
superschlonz

Im using expect (http://expect.nist.gov/) for things like that.
It's a TCL/Tk interpreter with some added functionality for running an controlling processes.
Why bother with that. Given the description of what you have and want to do it would make just as much sense to configure the systems for rlogin or ssh access using rhosts. In that case no password would be required for those users/machines permitted access that way.

Personally I'd generate a keypair with ssh-keygen (with no passphrase) and place the public key in .ssh/authorized_keys2 on the remote system. That allows me to simply say "ssh remote-host" and be instantly logged in without having to supply a password. It's far more secure than using rhosts files or hosts.equiv and has the bonus of using an encrypted session.
Avatar of dryzone

ASKER

jleve.
Yes I am running SSH on my firewall for whenever I am outside.
However, the ssh behaviour as you describe could never be implimented. Passwords were always required. You are right about using ssh, but it is slow compared to telnet  and I am in a DMZ.
sure rlogin.......still needs a password.

Both superschlonz and jleve.
Give me a script which I enter username and password and when I run it I am logged in and you have the points.
ASKER CERTIFIED SOLUTION
Avatar of jlevie
jlevie

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of dryzone

ASKER

Looked good but did not work.
Expect is in /usr/bin so that works.
HGowever the script failed.


[Lht@gateway Lht]$ ./loginhelper
spawn telnet
usage: telnet [-l user] [-a] host-name [port]
send: spawn id exp4 not open
    while executing
"send "Lht\r""
    (file "./loginhelper" line 10)
[Lht@gateway Lht]$
The script expects the host name of the remote system as an argument, so execute it as "loginhelper remote-name". My presumption was that you'd have the same name and password on each of the DMZ systems and you could then use one script and specify the system on the command line.