设置 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!

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

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

  2. 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

参考

  1. Protect SSH Logins with SSH & MOTD Banner Messages

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

关键字:ubuntu

版权声明

本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处。如若内容有涉嫌抄袭侵权/违法违规/事实不符,请点击 举报 进行投诉反馈!

立即
投稿

微信公众账号

微信扫一扫加关注

返回
顶部