자동으로 부여되는 허가권의 디폴트값 변경
파일이나 디렉토리를 생성할 때 자동으로 기본 허가권이 부여되는데 그 기본 허가권을 변경하여 새로 만들어지는 파일이나 디렉토리에 자동으로 수정된 권한을 부여한다.
부여되는 권한 = 기본 허가권 - umask값
리눅스의 기본 허가권
- 파일 : 666
- 디렉토리 : 777
umask 확인하는 방법
| [root@Linux test]# umask 0022 |
umask 변경하는 방법
| [root@Linux test]# umask 077 [root@Linux test]# umask 0077 |
사용 예시
| [root@Linux test]# umask 077 [root@Linux test]# touch B [root@Linux test]# ll total 0 -rw-------. 1 root root 0 Apr 27 16:15 B |
>> 기본 허가권 666 -077-> 600 -> rw-/--- /---/로 새로운 파일이 생성된다.
1. 작동 원리
/etc/profile.d
| [root@Linux ~]# cat /etc/profile.d/local-umask.sh # Overrides default umask configuration asda sda if [ $UID -gt 199 ] && [ "'id -gn'" = "'id -un'" ]; then umask 007 else umask 022 fi |
2. 옵션
-S : umask값을 문자로 표기한다.
| [root@host ~]# cat /etc/profile.d/local-umask.sh # Overrides default umask configuration asda sda if [ $UID -gt 199 ] && [ "'id -gn'" = "'id -un'" ]; then umask 007 else umask 022 fi |
'리눅스-기초명령어 > 파일 및 유저 권한' 카테고리의 다른 글
| ACL (Access Control List) (2) | 2023.09.01 |
|---|---|
| chgrp (0) | 2023.08.31 |
| chown (1) | 2023.08.31 |
| chmod (0) | 2023.08.31 |