转载

设置 ssh 登录服务器时的提示文字

issue.net & motd

新开了阿里云的机器之后机器 ssh 过去的默认提示是:

Welcome to Ubuntu 14.04.4 LTS (GNU/Linux 3.13.0-86-generic x86_64)   * Documentation:  https://help.ubuntu.com/  Welcome to aliyun Elastic Compute Service!

可以加一些内容。一共两个与之相关:

  • issue.net : Display a banner message before the password login prompt.

  • motd : Display a banner message after the user has logged in.

设置 issue.net

在下面文件中添加想要添加的内容

# vim /etc/issue.net

在 Text to ASCII Art Generator (TAAG) 上面生成了 ASCII Art。

Ubuntu 14.04.4 LTS    ______ _____  _____   |  ____/ ____|/ ____|  | |__ | |    | (___    |  __|| |     /___ /   | |___| |____ ____) |  |______/_____|_____/

改 config

# vim /etc/ssh/sshd_config

搜索 Banner 并取消掉它的注释

#Banner /some/path

需要 reload ssh

# service ssh reload

motd

Message of the Day 的意思,内容放在 /etc/motd ,另外还可以用 UpdateMotd 动态生成的内容,参考 UpdateMotd 。

这里先不深究,而是直接 apt-get install landscape-common 。landscape-common 会显示一些机器的信息。

Welcome to Ubuntu 16.04 LTS (GNU/Linux 4.4.0-28-generic x86_64)   * Documentation:  https://help.ubuntu.com  * Management:     https://landscape.canonical.com  * Support:        https://ubuntu.com/advantage    System information as of Tue Jul 12 10:21:51 MDT 2016    System load:  0.09                Users logged in:        1   Usage of /:   12.3% of 225.17GB   IP address for enp7s0:  192.168.X.XXX   Memory usage: 45%                 IP address for wlp9s1:  192.168.X.XXX   Swap usage:   0%                  IP address for docker0: 172.17.0.1   Processes:    397    Graph this data and manage this system at:     https://landscape.canonical.com/  0 packages can be updated. 0 updates are security updates.  Last login: Tue Jul 12 10:03:16 2016 from 192.168.X.XXX

参考

  • Protect SSH Logins with SSH & MOTD Banner Messages

  • login - Modify the SSH welcome message to include system IP address - Ask Ubuntu

原文  https://segmentfault.com/a/1190000006025060
正文到此结束
Loading...