문제

제목에서 알 수 있듯이 Unix 계열 시스템은 SUID 비트에 의미를 부여합니까? 예배 규칙서, 그렇다면 그것은 무엇을 의미합니까?

SVTX(저장된 텍스트 또는 고정) 비트에는 의미가 있습니다. 파일에 쓸 수 없으면 이 디렉터리에서 파일을 삭제하지 마십시오.예를 들어 /tmp에서 사용됩니다.

SGID(set GID) 비트에는 의미가 있습니다. 이 디렉토리에 생성된 파일은 디렉토리를 소유하는 그룹에 속해야 합니다(해당 할당은 나중에 chown(2)에 대한 명시적인 호출로 변경될 수 있음).

SUID 비트는 어떻습니까?

도움이 되었습니까?

해결책

Node의 답변에 대한 후속 조치로 Mount (8)의 Freebsd Man 페이지에서 다음을 게시합니다.

             suiddir
                 A directory on the mounted file system will respond to
                 the SUID bit being set, by setting the owner of any new
                 files to be the same as the owner of the directory.  New
                 directories will inherit the bit from their parents.
                 Execute bits are removed from the file, and it will not
                 be given to root.

                 This feature is designed for use on fileservers serving
                 PC users via ftp, SAMBA, or netatalk.  It provides secu-
                 rity holes for shell users and as such should not be used
                 on shell machines, especially on home directories.  This
                 option requires the SUIDDIR option in the kernel to work.
                 Only UFS file systems support this option.  See chmod(2)
                 for more information.

그리고 CHMOD (2) MAN 페이지 섹션은 SUID 비트를 나타냅니다.

           4000    (the setuid bit).  Executable files with this bit set will
               run with effective uid set to the uid of the file owner.
               Directories with this bit set will force all files and sub-
               directories created in them to be owned by the directory
               owner and not by the uid of the creating process, if the
               underlying file system supports this feature: see chmod(2)
               and the suiddir option to mount(8).

이것이 보안 위험이라는 것을 알고 FreeBSD에서 활성화 할 때 수행하는 작업을 알고 있지만 Linux는 또한 특별한 마운트 플래그가 활성화되어야한다고 생각하며 해당 디렉토리의 파일이 작동하는 방식을 변경할 것입니다.

다른 팁

복사한 곳 여기:

대부분의 시스템에서 디렉토리의 set-group-ID 비트가 설정된 경우 새로 생성된 서브파일은 디렉토리와 동일한 그룹을 상속하고 새로 생성된 하위 디렉토리는 상위 디렉토리의 set-group-ID 비트를 상속합니다.일부 시스템에서는 디렉토리의 set-user-ID 비트가 새 하위 파일의 소유권과 새 하위 디렉토리의 set-user-ID 비트에 비슷한 영향을 미칩니다.이러한 메커니즘을 사용하면 chmod 또는 chown을 사용하여 새 파일을 공유할 필요성이 줄어들어 사용자가 파일을 더 쉽게 공유할 수 있습니다.

이러한 편의 메커니즘은 디렉토리의 set-user-ID 및 set-group-ID 비트에 의존합니다.chmod 및 mkdir과 ​​같은 명령이 디렉터리에서 이러한 비트를 정기적으로 지우면 메커니즘이 덜 편리해지고 파일을 공유하기가 더 어려워집니다.따라서 chmod와 같은 명령은 사용자가 기호 모드에서 구체적으로 언급하거나 숫자 모드에서 설정하지 않는 한 디렉토리의 set-user-ID 또는 set-group-ID 비트에 영향을 주지 않습니다.

디렉토리에 설정되면이 디렉토리 내에서 생성 된 모든 파일 및 디렉토리는 누가 파일을 만들 든 상관없이 Suid-Directory 자체와 동일한 소유자를 갖습니다. 이것은 너무 자주 사용되지 않는 기능이지만 경우에 따라 유용 할 수 있습니다. (원천)

업데이트 : 방금 Linux 2.6.25.5-1.1-Default #1 SMP X86_64 GNU/Linux OpenSuse 11.0 (x86-64)에서 이것을 시도했습니다.

mkdir tmp
chmod 4777 tmp
su othergroup
touch testfile

효과가 없었습니다.

SUID 비트는 파일을 실행할 때 (실행 가능한 경우) 프로세스가 해당 파일의 소유자의 ID에 따라 실행 된 사용자가 아니라 해당 파일의 소유자에 따라 실행된다고 명시하고 있습니다.

유틸리티 프로그램이 권한 에스컬레이션을 허용하기 위해 '루트 루트'인 경우가 몇 가지 있습니다.

편집 : 원본 질문을 잘못 읽습니다 (파일이 아닌 디렉토리를 참조) - 교육 목적으로 변경되지 않은 답변을 남기십시오 ;-)

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top