apache/seatunnel · error · ClickhouseConnectorException

ssh host " + host + "authentication failed

Error message

ssh host " + host + "authentication failed

What it means

RsyncFileTransfer.init opens an SSH client session (Apache MINA SSHD) and authenticates with either a password or an SSH-RSA key pair loaded from keyPath. If auth().verify() reports not success, it throws SSH_OPERATION_FAILED with "ssh host <host>authentication failed".

Source

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

    @Override
    public void init() {
        try {
            sshClient = SshClient.setUpDefaultClient();
            sshClient.start();
            clientSession = sshClient.connect(user, host, SSH_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");
            }
        } 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 {
            String sshParameter =
                    password != null
                            ? String.format(
                                    "'sshpass -p %s ssh -o StrictHostKeyChecking=no -p %s'",

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Verify the SSH password is correct for the configured user, or confirm the key at keyPath is authorized in the target's ~/.ssh/authorized_keys
  2. Test manually: `ssh <user>@<host>` (and `ssh -i <keyPath>` for key auth) to reproduce the failure outside SeaTunnel
  3. If the server rejects ssh-rsa, switch to password auth or add an RSA key accepted by the server (only SSH_RSA is loaded)
  4. Confirm the username is correct and not locked

Example fix

// before (key not authorized on host)
file_fields_use_node_address with key_path = "/home/user/id_ed25519"
// after
use password auth, or place an RSA key at key_path and add its public part to the remote authorized_keys
Defensive patterns

Strategy: validation

Validate before calling

Process p = Runtime.getRuntime().exec(new String[]{"ssh", "-o", "BatchMode=yes", "-i", keyPath, user + "@" + host, "true"});
if (p.waitFor() != 0) throw new IllegalStateException("SSH auth will fail for " + user + "@" + host);

Try / catch

try {
    transfer.init();
} catch (ClickhouseConnectorException e) {
    if (e.getMessage() != null && e.getMessage().contains("authentication failed")) {
        // rotate credentials / re-authorize the key on the target host
    }
}

Prevention

When it happens

Trigger: init with wrong password for the user; key-based auth where keyPath points to a key not authorized on the remote host; only SSH_RSA key type is attempted so newer ed25519-only keys fail; user lacks SSH access.

Common situations: Public key not added to the ClickHouse node's authorized_keys; key passphrase-protected and unsupported here; server disabled ssh-rsa (RSA/SHA-1 deprecation in newer OpenSSH); wrong username.

Understand the failure class

Related errors


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