파일의 소유자와 파일에 적용된 사용 권한을 확인: ls -l
파일에 적용된 사용 권한을 변경: chmod
mkdir linux
nano helloworld.js ..'ctrl + x' 로 저장
ls -l
명령어 chmod 로 권한을 변경하는 방식은 두 가지임.
Symbolic method는 액세스 클래스, 연산자, 액세스 타입으로 구분함.
<symbolic method 사용 예시>chmod g-r filename # removes read permission from group chmod g+r filename # adds read permission to group chmod g-w filename # removes write permission from group chmod g+w filename # adds write permission to group chmod g-x filename # removes execute permission from group chmod g+x filename # adds execute permission to group chmod o-r filename # removes read permission from other chmod o+r filename # adds read permission to other chmod o-w filename # removes write permission from other chmod o+w filename # adds write permission to other chmod o-x filename # removes execute permission from other chmod o+x filename # adds execute permission to other chmod u+x filename # adds execute permission to user
chmod a=rw helloworld.js # -rw-rw-rw- chmod u= helloworld.js # ----rw-rw- chmod a+rx helloworld.js # -r-xrwxrwx chmod go-wx helloworld.js # -r-xr--r-- chmod a= helloworld.js # ---------- chmod u+rwx helloworld.js # -rwx------
Absolute form은 숫자 7까지 나타내는 3 bits의 합으로 표기함.
<Absolute form 사용 예시># u=rwx (4 + 2 + 1 = 7), go=r (4 + 0 + 0 = 4) chmod 744 helloworld.js # -rwxr--r--
Absolute form에서 사용하는 숫자는 다음의 표를 참고함.