Operating System - HP-UX
1833914 Members
2197 Online
110063 Solutions
New Discussion

Connect unix box through telnet using batch file.

 
mksharma
Occasional Contributor

Connect unix box through telnet using batch file.

Hi,
How can I connect unix box through telnet using batch file.


-----
PS: This thread has been moved to an appropriate category- Forums Moderator
5 REPLIES 5
Dennis Handly
Acclaimed Contributor

Re: Connect unix box through telnet using batch file.

You typically use remsh to execute commands on other machines. remsh would allow you to bypass the password prompt (or hardcode it with security issue).
Steven E. Protter
Exalted Contributor

Re: Connect unix box through telnet using batch file.

Shalom,


Any such script would be a security hazard.

It would need to contain the password clear text. Using telnet, authentication and datastream would also be "in the clear"

Suggest:
http://software.hp.com

Download and install the latest version of secure shell, HP's port of openssh.

Install this and learn how to set up password free, secure ssh.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
mksharma
Occasional Contributor

Re: Connect unix box through telnet using batch file.

I want to write a batch file which supplies Telnet username and password and login to the unix box.
If i run that batch file it will automatically logins to the Unix box.
This i need to put in one of scripts.
OldSchool
Honored Contributor

Re: Connect unix box through telnet using batch file.

you can try "here-docs" but I don't think that will work in this case....

telnet somename <<-EOF
name
pass
EOF

"expect" can be made to do this...but rather than stating what "you want to do" (telnet via script), you might get "better" answers if you described the issue you want to address (ie what you want to accomplish, what do you need to do on the other server that requires the connection)

As mentioned, rexec, remsh, ssh and others are candidates to consider
Steven Schweda
Honored Contributor

Re: Connect unix box through telnet using batch file.

> PS: This thread has been moved to an
> appropriate category- Forums Moderator

Perhaps not. See also:

http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1235610