Secure Shell (SSH, SCP, and SFTP) Return Codes in UNIX

  • 7021956
  • 05-Feb-2010
  • 02-Mar-2018

Environment

Reflection for Secure IT UNIX Client version 7.0 or higher

Situation

This technical note lists the error or exit codes for Reflection command line utilities SSH, SCP, and SFTP in UNIX.

For a list of SSH, SCP, and SFTP return codes in Windows, see KB 7021996.

Resolution

Error Codes

The purpose of an error code is to describe the error occurring in a program; it may display on the command line or in a log or a trace file.

SSH Error Codes

0
Success
1
Generic error
2
Remote host connection failure

SCP/SFTP Error Codes

The numbering scheme of the SCP/SFTP error codes was derived by adding 64 to the RFC4253 error code, for example, 64 + 1 = 65.

Source: RFC4253 error code + 64

65
Host not allowed to connect
66
Protocol error
67
Key exchange failed
68
Host authentication failed
69
MAC error
70
Compression error (not used in SSH2)
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 auth methods available
79
Illegal user name

Exit Codes

You can display an exit code by typing echo $? after executing an SSH, SCP, or SFTP command.

Attachmate-defined SCP/SFTP Exit Codes

0
Success
1
Undetermined error in file copy
3
Destination is not directory, but it should be
4
Connecting to host failed
5
Connection lost for some reason
6
File does not exist
7
No permission to access file
8
Undetermined error from sshfilexfer
9
File transfer protocol mismatch
255
Error occurred in SSH

Additional Information

Legacy KB ID

This article was originally published as Attachmate Technical Note 2487.