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?

2 Answers 2


Yes you can, add the Match User directive to your sshd_config file like so:

Match User root 
    PrintlastLog no
    PrintMotd no

The Match directive also works for Group and Address to match for GEOS/Unix group and IP Address retrospectively.


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 use login(1) such as telnet and screen sessions.

Update 2:

To surpress the Banner output from sshd on a per session basis use ssh -q <host>or include LogLevel quiet in your ~/.ssh/config

Update 3:

Match - takes one or more criteria-pattern pairs; User, Group, Host, LocalAddress, LocalPort, RDomain, and Address. Or the single token All which matches all criteria.

PrintLastLog - sshd(8) should print the date and time of the last user login

PrintMotd - Specifies whether sshd(8) should print /etc/motd when a user logs in interactively.

Non-standard SSH daemons like dropbear(8) may die with advance configurations like Match statements.

  • OP said he cannot modify /etc/ssh/sshd_config Commented Jan 21, 2014 at 8:48
  • Thanks @MariusMatutiae for pointing that out. I've updated my answer to account for that. Commented Jan 21, 2014 at 23:50
  • 7
    ~/.hushlogin suppressed the motd and last login messages. :D Bonus points if you can disable the banner as defined by Banner /etc/issue in /etc/ssh/sshd_config.
    – Alexander
    Commented Jan 22, 2014 at 15:19
  • 1
    Thanks @XAleXOwnZX I completely forgot about that. I've updated the answer to include the Banner suppression. Commented Jan 22, 2014 at 23:07
  • Those Match directives (i.e. Print*) caused my sshd service to fail restart. Even the man page for sshd_config specifies only certain directives work under Match, and neither of those are listed.
    – Josh C
    Commented May 4 at 5:55

Not all OpenSSH implementations as those in Ubuntu allow PrintMotd or PrintlastLog in Match User section.

One may find this askubuntu question usefull with some workaround if s/he got error like:

/etc/ssh/sshd_config line 97: Directive 'PrintMotd' is not allowed within a Match block

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .