---
# System prepended metadata

title: 'Note: Make Linux OS print customized message after login'
tags: [linux, configuration, note]

---

Note: Make Linux OS print customized message after login
=================================================================================

Overview:
---------------------------------------------------------------------------------
Linux base OS下, 不論是純文字介面(terminal)或是ssh遠端登入, 成功登入後皆會顯示一段文字訊息, 如下圖:
![image](https://hackmd.io/_uploads/SyRFeUjpA.png)

看著久了挺惱人的, 某日想著能否刪除訊息時, 就產生**能否自定義?**, 這樣的想法了

Login-message files & file structure
---------------------------------------------------------------------------------
關於登入成功後, 會顯示哪些內容, 是由motd (Message of the Day)這支程序所控制, 相關config files位於以下路徑:
`/etc/update-motd.d/`
![image](https://hackmd.io/_uploads/r1uGu8E2R.png)

像是圖片中的OS版本/kernel版本:
![image](https://hackmd.io/_uploads/r1sZmLs6C.png)
就是透過執行`00-header`所產生:
![image](https://hackmd.io/_uploads/HkIOaD1cC.png)
所以做法也很簡單; 在`/etc/update-motd.d/`下新增一檔案`banner.conf`, 將想要顯示的訊息寫入後, `00-header`新增一行`cat /etc/update-motd.d/banner.conf`
![image](https://hackmd.io/_uploads/rJ756vJ9A.png)

Resualt
---------------------------------------------------------------------------------
成果如下：
![S__8978434](https://hackmd.io/_uploads/HkOTEKl9R.gif)

Ref.
---------------------------------------------------------------------------------
[Create welcome banner on ubuntu](https://blog.niclin.tw/2019/08/08/ubuntu-welcome-banner/)
[Add loggin-message](https://linuxkvm.blogspot.com/2011/07/ubuntu-server.html)
[about motd.d](https://untitled.pw/software/linux/2337.html)