0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

SSHログイン時のメッセージ表示を消したい&任意のメッセージを表示したい

Last updated at Posted at 2022-08-16

はじめに

RedHat8.4で構築したLinuxサーバにSSHログインした際、Web ConsoleやRedHat Insightのメッセージが表示された。これらをアンインストールすることなく表示を削除する。

表示内容はこんな感じ。

# ssh localhost
root@localhost's password: 
Web console: https://srv01:9090/ or https://192.168.0.2:9090/

This system is not registered to Red Hat Insights. See https://cloud.redhat.com/
To register this system, run: insights-client --register

Last login: Tue Aug 16 20:24:41 2022 from 192.168.0.1
[root@srv01 ~]#

motd.dファイルの動作

SSHログイン時にmotd.d配下のファイル内容が順番に表示される。
ファイルはシンボリックリンクになっていて、インストールしたアプリがお知らせを表示したいときに使用されているらしい。
アプリ側の構築状況によって表示を変えられる、というか変わっていたのでそのような使い方もできる。

[root@srv01 ~]# cd /etc/motd.d/
[root@srv01 motd.d]# ll
合計 0
lrwxrwxrwx. 1 root root 17  3月 12  2021 cockpit -> /run/cockpit/motd
lrwxrwxrwx. 1 root root 41  8月 16 14:41 insights-client -> /etc/insights-client/insights-client.motd
[root@srv01 motd.d]# cat cockpit 
Web console: https://lidvp010:9090/ or https://172.21.133.2:9090/

[root@srv01 motd.d]# cat insights-client 
This system is not registered to Red Hat Insights. See https://cloud.redhat.com/
To register this system, run: insights-client --register

motd.dファイルを削除

motd.d配下ファイルがSSHログイン時に表示されるため削除する。

[root@srv01 motd.d]# rm cockpit insights-client 
rm: シンボリックリンク 'cockpit' を削除しますか? y
rm: シンボリックリンク 'insights-client' を削除しますか? y

ファイル削除後にSSHログインすると何も表示されなくなった。

# ssh localhost
root@localhost's password: 
Last login: Tue Aug 16 21:49:47 2022 from 127.0.0.1
[root@srv01 ~]# 

まとめ

Linuxでお馴染みのSSHで、ログイン時のメッセージ表示を削除してみた。逆に任意のメッセージを表示することも容易なので便利に使いたい。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?