小编use*_*685的帖子

net.schmizz.sshj.userauth.UserAuthException:耗尽的可用身份验证方法

第一次询问stackoverflow,还使用sshj.除了sshj提供的示例之外,我还没有找到任何帮助使用此API的好资源.

我一直在尝试使用sshj进行远程端口转发,并遇到了这个错误.

Exception in thread "main" net.schmizz.sshj.userauth.UserAuthException: Exhausted available authentication methods
Run Code Online (Sandbox Code Playgroud)

我用VM测试了auth,但没有使用公钥.我将使用它连接到我知道登录的EC2实例.

public void startRemotePortForwardingConnection(LocalPortForwarder.Parameters parameters) throws IOException{
    sshClient.connect(parameters.getLocalHost());
    this.connectionStatus = CONNECTED;
    System.out.print("Connected to localhost" + NEWLINE);

    try {
        sshClient.authPassword(this.username, this.password);
        System.out.print("Authorized with as user " + username + " with password " + password + NEWLINE);

        // the local port we should be listening on
        RemotePortForwarder.Forward localPortToListenOn = new RemotePortForwarder.Forward(parameters.getLocalPort());
        System.out.print("localPortToListenOn initialized" + NEWLINE);

        // where we should forward the packets
        InetSocketAddress socketAddress = new InetSocketAddress(parameters.getRemoteHost(), parameters.getRemotePort());
        SocketForwardingConnectListener remotePortToForwardTo …
Run Code Online (Sandbox Code Playgroud)

ssh portforwarding sshj

5
推荐指数
1
解决办法
5870
查看次数

标签 统计

portforwarding ×1

ssh ×1

sshj ×1