Reputation: 121
I have a script with following line
sshpass -p 'password' ssh user@server "touch /tmp/test"
this works, when I run the script, but if I put the script in cron it doesen't work. any ideas ?
Upvotes: 2
Views: 4968
Reputation: 832
Since this is the first answer on google, give sshpass absolute path like /usr/bin/sshpass
. you can get the path by which sshpass
. I also added /usr/bin/ssh
to be sure.
Upvotes: 6
Reputation: 121
It worked after adding -o StrictHostKeyChecking=no
sshpass -p 'password' ssh -o StrictHostKeyChecking=no user@server "touch /tmp/test"
Upvotes: 4