Hide SSH Welcome Banner/Message on Ubuntu14.04+

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

转载于:https://www.cnblogs.com/raybiolee/p/5873891.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值