Introduction
Usually when you logged in you linux based PC remotely via SSH, a long banner will be displayed, including the os and kernel version of the PC, if new release is available, last login time, bashrc error and more. This helps when you are admin, but really annoying for normal users, and even sometimes admin himself.
➜ ~ ssh Xxxxx@xx.xxx.xxx.xx
Xxxxx@xx.xxx.xxx.xx's password:
Welcome to Ubuntu 14.04.5 LTS (GNU/Linux 3.13.0-96-generic x86_64)
* Documentation: https://help.ubuntu.com/
New release '16.04.1 LTS' available.
Run 'do-release-upgrade' to upgrade to it.
Last login: Wed Sep 14 20:58:27 2016 from 10.222.129.26
-bash: ./usr/local/software/ccp4/ccp4-6.5/bin/coot: No such file or directory
The banner is generated by scripts under /etc/update-motd.d/
. All are SHELL scripts.
Welcome to Ubuntu 14.04.5 LTS (GNU/Linux 3.13.0-96-generic x86_64)
# the line above is generated by /etc/update-motd.d/00-header
* Documentation: https://help.ubuntu.com/
# these lines are generated by /etc/update-motd.d/10-help-text
New release '16.04.1 LTS' available.
Run 'do-release-upgrade' to upgrade to it.
# those lines are generated by /etc/update-motd.d/91-release-upgrade,
# which executes /usr/lib/ubuntu-release-upgrader/release-upgrade-motd,
# which prints /var/lib/ubuntu-release-upgrader/release-upgrade-available [containing the release msg]
Last login: Wed Sep 14 20:58:27 2016 from 10.222.129.26
# the line is controlled by option `PrintLastLog` in `/etc/ssh/sshd_config`
# if `no' is given, the line will not be printed
# non-last lines are controlled by option `PrintMotd` in `/etc/ssh/sshd_config`
# if `no' is given, all the content in /var/run/motd.dynamic will not be printed
The /var/run/motd.dynamic
file contains
Welcome to Ubuntu 14.04.5 LTS (GNU/Linux 3.13.0-96-generic x86_64)
* Documentation: https://help.ubuntu.com/
New release '16.04.1 LTS' available.
Run 'do-release-upgrade' to upgrade to it.
customizing the banner
There is a option in /etc/ssh/sshd_config
named Banner
, which allows you to specify a file containing custom msg to display when users log in. By default, it is commented out as #Banner /etc/issue.net.
Banner /etc/motd.d/custom.banner
simple way to hide all
To hide all message after password prompt, just create a empty file named .hushlogin
in your $HOME
folder. Next Time you log in, nothing will be printed.
~ $ touch .hushlogin