/
Linux chmod 에서 대문자 x 옵션의 의미(capital X means in chmod)
Linux chmod 에서 대문자 x 옵션의 의미(capital X means in chmod)
26년 정도 Unix 계열(Linux) 을 써 왔는데 chmod 명령에 대문자 X 옵션이 있다는 것을 오늘 처음 알았습니다.
대문자 X 의 의미는 해당 파일이 디렉터리거나 실행 속성(exe) 을 이미 갖고 있을 경우에만 +x 속성을 부여하라는 의미입니다.
만약 capital-x-test 라는 폴더가 있고 하위에 aa(755), bb(700) 속성을 가진 폴더와 a.out 이라는 실행 속성이 있는 파일, test.txt 라는 644 모드인 텍스트 파일이 있다고 가정해 봅시다
$ ls -l capital-x-test/ total 0 drwx--x--x+ 2 root root 6 Mar 31 04:17 aa -rwxr-xr-x+ 1 root root 0 Mar 31 04:17 a.out drwx------. 2 root root 6 Mar 31 10:49 bb -rw-r--r--+ 1 root root 0 Mar 31 04:17 test.txt
capital-x-test 하위의 모든 폴더에 모든 사용자가 접근 가능하도록 755 속성을 주기 위해 다음 명령을 실행하면 실행 속성이 필요없는 test.txt 까지 실행 속성이 붙어 버리게 됩니다.
chmod -R 755 capital-x-test/
이럴 경우 대문자 X 옵션을 사용하면 폴더인 aa, bb 와 이미 실행 속성이 있는 a.out 에는 x 를 붙이고 644 모드인 test.txt 에는 실행 속성을 붙이지 않습니다.
chmod -R g+rX,o+rX capital-x-test/
, multiple selections available,
Related content
linux chmod 사용법
linux chmod 사용법
More like this
chmod, setfacl 실행시 "Operation not permitted" 에러 발생
chmod, setfacl 실행시 "Operation not permitted" 에러 발생
More like this
xmodmap 으로 Linux 한글/영어 전환키 설정
xmodmap 으로 Linux 한글/영어 전환키 설정
More like this
linux cut 명령어 사용법
linux cut 명령어 사용법
More like this
리눅스 설치와 관리
리눅스 설치와 관리
More like this
폴더와 파일에 적절한 권한 부여
폴더와 파일에 적절한 권한 부여
More like this