-1

We do have java example that uses the JSch library to perform the sftp operation. When this example executes and communicates with server that has Kerberos- gssapi enabled, then it would ask for username and password through prompt and application stops to get the entries.

Please see below -

Kerberos username [user1]: 
Kerberos password for user1: 

We need help- how we can avoid this prompt? but make sure we need to support the gssapi (Kerberos) as well.

Can someone help me on this.

Thanks, Hrushi

Hrushi
  • 163
  • 1
  • 10
  • 1
    If JSch uses the standard Java libs for Kerberos, and you run a standard Sun/Oracle JVM (or OpenJDK), then you should override the JAAS config (via a Java system prop pointing to a conf file) => define _"principal `xyz@AA.ORG`"_ and either _"use ticket in cache that was previously set by `kinit`"_ or _"use pwd stored in keytab file `/ff/gg/xyz.keytab`"_ (or both) – Samson Scharfrichter Feb 05 '19 at 13:21
  • For those who don't want to pass in custom conf to JVM see https://stackoverflow.com/q/29669459/885922 or https://stackoverflow.com/q/10881981/885922 which may help – xlm Jul 05 '21 at 00:00

1 Answers1

0

I have resolved this issue by following below steps -

  1. create file jaas.conf like below -

    user1@hostname:~$ cat /etc/jaas.conf com.sun.security.jgss.krb5.initiate { doNotPrompt=true };

  2. add below entry in jvm env

    -Djava.security.auth.login.config=/etc/jaas.conf

Restart/retest the example.

Thanks, Hrushi

Hrushi
  • 163
  • 1
  • 10