zoukankan      html  css  js  c++  java
  • 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
    
  • 相关阅读:
    【BZOJ3309】DZY Loves Math(莫比乌斯反演)
    【CF666E】Forensic Examination(后缀自动机,线段树合并)
    【HDU5730】Shell Necklace(多项式运算,分治FFT)
    【洛谷4389】付公主的背包(生成函数,多项式运算)
    【CF528D】Fuzzy Search(FFT)
    【BZOJ4259】残缺的字符串(FFT)
    【BZOJ4503】两个串(FFT)
    【CF954I】Yet Another String Matching Problem(FFT)
    Java中泛型Class<T>、T与Class<?>、 Object类和Class类、 object.getClass()和Object.class
    H5和原生APP之间的区别
  • 原文地址:https://www.cnblogs.com/raybiolee/p/5873891.html
Copyright © 2011-2022 走看看