信頼できる接続を持つ2つのサーバーがあります。Host Key Verification なしで ssh 経由で接続して SFTP 経由でファイルを転送したい。
Java 1.7 と Redhat Linux OS を使用しています。
以前は、以下のように ssh に接続できる j2ssh-core0.2.9.jar を使用していました。
SshConnectionProperties properties = new SshConnectionProperties();
SshClient ssh = new SshClient();
properties.setHost(host);
properties.setPort(port);
ssh.setSocketTimeout(readTimeOut);
ssh.connect(properties,new IgnoreHostKeyVerification());
j2sshマーベリックでは、
SshConnector con = SshConnector.createInstance();
con.getContext().setHostKeyVerification(
new ConsoleKnownHostsKeyVerification());
con.getContext().setPreferredPublicKey(
Ssh2Context.PUBLIC_KEY_SSHDSS);
SocketTransport t = new SocketTransport(hostname, port);
t.setTcpNoDelay(true);
SshClient ssh = con.connect(t, username);
Ssh2Client ssh2 = (Ssh2Client) ssh;
j2ssh maverick でこれを達成する方法を提案してください。