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

Auto SSH

Status
Not open for further replies.

mediation

Technical User
Nov 11, 2006
17
Dears,

When i use the following script to connect to another server using SSH i got the output below .. please advise how to resolve this problem ??

#!/bin/ksh
{
sleep 1
echo "password\r"
sleep 1
echo "commands\r"
sleep 1
echo "exit\r"
sleep 5
}|ssh -l username ip.address


Output:
========
Pseudo-terminal will not be allocated because stdin is not a terminal.

usename@xxx.xxx.xxx.xxx's password:

and it is waiting to insert the password although it is written in the script.



Thanks in advance for your quick reply.
 
why not set up trusted keys between the the hosts?
You could then issue you command something like this:

ssh user@remote_host_name "a command; another command"

without having to pass passwords, etc.
If you are not sure how to set up keys, go here:


It covers open AND commercial ssh.

If you must use passwords, then you you should look into using expect along with ssh. Here is an expect link that should help get you started:

 
And what about this ?
}|ssh [!]-t[/!] -l username ip.address

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top