sudo timestamp_type ppid 대 tty

sudo timestamp_type ppid 대 tty

아래 내용이 포함된 a.sh 스크립트가 있다고 가정합니다.

#!/bin/sh
sudo ls <some_unprivileged_path>

내가 실행하면sudo명령하고 실행하다금연 건강 증진 협회그 'sudo' 직후에는 비밀번호를 묻지 마세요."timestamp_timeout."

이 상황을 방지하려고 노력하고 있으며 지금까지 몇 가지 구성을 시도했으며 변경하여 이 문제를 방지했습니다.타임스탬프_유형에게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'와 유닉스의 일부 개념을 조금 더 이해하려고 노력하고 있습니다.)

관련 정보