• 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
    
  • 相关阅读:
    linux基础-第十八单元_nginx部署
    centos7 启动docker失败--selinux-enabled=false
    crontab 写入文件目录
    kvm : Permission denied
    使用spice连接kvm guest主机
    python中bottle模块的使用
    如何监控开源 Apache Kafka?
    Spring Quartz
    【问题排查】kafka0.10.x过期数据不会自动删除问题
    Apache Kafka监控之Kafka Web Console
  • 原文地址:https://www.cnblogs.com/raybiolee/p/5873891.html
Copyright © 2020-2023  润新知