30

How can I disable/modify the SSH login banner for a given user?

enter image description here

3
  • I think it is located at /etc/motd. Try editing that file and see Mar 31, 2011 at 9:33
  • I did edit it but the changes are always overwritten by this default message. Mar 31, 2011 at 9:36
  • ubuntugeek.com/… says there is /etc/motd.tail file you should edit for ubuntu server. Mar 31, 2011 at 9:40

5 Answers 5

54

It seems it is possible to disable this message on a user basis by creating an empty file in a user's $HOME directory (/home/username/) called .hushlogin.

touch ~/.hushlogin
2
  • Might be worth mentioning that this is performed on the system that sends the banner. Not the one that receives it. Feb 15, 2022 at 22:53
  • This does not override a /etc/ssh/sshd_config Banner Apr 25, 2022 at 16:09
21

If you want to disable that message for all ssh users, edit /etc/pam.d/sshd and comment out the lines

session    optional     pam_motd.so  motd=/run/motd.dynamic noupdate
session    optional     pam_motd.so # [1]
1
  • Works on ubuntu 14.04
    – max
    Oct 1, 2015 at 15:05
13

In /etc/ssh/sshd_config make sure there is a line:

PrintMotd no

If it is set to 'yes' change it to 'no'.

Restart the SSH server by typing

service ssh restart

You should be good to go from there.

5
  • +1 Your solution is great because it keeps Last login but hides the rest.
    – Nahydrin
    May 30, 2014 at 19:31
  • 2
    Doesn't seem to work. At least not in 14.04. Mine was already set "no" and yet the welcome greeting was still showing. What helped was updating /etc/pam.d/sshd. Jun 5, 2015 at 15:24
  • @cherio , I can confirm that the same worked for me. Using LTS 14.04
    – Ace
    Jun 8, 2015 at 19:30
  • No longer applies to 14.04, see @cweiske's answer as it does work for 14.04.
    – ecnepsnai
    Jan 21, 2016 at 20:14
  • Does not work on 16.04 Aug 24, 2017 at 20:28
4

It is also possible to disable banner using client-side only solution, that is by setting log level to error:

ssh -o LogLevel=Error <rest of cmd>

Found here: http://www.linuxquestions.org/questions/linux-security-4/how-do-you-turn-off-login-banner-for-non-interactive-ssh-470516/

1
  • This is the answer, if you don't have sudo access to turn off the Banner on the remote machine. Apr 25, 2022 at 16:12
3

.hushlogin didn't do the trick for me (on Debian 7), but setting Banner to /dev/null in /etc/ssh/sshd_config :

#Banner /etc/issue.net
Banner /dev/null

You must log in to answer this question.

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