I know questions like this have been asked before, and I have read them all (that I found).
The problem I have is that we have an embedded linux device that we can log into for debug purposes by doing the following:
ssh root@name
Then the password is anything (I usually just hit enter). I don't want to change anything on the embedded device/linux. But I do want to be able to (as part of my script) ssh into it.
My research has shown me that the following can be used (this is copied from another post):
#!/usr/bin/expect -f
spawn ssh [email protected]
expect "assword:"
send "mypassword\r"
interact
However with my version of Ubuntu (10.04) I don't have spawn or send commands. I was able to install the "expect" command with sudo apt-get install expect.
Does anyone have a solution? is it possible to install these commands, or is there another way to ssh and get past the "password" step?
Thanks :)
------------- EDIT -----------------
I think I am starting to understand the issue I am having. I have a script that starts with:
#!/bin/bash
Then later I am trying to do:
spawn ssh [email protected]
expect "assword:"
send "mypassword\r"
interact
I did not realise that you needed explicitly the:
#!/usr/bin/expect -f
At the start of the script. so I have had to move my code into a seperate file which contains only and exactly:
#!/usr/bin/expect -f
spawn ssh [email protected]
expect "assword:"
send "mypassword\r"
interact
... sorry for the mis-understanding on my part, but people answers helped me to twig what I was doing. This is not quite ideal for me as I wanted to pass parameters in to open different ssh connections and I can't pass in parameters to this script starting with "expect -f" :(
program 'send' can be found in the following packages: mailutils-mh, nmh
. What am I doing wrong there?