[Osaka/Yokohama] Looking for infrastructure/server side engineers!

[Osaka/Yokohama] Looking for infrastructure/server side engineers!

[Deployed by over 500 companies] AWS construction, operation, maintenance, and monitoring services

[Deployed by over 500 companies] AWS construction, operation, maintenance, and monitoring services

[Successor to CentOS] AlmaLinux OS server construction/migration service

[Successor to CentOS] AlmaLinux OS server construction/migration service

[For WordPress only] Cloud server “Web Speed”

[For WordPress only] Cloud server “Web Speed”

[Cheap] Website security automatic diagnosis “Quick Scanner”

[Cheap] Website security automatic diagnosis “Quick Scanner”

[Reservation system development] EDISONE customization development service

[Reservation system development] EDISONE customization development service

[Registration of 100 URLs is 0 yen] Website monitoring service “Appmill”

[Registration of 100 URLs is 0 yen] Website monitoring service “Appmill”

[Compatible with over 200 countries] Global eSIM “Beyond SIM”

[Compatible with over 200 countries] Global eSIM “Beyond SIM”

[If you are traveling, business trip, or stationed in China] Chinese SIM service “Choco SIM”

[If you are traveling, business trip, or stationed in China] Chinese SIM service “Choco SIM”

[Global exclusive service] Beyond's MSP in North America and China

[Global exclusive service] Beyond's MSP in North America and China

[YouTube] Beyond official channel “Biyomaru Channel”

[YouTube] Beyond official channel “Biyomaru Channel”

【Linux】SSHログイン時に出てくるカッコいいアレ(/etc/motd)

どうも、システムソリューション部のinusukiです。

最近、自作でアプリケーションサーバーを建てているのですが、なんか見た目カッコよくないので、変えたいと思いました。

ゆるくいきます。

/etc/motd

このファイルに書かれている内容をユーザがログインに成功した際にsshdがCLI上に出力します。

ちなみに"motd"はMessage Of The Day の略です。

さっそくやってみる

これをこうします。

[vagrant@ichiki_qa ~]# sudo vi /etc/motd

"bowwow(You’re back.)"

セッションを閉じて再ログインします。

PS C:\Users\ichik\ichiki_qa> vagrant ssh
"bowwow(You’re back.)"

[vagrant@ichiki_qa ~]$

良い感じです。

他にもいろいろやってみます。

[vagrant@ichiki_qa ~]# sudo vi /etc/motd

日本語吹き替え版
犬「ワン!(おかえり!)」

PS C:\Users\ichik\ichiki_qa> vagrant ssh
日本語吹き替え版
犬「ワン!(おかえり!)」

[vagrant@ichiki_qa ~]$

カッコいいやつもやりましたが、ブログ上だと崩れるので画像でいきます。

ちょっとだけ真面目に

これだけ主張がつよいと作業環境も間違えそうにないですね。

まあ都度IPベースで確認することに越したことないですが、職業柄不安になってしまうので、こういうのもアリかなぁと思ったり。

 

ちなみに、/etc/motd 自体にコマンドやスクリプトを埋め込み実行するということはできないです。

(ただ、ディストリビューションによってはデフォルトで/etc/update-motd.dというディレクトリが存在し、

その配下に自作のスクリプトを設置することで動的なメッセージを生成できるので、比較的簡単そうです)

なので、「どうしても/etc/motdの内容を動的に生成したいんだ、俺は!」って場合は、cronで/etc/motd をオーバーライドするようなスクリプトを回すか、そういったツールを使うしかなさそうですね。

 

ターミナルの見た目をカスタマイズしたり、CLIで遊んだりできるパッケージもあるので面白いです。

よかったらこちらの関連記事も読んでくださいますとうれしく思います。

【Linux】(業務では使わないけど)楽しいパッケージたち

ご閲覧ありがとうございました。

 

この記事がお役に立てば【 いいね 】のご協力をお願いいたします!
13
読み込み中...
13 票, 平均: 1.00 / 113
2,740
X facebook はてなブックマーク pocket
[2024.6.30 CentOS support ended] CentOS server migration solution

[2024.6.30 CentOS support ended] CentOS server migration solution

[2025.6.30 Amazon Linux 2 support ended] Amazon Linux server migration solution

[2025.6.30 Amazon Linux 2 support ended] Amazon Linux server migration solution

[Osaka/Yokohama] Actively recruiting infrastructure engineers and server side engineers!

[Osaka/Yokohama] Actively recruiting infrastructure engineers and server side engineers!

The person who wrote this article

About the author

inusuki

Joined Beyond as a new graduate in April 2021.
Maybe it's because I have a problem with my output, but sometimes I say strange things.