設定 ssh 登入伺服器時的提示文字

常偉佳發表於2016-07-20

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

參考

相關文章