I have a bash script, that uses sshpass and ssh to autologin to different machine and trigger command. The bash script works well, when triggered from the command line, but when it is called from java application, it fails to proceed.
sshpass -p 'password' ssh [email protected] './SleepDisplay && exit'
The bash script does a lot of other things and I have no way to implement the ssh login directly in java. I don't seem to be able to figure out, why it fail. Everything but the ssh runs well.
it's not working. What's not working? Where is the code? How are you executing the command?set -vx; sshpass .... Does your JAVA have the same PATH as the terminal that you run your shell code it. Consider addingecho $PATH; set -vx; sshpass ...to validate PATH is correct. Good luck.