how to give password for ssh connection from shell script]

naslov naslov at iskratr.si
Thu May 4 13:59:59 UTC 2006


Hello.

Use expect. Some quick example:


set username "user"
set password "somepass"


########

   spawn ssh 111.222.222.111 -l $username
   expect "assword:"
   send "$password\r"
   expect "#"
   send "whatever command to execute"
   expect "#"
   send "exit\r"

Regards,

naslov

Krishnaprasad wrote:
> Hi all
>
>          how can i give password for a ssh connection from shell 
> script. I dont want to disable the ssh password through "ssh-keygen"  
> and "authorized_keys" . i tried by echoing password from terminal as 
> well as from script. But still it is prompting for the password.
>
> Is it possbile ...?
>
> Thanks
> Krishnaprasad
>





More information about the redhat-list mailing list