Custom error message for sshd

By "error message" I believe you mean a text string being displayed by the client program. The word "message" has some context in the SSH authentication protocol RFC I'll reference later but I don't think that's the connotation you're using it in.

I believe you're thinking of SSH to be something like TELNET, where arbitrary text strings sent by the server daemon will be displayed by the client. SSH uses an authentication protocol that passes tokenized messages in the form of binary values back and forth between the client and server. One of these tokenized messages, "SSH_MSG_USERAUTH_BANNER", can be used to instruct the client to display arbitrary text strings (if it so chooses) but you'd have to modify your SSH daemon to send these at the appropriate time. I don't believe that OpenSSH has any built-in functionality to send SSH_MSG_USERAUTH_BANNER messages during arbitrary points in the authentication process.

I'd question why you'd want to give a remote attacker any additional information about why their authentication has failed. They know it's failed because their SSH client receives and reacts to the tokenized message from the SSH daemon signaling the failure.

Tags:

Unix

Ssh

Debian