40 likes | 149 Vues
Chapter 3. /etc/passwd real uid( 진짜 사용자 식별번호 ), real gid( 진짜 그룹 식별번호 ) 프로세스를 수행시킨 사용자의 사용자 식별번호 / 그룹 식별번호 effective uid( 유효 사용자 식별번호 ), effective gid( 유효 그룹 식별번호 ) 실제 소유권을 갖는 사용자의 사용자 식별번호 / 그룹 식별번호 file mode ( 읽기 , 쓰기 , 수행 ) rwxrwxrwx, rwxr-xr-x, 표 3.1 (p58) chmod 로 허가 수정
E N D
Chapter 3 • /etc/passwd • real uid(진짜 사용자 식별번호), real gid(진짜 그룹 식별번호) • 프로세스를 수행시킨 사용자의 사용자 식별번호/그룹 식별번호 • effective uid(유효 사용자 식별번호), effective gid(유효 그룹 식별번호) • 실제 소유권을 갖는 사용자의 사용자 식별번호/그룹 식별번호 • file mode (읽기, 쓰기, 수행) • rwxrwxrwx, rwxr-xr-x, • 표 3.1 (p58) • chmod로 허가 수정 • 프로세스 생성시 그 프로세스를 시작시킨 사용자의 사용자 식별번호를 부여 • S_ISUID, S_ISGID, S_ISVTX • S_ISUID : 파일 소유자의 사용자 식별번호를 유효 사용자 식별번호로 부여 • 파일의 텍스트 이미지를 남겨둠
Chapter 3 • file creation mask • filedes = open(pathname, O_CREAT, (~mask)&mode); • mask=07 0644-> 0640 • test1.c • int access(const char *pathname, int mode) • 유효 사용자 식별번호가 아니라 진짜 사용자 식별번호에 의해 파일에 접근할 수 있는지 여부 점검 • R_OK (호출 프로세스가 읽기 접근을 가졌는가?), W_OK (쓰기 접근), X_OK (수행시킬 수 있는가?) • test2.c • int chmod(const char *pathname, mode_t newmode) • int chown(const char *pathname, uid_t owner_id, gid_t group_id); • 파일의 소유자나 슈퍼 사용자만 사용할 수 있음 • int link(const char *orginal_path, const char *new_path); • unlink • int rename(const char *oldpathname, const char *newpathname); • int symlink(const char *realname, const char *symname); • int readlink(const char *sympath, char *buffer, size_t bufsize); • test3.c
Chapter 3 • int stat(const char *pathname, struct stat *buf) • p73-74 stat 구조 int filedes, retval; struct stat s; filedes = open(“/tmp/dina”, O_RDWR); retval = stat(“/tmp/dina”, &s); retval = fstat(filedes, &s) • test4.c filedata.c • test5.c • Lookout • (실습) 파일의 크기 변화를 점검하는 프로그램으로 test5.c를 변경하라