ssh Exit Values

Exit values are provided to assist in troubleshooting. In scripts we recommend that you use only zero or non-zero for error handling. Looking for specific non-zero values is not reliable because of variability caused by operating systems and servers.

Error codes are limited to values 0-255. Errors 65-79 are disconnect conditions, calculated as 64 + error value returned from host, as defined in RFC4253. Errors values 128-254 are system Signals, calculated as 128 + Signal value. Error value 255 is returned when ssh fails after being executed by another process, such as scp.

0 Success.

1 Generic error.

2 Remote host connection failure.

65 Access denied by host for this client address.

66 Protocol error.

67 Key exchange failed.

68 Authentication failed.

69 MAC error.

70 Compression error.

71 Service not available.

72 Protocol version not supported.

73 Host key not verifiable.

74 Connection lost.

75 Disconnected by application.

76 Too many connections.

77 Cancelled by user.

78 No more authentication methods available.

79 Unknown user name.