apache/seatunnel · critical · ClickhouseConnectorException

ssh host " + host + "authentication failed

Error message

ssh host " + host + "authentication failed

What it means

ScpFileTransfer.init() throws this when the SSH authentication result against the remote host is not successful. Credentials (password or key-based with SSH_RSA) were rejected by the SSH server. No file transfer can begin.

Source

Thrown at seatunnel-connectors-v2/connector-clickhouse/src/main/java/org/apache/seatunnel/connectors/seatunnel/clickhouse/sink/file/ScpFileTransfer.java:81

    @Override
    public void init() {
        try {
            sshClient = SshClient.setUpDefaultClient();
            sshClient.start();
            clientSession = sshClient.connect(user, host, SCP_PORT).verify().getSession();
            if (password != null) {
                clientSession.addPasswordIdentity(password);
            }
            if (keyPath != null) {
                FileKeyPairProvider fileKeyPairProvider =
                        new FileKeyPairProvider(Paths.get(keyPath));
                KeyPair fileKeyPair =
                        fileKeyPairProvider.loadKey(clientSession, KeyPairProvider.SSH_RSA);
                clientSession.addPublicKeyIdentity(fileKeyPair);
            }
            if (!clientSession.auth().verify().isSuccess()) {
                throw new ClickhouseConnectorException(
                        ClickhouseConnectorErrorCode.SSH_OPERATION_FAILED,
                        "ssh host " + host + "authentication failed");
            }
            scpClient = ScpClientCreator.instance().createScpClient(clientSession);
        } catch (IOException | GeneralSecurityException e) {
            throw new ClickhouseConnectorException(
                    ClickhouseConnectorErrorCode.SSH_OPERATION_FAILED,
                    "Failed to connect to host: " + host + " by user: " + user + " on port 22",
                    e);
        }
    }

    @Override
    public void transferAndChown(String sourcePath, String targetPath) {
        try {
            scpClient.upload(
                    sourcePath,
                    targetPath,

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Verify username/password (or keyPath) in the ClickHouse sink config are correct
  2. Test the same credentials manually: ssh user@host — confirm they succeed
  3. If using key auth, confirm the key is authorized in the host's ~/.ssh/authorized_keys and readable by the SeaTunnel process
  4. If the server rejects ssh-rsa (OpenSSH 8.8+), enable rsa-sha2 or use an ed25519 key supported by your sshd-client version
  5. Check the server's sshd_config / auth log for why the auth method was refused

Example fix

// before
password = "wrong-pass"
// after: correct credential or authorized key path
username = "deploy"
password = "<correct-password>"
# or
key.path = "/home/user/.ssh/id_rsa"
Defensive patterns

Strategy: validation

Validate before calling

# validate credentials before running the job
ssh -o BatchMode=yes -i "$KEY_PATH" "$USER@$HOST" true && echo auth-ok
# or with password: sshpass -p "$PASSWORD" ssh -o StrictHostKeyChecking=no "$USER@$HOST" true

Try / catch

try {
    transfer.init();
} catch (ClickhouseConnectorException e) {
    if (String.valueOf(e.getMessage()).contains("authentication failed")) {
        throw new RuntimeException("Check sink SSH username/password/keyPath config", e);
    }
    throw e;
}

Prevention

When it happens

Trigger: init() calls clientSession.auth().verify() and isSuccess() is false — wrong password, rejected/wrong key file, or the server disallows the auth method tried (e.g. only keyboard-interactive allowed, or server disabled ssh-rsa).

Common situations: Wrong username/password in config, key at `keyPath` is not the key authorized on the host, key is in a newer OpenSSH format while the server/SSH-RSA negotiation fails (OpenSSH 8.8+ disabling ssh-rsa SHA-1), or server-side restrictions (AllowUsers, PermitRootLogin no).

Understand the failure class

Related errors


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/f2b17b2a82cd64d1. Report an issue: GitHub.