-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Description
My code is as bellow. The server is creating properly and i can put files as well. But when i try to connect to server using jsch, it always gives "Auth fail" in session.connect()
withSftpServer(server -> {
server.addUser("username", "password1").setPort(1234);
JSch jsch = new JSch();
Session session = null;
Channel channel = null;
ChannelSftp channelSftp = null;
final int rPort = Integer.parseInt("22");
String knownHostPublicKey = "127.0.0.1" + " ssh-rsa " + <<HOST-KEY>>;
jsch.setKnownHosts(new ByteArrayInputStream(knownHostPublicKey.getBytes()));
session = jsch.getSession("username", "127.0.0.1", rPort);
session.setPassword("password1");
session.setTimeout(25000);
session.connect(25000); **//Auth fail here**
channel = session.openChannel("sftp");
channel.connect();
channelSftp = (ChannelSftp) channel;
});
Metadata
Metadata
Assignees
Labels
No labels