I'm aware you can disable last-login and message-of-the-day messages when starting SSH sessions by having PrintLastLog no
and PrintMotd no
in /etc/ssh/sshd_config
.
However, I don't have permission to modify /etc/ssh/sshd_config
in the system I'm accessing. Is there a way to set PrintLastLog no
and PrintMotd no
for my local user only?
Best Answer
Yes you can, add the
Match User
directive to your sshd_config file like so:The
Match
directive also works forGroup
andAddress
to match for GEOS/Unix group and IP Address retrospectively.Update:
As a per user basis without access to the sshd_config then you would just create an empty file in
$HOME/.hushlogin
which would prevent bash in interactive mode to output these alerts. This also works under other systems that uselogin(1)
such as telnet and screen sessions.Update 2:
To surpress the
Banner
output from sshd on a per session basis usessh -q <host>
or includeLogLevel quiet
in your ~/.ssh/config