Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

sshpass not working properly

I'm using sshpass to pass the password non-interactive on ubuntu 11.04.

when I use sshpass with scp

sshpass -p '123' scp [email protected]:/home/sayuj/examples.desktop ~/Desktop/

it works fine

but it doesn't work with ssh

sshpass -p '123' ssh [email protected]

What could be the problem and how do I fix it?

like image 786
Sayuj Avatar asked Jun 28 '11 06:06

Sayuj


2 Answers

Maybe do you need -o stricthostkeychecking=no like this

sshpass -p $PASSWORD ssh -o stricthostkeychecking=no user@domain "command1;command2;"
like image 129
Alex Montoya Avatar answered Sep 22 '22 21:09

Alex Montoya


New sshpass version 1.05 works with the latest ssh client. It is included in the Ubuntu 12.04 Precise Pangolin.

For older Ubuntu (or other Linux distros) you can get the sources from:

http://sourceforge.net/projects/sshpass/files/sshpass/1.05/

untar with:

tar xvzf sshpass-1.05.tar.gz

build:

cd sshpass-1.05
./configure
make

and use the created binary sshpass.

like image 20
mmm Avatar answered Sep 24 '22 21:09

mmm