Recibo una excepción mientras uso SSHJ."No se pudo cargar la excepción known_hosts" utilizando SSHJ
Aquí es como yo implementé:
public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
final SSHClient ssh = new SSHClient();
ssh.loadKnownHosts();
ssh.connect("serverName");
try{
ssh.authPublickey("myUserId");
final Session session = ssh.startSession();
try{
final Command cmd = session.exec("net send myMachineName Hello!!!");
System.out.println(cmd.getOutputAsString());
System.out.println("\n Exit Status: "+cmd.getExitStatus());
}finally{
session.close();
}
}finally{
ssh.disconnect();
}
}
}
Pero tengo la siguiente excepción:
Exception in thread "main" java.io.IOException: Could not load known_hosts
at net.schmizz.sshj.SSHClient.loadKnownHosts(SSHClient.java:528)
at SSHTEST.main(SSHTEST.java:25)
¿Qué estoy haciendo mal?
¿Dónde en el servidor? – user234194
@ user234194: crea el archivo en el cliente. El servidor normalmente no verifica de dónde viene el cliente (que sería un PITA real). –