sudo timestamp_type ppidとtty

sudo timestamp_type ppidとtty

次の内容を含むa.shスクリプトがあるとします。

#!/bin/sh
sudo ls <some_unprivileged_path>

実行するとSudo命令して実行する禁煙健康増進協会「sudo」の直後にパスワードを聞かないでください。「タイムスタンプ_タイムアウト。」

私はこれを避けようとしていますが、これまでにいくつかの設定を試して、それを防ぐために変更しました。タイムスタンプの種類到着PPID

"man sudoers" 関連部分:

ppid    A single time stamp record is used for all processes with the same parent process ID (usually the shell).  Commands run from the same shell (or other common parent process)
                               will not require a password for timestamp_timeout minutes (5 by default).  Commands run via sudo with a different parent process ID, for example from a shell script, will be
                               authenticated separately.


tty     One time stamp record is used for each terminal, which means that a user's login sessions are authenticated separately.  If no terminal is present, the behavior is the same as
                               ppid.  Commands run from the same terminal will not require a password for timestamp_timeout minutes (5 by default).

コマンドを実行するためにシェルがフォークするので、デフォルトのコマンドよりも安全なようです。しかし、わかりません。デフォルトではなくppidを使用するとセキュリティ上の問題はありますか?

(より多くのセキュリティツールや習慣があることを知っていますが、「sudo」とUnixのいくつかの概念についてもっと理解しようとしています。)

ベストアンサー1

おすすめ記事