오픈 시스템 호출을 사용하여 전체 권한 (777)으로 파일을 생성하고 있습니다.하지만 ls -li는 (755) 권한 만 볼 수 있습니다. 이유는 무엇입니까? 허가는 777이 아니야?공개 시스템 호출에서 파일 사용 권한 문제 linux
코드
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
int main()
{
int fd;
/* Creates a file with full permission*/
fd = open("test",O_CREAT | O_RDWR |O_APPEND ,0777);
if(fd= -1)
{
return -1;
}
close(fd);
}
출력 시스템에 의해 유지되는 값이 umask
라는있다
$ ls -l
-rwxr-xr-x 1 ubuntu ubuntu 0 2012-09-19 11:55 test
'umask'와 관련이 있습니다. 예 : http://www.cyberciti.biz/tips/understanding-linux-unix-umask-value-usage.html –