무단 접근 방지 + 보호 기능 제공| 파일 종류 | 접근 권한 | 하드 링크 개수 | 파일 소유자 | 소유자 그룹 | 파일 크기(byte) | 마지막 수정 날짜 | 파일명 |
|---|---|---|---|---|---|---|---|
| - | rw-r--r-- | 1 | root | root | 158 | 12월 7 2016 | /etc/hosts |
- : 일반 파일d : 디렉토리| 권한 | 표기 | 파일 | 디렉터리 |
|---|---|---|---|
| 읽기 | r | 파일 읽기, 복사 | ls 명령, 실행 권한이 있어야 사용 가능 |
| 쓰기 | w | 파일 수정, 이동, 삭제 | 파일 생성, 삭제 |
| 실행 | x | 파일 실행 | cd 명령, 파일 디렉터리로 이동, 파일 디렉토리로 복사 |
rw-r--r--
chmod [옵션] [권한 모드 파일 or 디렉토리]-R : 하위 디렉토리까지 모두 변경 가능
현재 접근 권한은 (rw-r--r--)
1. 소유자의 쓰기 권한을 제거
[root@localhost 20220511]# chmod 444 test
[root@localhost 20220511]# ls -ld test
-r--r--r--. 1 root root 0 May 11 23:41 test
[root@localhost 20220511]# chmod 474 test
[root@localhost 20220511]# ls -ld test
-r--rwxr--. 1 root root 0 May 11 23:41 test
[root@localhost 20220511]# chmod 475 test
[root@localhost 20220511]# ls -ld test
-r--rwxr-x. 1 root root 0 May 11 23:41 test
[root@localhost 20220511]# chmod 464 test
[root@localhost 20220511]# ls -ld test
-r--rw-r--. 1 root root 0 May 11 23:41 test
[root@localhost 20220511]# chmod 575 test
[root@localhost 20220511]# ls -ld test
-r-xrwxr-x. 1 root root 0 May 11 23:41 test
[root@localhost 20220511]# chmod 755 test
[root@localhost 20220511]# ls -ld test
-rwxr-xr-x. 1 root root 0 May 11 23:41 test
[root@localhost 20220511]# chmod 700 test
[root@localhost 20220511]# ls -ld test
-rwx------. 1 root root 0 May 11 23:41 test
[root@localhost 20220511]# umask
0022
[root@localhost 20220511]# touch file
[root@localhost 20220511]# ls -ld file
-rw-r--r--. 1 root root 0 May 12 00:07 file
[root@localhost 20220511]# umask 077
[root@localhost 20220511]# umask
0077
[root@localhost 20220511]# touch file2
[root@localhost 20220511]# ls -ld file2
-rw-------. 1 root root 0 May 12 00:09 file2
s로 표시[user@localhost 20220511]$ chmod 755 set.exe
[user@localhost 20220511]$ ls -l set.exe
-rwxr-xr-x. 1 user user 0 May 12 00:25 set.exe
[user@localhost 20220511]$
[user@localhost 20220511]$ chmod 4755 set.exe
[user@localhost 20220511]$ ls -l set.exe
-rwsr-xr-x. 1 user user 0 May 12 00:25 set.exe
s로 표시[user@localhost 20220511]$ chmod 2755 set.exe
[user@localhost 20220511]$ ls -l set.exe
-rwxr-sr-x. 1 user user 0 May 12 00:25 set.exe
t로 표시[user@localhost 20220511]$ mkdir dir
[user@localhost 20220511]$ ls -ld dir
drwxrwxr-x. 2 user user 6 May 12 00:42 dir
[user@localhost 20220511]$ chmod 1777 dir
[user@localhost 20220511]$ ls -ld dir
drwxrwxr-t. 2 user user 6 May 12 00:42 dir