2

I've searched all over SuperUser, but couldn't get the solution. Here is a script that am using for ssh using expect. I'm using ubuntu and I've installed expect using aptitude install expect.

#!/usr/bin/expect -f

spawn ssh user@server
expect "Password:"
send "mypassword\r"
interact

When I run this script file, sh script.sh, I'm getting this error,

test.sh: 3: spawn: not found
couldn't read file "Password:": no such file or directory
test.sh: 5: send: not found
test.sh: 6: interact: not found

I've tried with this posts, but not working, Ubuntu 10.04 using ssh without entering my password

Thanks,

1 Answers1

1

You need to make your file executable:

chmod +x script.sh

and run it like:

./script.sh
maganap
  • 126