Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to telnet in shell script--urgent!!

Status
Not open for further replies.

Yiyi

Programmer
May 31, 2001
13
CA
Would somebody tell me how to telnet another box wihtin shell script?

Thank you.
 
Hi,

U can use rsh to run commands on another server without having to enter password.U can do so by entering the hostname and user-id entry in /.rhosts and /etc/hosts.equiv files of both servers as
hostname [username]
Then from one server ,say serverA ,run the command as:-
serverA#rsh serverB who (This command runs and displays the users connected on serverB)

I hope this helps....
 
Hi NavinB

Thanks for reply.

However, remote host might not be the trusted host with localhost each other, evn not on the same OS. That's the problem.

Your help is appreciated!

 
See, if u are running some command from one server to another in a script without having to enter a password then u have got to have a trusted host otherwise u will have to telnet to the box everytime and supply a password.U can ftp files from one server to other without a trusted host in a script but not with telnet.
 

If you have to use telnet...

Get ahold of a program called expect. You can do whatever
you want with telnet with that.

With expect you can control telnet sort of like a i/o
shell script for other commands. It has it's own
variables and what not as well.

Personally, I'd use ssh commands but whatever.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top