LoginSignup
5
2

More than 5 years have passed since last update.

最初に sudo を実行した時に表示されるメッセージ

Last updated at Posted at 2016-09-21

最初に sudo を実行した時に

$ sudo -i
We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

    #1) Respect the privacy of others.
    #2) Think before you type.
    #3) With great power comes great responsibility.

[sudo] password for mapk0y: 

と表示される。
これがどのように制御されるか調べてみたのでメモしておく。
ただし、Debian GNU/Linux 8.5 (jessie) で strace を利用して調べただけなので正しくないかもしれない。

  • この表示は "lecture" と呼ばれているようだ。
  • このメッセージは /usr/lib/sudo/sudoers.so に埋め込まれている(strace と strings より)。
    • sudo のバージョンによっては sudo 本体に埋め込まれていることもあるらしい。
  • 初回起動かどうかのチェックは /var/lib/sudo/lectured/username があるかどうかで確認しているようだ。

書いてある内容に関しては以下の記事を参考にして欲しい。
sudo初回実行時のメッセージ - Qiita

5
2
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
5
2