끼적거림

정보보안기사 제8회 실기 시험 리눅스 RUID,EUID 관련 문제 구현

nofence 2016. 11. 13. 22:19

정보보안기사 제 8실기 시험 4번 문제에 대커뮤니티에서 의견이 분분하여 직접 코드를 복기한 후 코딩 작업을 진행해 보았다.





결과는 다음과 같다.




 

 

man 페이지에서 setuid() 시스템 콜에 대해 확인해 본 결과는 아래와 같다.



SETUID(2)                  Linux Programmer's Manual                 SETUID(2)

NAME
       setuid - set user identity

SYNOPSIS
       #include <sys/types.h>
       #include <unistd.h>

       int setuid(uid_t uid);

DESCRIPTION
        setuid()  sets  the  effective  user ID of the calling process.  If the
       effective UID of the caller is root, the real UID and saved set-user-ID
       are also set.