바이너리에 사용자 ID가 설정되어 있는지 확인하는 방법은 무엇입니까? [폐쇄]

바이너리에 사용자 ID가 설정되어 있는지 확인하는 방법은 무엇입니까? [폐쇄]

Linux에서 바이너리에 set-user-ID가 있는지 확인하는 방법은 무엇입니까?

나는 그것을 사용할 수 있습니까 ls -l?

답변1

실행하면 ls -l다음과 같은 결과를 얻을 수 있습니다:

-rwSr--r--   1 user user    8111573 Sep 26  2012 net-snmp.tar

여기서 S(도 가능 s)은 파일에 SUID 비트가 설정되어 있음을 나타냅니다.

S실행 플래그를 설정하지 않은 경우 설정

s실행 플래그를 설정할 때 설정됩니다.

답변2

파일을 수동으로 보거나 ls -l filename사용할 수 있는 스크립트를 통해 봅니다.

[ -u filename ] && echo SUID-bit is set

또한보십시오 man bash:

   -u file
          True  if  file  exists  and its set-user-id bit is set.

또한보십시오 info ls:

 The file mode bits listed are similar to symbolic mode
 specifications (*note Symbolic Modes::).  But ‘ls’ combines
 multiple bits into the third character of each set of permissions
 as follows:

 ‘s’
      If the set-user-ID or set-group-ID bit and the corresponding
      executable bit are both set.

 ‘S’
      If the set-user-ID or set-group-ID bit is set but the
      corresponding executable bit is not set.

관련 정보