Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

Auth cancel

Help
ausperger
2007-11-30
2013-05-28
  • ausperger
    ausperger
    2007-11-30

    Hello, I need help. I have connected to my sftp server but to another not. I need to connect to the 'another' server. The connect method throws "Auth cancel" but when I try sftp console command line where I use only user name and password (sftp user@server:/path), the connection is ok. Where is an error? Where can I find some proper examples or how can I try out if the 'another' server supports all requirements for jsch connection?

    Thank you.

    I have this code:

    session = jsch.getSession(user[0], url.getHost(), 22);
    session.setUserInfo(new URLUserInfo("someuser"));
    session.connect();

    public static class URLUserInfo implements UserInfo, UIKeyboardInteractive {
            private String password;
            public URLUserInfo(String password) {
                this.password = password;
            }
            public String getPassword() {            return null;    }
            public boolean promptYesNo(String str) {    return true;    }
            public String getPassphrase() {            return null    }
            public boolean promptPassphrase(String message) {    return true;    }
            public boolean promptPassword(String message) {    return true;    }
            public void showMessage(String message) {}
            public String[] promptKeyboardInteractive(String destination, String name, String instruction, String[] prompt, boolean[] echo) {
                return new String[] { password };
            }
        }