sshpass: Failed to run command: No such file or directory

Viewed 17872

I'm trying to run a remote sh from Jenkins to change a script to executable, but I take the following error:

[-manager_feature_kubernetes-YYLYXREUAV4NHLBACWJHV5YMQFOGHM4SS7G67ASIGYSZZGVS4VBQ] Running shell script
+ sshpass -p **** ssh'****@10.XX.XX.XXX chmod u + x /home/Script.sh '
sshpass: Failed to run command: No such file or directory

The logic of my script is:         

sh "sshpass -p \" $ {passSSH} \ "ssh ${userSSH}@10.XX.XX.XXX \" chmod u + x /home/Script.sh \ ""

Can anyone help?

4 Answers

Have you tried this:

sshpass -p '$rootPassword' ssh -o 'StrictHostKeyChecking=no' $isRoot@$Host "chmod u+x /home/$USER/Script.sh"

Just write it here : my docker container did not have package lftp installed

a simple apt-get install lftp solved this issue.

Hope it will help ;)

In my case I was using docker container of alpine linux in which openssh was missing so sshpass failing. After installing openssh package it solved.
apk add openssh
(so just incase if some one faces same)

$rootPassword,$isRoot, $Host are Jenkins string parameter

sshpass -p ""$rootPassword"" ssh $isRoot@$Host id; echo $HOME;

Related