mina-sshd
mina-sshd copied to clipboard
HostConfigEntry resolveIdentityFilePath Identity Problem
Version
2.14.0
Bug description
During the client#connect invocation, I am facing the parsing problem that provides me with identity in format "~/.ssh/sftp.pem", but Tilda is expected to be the first token.
public class Main {
private static final int DEFAULT_SFTP_SESSION_TIMEOUT = 1500;
public static void main(String[] args) throws IOException {
SshClient client = null;
ClientSession session = null;
try {
client = SshClient.setUpDefaultClient();
client.setServerKeyVerifier(AcceptAllServerKeyVerifier.INSTANCE);
client.start();
session = client.connect("user, "host", port).verify(DEFAULT_SFTP_SESSION_TIMEOUT, TimeUnit.MILLISECONDS).getSession();
session.addPasswordIdentity("password");
session.auth().verify(DEFAULT_SFTP_SESSION_TIMEOUT, TimeUnit.MILLISECONDS);
System.out.println(session);
} catch (Exception e) {
var message = "Failed to create SSHClient Session:" + e.getMessage();
System.out.println(message);
} finally {
Objects.requireNonNull(session).close();
Objects.requireNonNull(client).close();
}
}
}
Actual behavior
Home tilde must be first: "~/.ssh/sftp.pem"
Expected behavior
Connection established.
Relevant log output
No response
Other information
No response