No MOTD
I was asked today about how to stop SSH logins from printing the MOTD. This is a common issue when you are running scripts and cron e-mails you the output of the MOTD all the time. Just a little bit annoying! Instead of throwing all the data away you can instead suppress the login MOTD by simply:
touch ~/.hushlogin
In remote user’s directory. Simple!
There is also the SSH banner which doesn’t get silenced by this method, the trick to get around this is by using:
ssh -q user@server command
This isn’t ideal as it suppresses possible warnings and diagnostic information as well but it is a good workaround. Thanks to FluKex for that!
To remove the MOTD/banner all together from SSH you can edit your sshd_config and alter the line for the MOTD to no, like so:
#Banner none PrintMotd no
Just to say a little more about hushlogin, the file and its naming choice is controlled by the /etc/login.defs file. So if you are a system administrator you could modify the naming of this file or indeed its placement. Secondly as an administrator you may wish to ensure that users don’t have this ability. The trick here is to alter the login.defs file and make the HUSHLOGIN_FILE a full pathname. Then the contents of this file will be those users that have their MOTD suppressed.