TestRunner not allowing passwordless jsch session
I have the following code in a groovy script which works fine (i.e. logs in without prompting for username/password) when I run from SoapUI NG.
But when I try to run from TestRunner, it prompts for username - doesn't seem to pick up on "session.setConfig("StrictHostKeyChecking", "no");"
Code:
log.info("Starting sftp upload process")
Session session = null;
log.info("Session defined")
Channel channel = null;
JSch ssh = new JSch();
session = ssh.getSession(ftpusername, ftpdomain, ftpport);
session.setConfig("StrictHostKeyChecking", "no"); //auto accept secure host
session.setPassword(ftppassword);
session.connect();
log.info("Connected to session")
channel = session.openChannel("sftp");
channel.connect();
TestRunner console output:
17:26:00,654 INFO [log] Starting sftp upload process
17:26:00,654 INFO [log] Session defined
Kerberos username [Username]:
Hi,
The solution to this was to add:
session.setConfig("PreferredAuthentications", "publickey,keyboard-interactive,password");
before
session.connect();