![바이너리에 사용자 ID가 설정되어 있는지 확인하는 방법은 무엇입니까? [폐쇄]](https://linux55.com/image/5861/%EB%B0%94%EC%9D%B4%EB%84%88%EB%A6%AC%EC%97%90%20%EC%82%AC%EC%9A%A9%EC%9E%90%20ID%EA%B0%80%20%EC%84%A4%EC%A0%95%EB%90%98%EC%96%B4%20%EC%9E%88%EB%8A%94%EC%A7%80%20%ED%99%95%EC%9D%B8%ED%95%98%EB%8A%94%20%EB%B0%A9%EB%B2%95%EC%9D%80%20%EB%AC%B4%EC%97%87%EC%9E%85%EB%8B%88%EA%B9%8C%3F%20%5B%ED%8F%90%EC%87%84%5D.png)
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.