디렉토리의 파일을 cd하거나 액세스하려면 모든 상위 디렉토리에 + x 권한이 필요합니다.
파일을 나열하려면 디렉토리에 + r 권한이 필요합니다. 여기 예가 있습니다 :
다음 명령을 실행하여 몇 가지 설정을 할 수 있습니다.
mkdir -p /a/b
touch /a/b/{file1,file2}
cd /a
echo 1 > b/file1
echo 2 > b/file2
권리가 없습니다 :
pwd
/a$ pwd
/a
/a$ chmod -rwx b
/a$ ls -l
d--------- 4 mike admin 136 Jun 1 14:44 b/
/a$ ls -l b/
ls: : Permission denied
/a$ cat b/file1
cat: b/file1: Permission denied
실행 만
/a$ chmod +x b
/a$ ls -l
total 0
d--x--x--x 4 mike admin 136 Jun 1 14:44 b/
/a$ ls -l b
ls: b: Permission denied
/a$ cat b/file1
a
/a$ ls -l b/file1
-rw-r--r-- 1 mike admin 2 Jun 1 14:43 b/file1
이제 읽었습니다.
/a$ chmod +r b/
/a$ ls -l
/a$ ls -l
total 0
dr-xr-xr-x 4 mike admin 136 Jun 1 14:44 b/
/a$ ls -l b/
total 16
-rw-r--r-- 1 mike admin 2 Jun 1 14:43 file1
-rw-r--r-- 1 mike admin 2 Jun 1 14:43 file2
이 부분은 다소 혼란 스러울 수 있지만 읽기 및 실행이없는 경우 실제로 디렉토리에 파일을 나열 할 수 있지만 inodes 메타 데이터를 읽을 수 없으므로 권한이 거부되지만 여전히 파일 목록을 볼 수 있습니다 아래와 같이 디렉토리에 ..
/a$ chmod -x b/
/a$ ls -l
total 0
dr--r--r-- 4 mike admin 136 Jun 1 14:44 b/
/a$ ls -l b
ls: file1: Permission denied
ls: file2: Permission denied
chmod +grx -R /a/b/c/d/e/folder있습니까? 잘못, 그것을 실행하는 올바른 방법은 다음과 같습니다chmod g+rx -R /a/b/c/d/e/folder