개인적임 참고주소 : http://en.allexperts.com/q/Unix-Linux-OS-1064/real-effective-user-id.htm
참고주소 : http://blog.naver.com/PostView.nhn?blogId=andong_c&logNo=70031560512
파일 접근 모드
read, write, execute에 대한 user, group, other로 구성.
특수한 용도로는 suid, sgid, sticky비트로 구성.
디렉터리 접근
read : 파일들의 이름을 읽을 수 있음.
write : 디렉터리에 파일 생성, 제거 가능.
execute : 하위 디렉터리로 접근 가능.
real id, effective id
real id : This is the UID of the user/process that created THIS process.
effective id : This UID is used to evaluate privileges of the process to perform a particular action.
---
set-user-ID 혹은 set-group-ID비트가 설정시 file ID들에 대해 effective group ID가 됨.
s_isuid설정시 su의 소유자인 root권한으로 프로세스 실행됨.
sticky 비트
파일을 소유하거나 디렉터리를 소유하거나 super user인 경우에만 파일을 지우거나 이름을 바꿀 수 있음.
access()
#include<unistd.h>
int access(const char *pathname, int mode);
기능 : real user ID와 real group ID로 파일의 permission check.
리턴 : 성공시 0, 실패시 -1
mode : R_OK, W_OK, X_OK, F_OK
umask()
#include <sys/types.h>
#include <sys/stat.h>
mode_t umask(mode_t cmask);
기능 : 파일 생성시 적용할 마스크 값(적용해도 무시하게 될 권한비트) 설정
리턴 : 기존의 마스크 값.
chown(), fchown(), lchown()
#include<sys/types.h>
#include<unistd.h>
int chown(const char *pathname, uid_t owner, gid_t group);
int fchown(int filedes, uid_t owner, gid_t group);
기능 : 파일의 userid와 groupid를 변경.
리턴 : 성공시 0, 실패시 -1
int lchown(const char *pathname, uid_t owner, gid_t group);
기능 : 심볼릭 링크 파일 자체의 ID변경
'컴퓨터 공부 > Advanced UNIX System Programming' 카테고리의 다른 글
[4월 29일 1교시] 라이브러리 파일 관련 함수 1 (0) | 2009.04.29 |
---|---|
[4월 28일 3교시] 파일 및 디렉터리 관련 시스템 콜 (0) | 2009.04.28 |
[4월 28일 1교시] 파일 관련 시스템 콜2 (0) | 2009.04.28 |
[4월 27일 3교시] 파일 관련 시스템 콜 (0) | 2009.04.27 |
[4월 27일 2교시] (0) | 2009.04.27 |