ssh -i /Users/uramoty/.ssh/id_rsa IP or URL of the host you want to log in to
If you execute from the terminal, you can log in safely, but with Java in between,
String[] cmd = {
"sshpass",
"-p",
"password", "ssh", "-r", "-o", "Login host GIP" }; doShell SampleRunTime = new doShell(); try { SampleRunTime.execCmd(cmd); } catch (Exception e) { e.printStackTrace(); }
For some reason, an error occurs. which sshpass then / usr / local / bin / sshpass So "Sshpass", in the above sample, "/ usr / local / bin / sshpass", Please try. If that doesn't work, use the sample "sshpass", above.
The actual path of / usr / local / bin / ** sshpass **. "/usr/local/Cellar/sshpass/1.05/bin/sshpass",
To.
Recommended Posts