"If I configure it via
Banner
…" –Banner
is shown before authentication; the client chooses a subsystem after successful authentication. Once the client requests sftp
subsystem, it expects messages following the SFTP protocol. You can inject a message (e.g. Subsystem sftp cat /etc/motd; /usr/lib/sftp-server
in sshd_config
), but this will break the protocol and the client will fail. My tests indicate that printing to stderr (cat >&2 …
) doesn't break the protocol, but the message doesn't get to the client either. I think there is no solution, but I'm waiting to be surprised.