Skip to main content

SSH Disconnect & Channel Codes

SSH defines two sets of numeric reason codes: disconnect codes (RFC 4253 §11.1) sent in SSH_MSG_DISCONNECT, and channel open failure codes (RFC 4254 §5.1) sent in SSH_MSG_CHANNEL_OPEN_FAILURE.

Disconnect Reason Codes

Sent in SSH_MSG_DISCONNECT to terminate the connection. Codes 1-15 defined in RFC 4253 §11.1.

CodeConstant & DescriptionRFC
1

SSH_DISCONNECT_HOST_NOT_ALLOWED_TO_CONNECT

SSH_DISCONNECT_HOST_NOT_ALLOWED_TO_CONNECT (1) is sent when the server refuses the connection because the client host is not permitted to connect.

RFC 4253
2

SSH_DISCONNECT_PROTOCOL_ERROR

SSH_DISCONNECT_PROTOCOL_ERROR (2) is sent when an SSH protocol violation is detected.

RFC 4253
3

SSH_DISCONNECT_KEY_EXCHANGE_FAILED

SSH_DISCONNECT_KEY_EXCHANGE_FAILED (3) is sent when the SSH key exchange (KEX) negotiation fails.

RFC 4253
4

SSH_DISCONNECT_RESERVED

SSH_DISCONNECT_RESERVED (4) is a reserved disconnect code in RFC 4253 §11.

RFC 4253
5

SSH_DISCONNECT_MAC_ERROR

SSH_DISCONNECT_MAC_ERROR (5) is sent when an SSH packet's Message Authentication Code (MAC) does not verify.

RFC 4253
6

SSH_DISCONNECT_COMPRESSION_ERROR

SSH_DISCONNECT_COMPRESSION_ERROR (6) is sent when decompression of an SSH packet payload fails.

RFC 4253
7

SSH_DISCONNECT_SERVICE_NOT_AVAILABLE

SSH_DISCONNECT_SERVICE_NOT_AVAILABLE (7) is sent when the client requests an SSH service that the server does not support or has disabled.

RFC 4253
8

SSH_DISCONNECT_PROTOCOL_VERSION_NOT_SUPPORTED

SSH_DISCONNECT_PROTOCOL_VERSION_NOT_SUPPORTED (8) is sent when the server does not support the SSH protocol version offered by the client.

RFC 4253
9

SSH_DISCONNECT_HOST_KEY_NOT_VERIFIABLE

SSH_DISCONNECT_HOST_KEY_NOT_VERIFIABLE (9) is sent when the server's host key cannot be verified by the client.

RFC 4253
10

SSH_DISCONNECT_CONNECTION_LOST

SSH_DISCONNECT_CONNECTION_LOST (10) indicates the SSH connection was lost unexpectedly.

RFC 4253
11

SSH_DISCONNECT_BY_APPLICATION

SSH_DISCONNECT_BY_APPLICATION (11) is the clean, normal disconnect code sent when an application terminates the SSH session intentionally.

RFC 4253
12

SSH_DISCONNECT_TOO_MANY_CONNECTIONS

SSH_DISCONNECT_TOO_MANY_CONNECTIONS (12) is sent by the server when it has reached its maximum concurrent connection limit.

RFC 4253
13

SSH_DISCONNECT_AUTH_CANCELLED_BY_USER

SSH_DISCONNECT_AUTH_CANCELLED_BY_USER (13) is sent when the user explicitly cancels an in-progress authentication attempt.

RFC 4253
14

SSH_DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE

SSH_DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE (14) is sent when all available authentication methods have been exhausted without success.

RFC 4253
15

SSH_DISCONNECT_ILLEGAL_USER_NAME

SSH_DISCONNECT_ILLEGAL_USER_NAME (15) is sent when the username provided by the client is syntactically invalid.

RFC 4253

Channel Open Failure Codes

Sent in SSH_MSG_CHANNEL_OPEN_FAILURE when a channel request is rejected. Codes 1-4 defined in RFC 4254 §5.1.