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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I pass username & pasword through a telnet script

Status
Not open for further replies.

gem65

Programmer
Aug 27, 2002
3
US
I have createted a short shell script to telnet to a remote host.
I cannot figure out how to pass the username and password within the script. (env = HP-UX).
 
I don't think this is possible (or secure even if it was). Some people have had success doing this sort of thing using an application called expect, but I'm afraid I've never used it. Perhaps someone who has can elucidate?
 
yes 'expect' works; i prefer 'ssh'
pls read the docs
(at the moment i am on a 'dos-sys' :-( )
 
What is the situation around the script? Why would you want to telnet in rather than ftp or ssh?

Perhaps there is a more secure way to do what you want...
 
I have never used the ssh command could someone give me a hint on how to start. The man pages do nothing for me on this.

is it
OpenSSh -l greg host?

ssh -l greg host?
 
to login via ssh using a password

ssh -l <username> <host>
ie: ssh -l d3vNull sshserver.example.org

to login via ssh utilizing a specific identity key file:

ssh -l <username> -i <keyfile> <host>

You will be prompted for the key's passphrase, although you can set up a key without a passphrase for use in scripts

take a look @ for more examples :)

--d3vNull
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top