[Linux] Cool thing that appears when logging in via SSH (/etc/motd)
table of contents
Hello, this is inusuki from the System Solutions Department.
Recently, I've been building an application server by myself, but it doesn't look very cool, so I wanted to change it.
I'll take it easy.
/etc/motd
sshd will output the contents written in this file to the CLI when the user successfully logs in.
By the way, "motd" is an abbreviation for Message Of The Day.
Let's try it now
Let's do this like this.
[vagrant@ichiki_qa ~]# sudo vi /etc/motd "bowwow(You're back.)"
Close your session and log in again.
PS C:\Users\ichik\ichiki_qa> vagrant ssh "bowwow(You're back.)" [vagrant@ichiki_qa ~]$
It feels good.
I'll try other things as well.
[vagrant@ichiki_qa ~]# sudo vi /etc/motd Japanese dubbed version Dog: “One! (Welcome back!)”
PS C:\Users\ichik\ichiki_qa> vagrant ssh Japanese dubbed version Dog "One! (Welcome back!)" [vagrant@ichiki_qa ~]$
I've done some cool ones, but they won't look good on the blog, so I'll use images instead.
Just a little bit seriously
With someone so assertive, it's hard to go wrong with the work environment.
Well, it would be better to check based on IP each time, but since my job makes me nervous, I thought something like this might be a good idea.
By the way, it is not possible to embed and execute commands or scripts in /etc/motd itself.
(However, depending on the distribution, a directory called /etc/update-motd.d exists by default,
You can generate dynamic messages by placing your own script under it, so it seems relatively easy.)
So, if you really want to dynamically generate the contents of /etc/motd, you have no choice but to run a script that overrides /etc/motd with cron or use such a tool. I agree.
There are also packages that allow you to customize the appearance of the terminal and play with the CLI, which is interesting.
I would appreciate it if you would also read this related article.
Thank you for viewing.