top of page

Posts

You Can Modify the Message When You do SSH Login




Did you know that you can change the message you see when you do ssh connect?


/etc/motd

The contents of the /etc/motd file are output by sshd on the CLI when a user successfully logs in.


FYI, “motd” stands for “Message Of The Day”.


Let’s try

[vagrant@ichiki_qa ~]# sudo vi /etc/motd
 
"bow wow(Welcome back.)"

Close the session and log in again.

S C:\Users\ichik\ichiki_qa> vagrant ssh
"bow wow(Welcome back)"
 
[vagrant@ichiki_qa ~]$

The output looks nice.


I’m going to try other things

[vagrant@ichiki_qa ~]# sudo vi /etc/motd
 
Japanese version
犬「ワン!(おかえり!)」
PS C:\Users\ichik\ichiki_qa> vagrant ssh
Japanese version
犬「ワン!(おかえり!)」
 
[vagrant@ichiki_qa ~]$

I did a cool one too and it came out like the screenshot below.



Usage

If you customize the message for each environment, it’ll be helpful to prevent mixing up with other environments if you have multiple projects other than confirming by IP address.


Note that you cannot embed commands or scripts in /etc/motd itself.

*However, some distributions have a directory /etc/update-motd.d by default, where you can place your own scripts to generate dynamic messages, which seems to be relatively easy.


There are packages that you can play around with CLI, you can check our article if you are interested.





This blog post is translated from a blog post written by Tomoki Takeuchi on our Japanese website Beyond Co..

Comentários


bottom of page