{"record":{"id":"4a3ac52a83e3dc6c","repo":"apache/seatunnel","slug":"ssh-host-host-authentication-failed","errorCode":null,"errorMessage":"ssh host \" + host + \"authentication failed","messagePattern":"ssh host \" \\+ host \\+ \"authentication failed","errorType":"exception","errorClass":"ClickhouseConnectorException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-clickhouse/src/main/java/org/apache/seatunnel/connectors/seatunnel/clickhouse/sink/file/RsyncFileTransfer.java","lineNumber":81,"sourceCode":"\n    @Override\n    public void init() {\n        try {\n            sshClient = SshClient.setUpDefaultClient();\n            sshClient.start();\n            clientSession = sshClient.connect(user, host, SSH_PORT).verify().getSession();\n            if (password != null) {\n                clientSession.addPasswordIdentity(password);\n            }\n            if (keyPath != null) {\n                FileKeyPairProvider fileKeyPairProvider =\n                        new FileKeyPairProvider(Paths.get(keyPath));\n                KeyPair fileKeyPair =\n                        fileKeyPairProvider.loadKey(clientSession, KeyPairProvider.SSH_RSA);\n                clientSession.addPublicKeyIdentity(fileKeyPair);\n            }\n            if (!clientSession.auth().verify().isSuccess()) {\n                throw new ClickhouseConnectorException(\n                        ClickhouseConnectorErrorCode.SSH_OPERATION_FAILED,\n                        \"ssh host \" + host + \"authentication failed\");\n            }\n        } catch (IOException | GeneralSecurityException e) {\n            throw new ClickhouseConnectorException(\n                    ClickhouseConnectorErrorCode.SSH_OPERATION_FAILED,\n                    \"Failed to connect to host: \" + host + \" by user: \" + user + \" on port 22\",\n                    e);\n        }\n    }\n\n    @Override\n    public void transferAndChown(String sourcePath, String targetPath) {\n        try {\n            String sshParameter =\n                    password != null\n                            ? String.format(\n                                    \"'sshpass -p %s ssh -o StrictHostKeyChecking=no -p %s'\",","sourceCodeStart":63,"sourceCodeEnd":99,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-clickhouse/src/main/java/org/apache/seatunnel/connectors/seatunnel/clickhouse/sink/file/RsyncFileTransfer.java#L63-L99","documentation":"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\".","triggerScenarios":"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.","commonSituations":"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.","solutions":["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","Test manually: `ssh <user>@<host>` (and `ssh -i <keyPath>` for key auth) to reproduce the failure outside SeaTunnel","If the server rejects ssh-rsa, switch to password auth or add an RSA key accepted by the server (only SSH_RSA is loaded)","Confirm the username is correct and not locked"],"exampleFix":"// before (key not authorized on host)\nfile_fields_use_node_address with key_path = \"/home/user/id_ed25519\"\n// after\nuse password auth, or place an RSA key at key_path and add its public part to the remote authorized_keys","handlingStrategy":"validation","validationCode":"Process p = Runtime.getRuntime().exec(new String[]{\"ssh\", \"-o\", \"BatchMode=yes\", \"-i\", keyPath, user + \"@\" + host, \"true\"});\nif (p.waitFor() != 0) throw new IllegalStateException(\"SSH auth will fail for \" + user + \"@\" + host);","typeGuard":null,"tryCatchPattern":"try {\n    transfer.init();\n} catch (ClickhouseConnectorException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"authentication failed\")) {\n        // rotate credentials / re-authorize the key on the target host\n    }\n}","preventionTips":["Add the worker's public key to each ClickHouse node's authorized_keys when using key auth","Pre-verify credentials with a manual ssh command","Remember only SSH_RSA keys are loaded; avoid ed25519-only setups"],"tags":["ssh","authentication","clickhouse"],"backgroundTag":"authentication-required","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}