흔자
반응형

chown 은 change file owner and group의 줄임말로 파일 및 디렉터리의 소유자와 그룹의 권한을 변경한다.


chown

chown [옵션] [소유자][:[그룹]] [파일명]
# ls -al
-rw-r--r-- 1 root root   31 Jan 20 21:45 test.txt

소유자: root

그룹: root

 

 

소유자만 변경

chown test test.txt
# 소유자 test로 test.txt 권한 변경
-rw-r--r-- 1 test root   31 Jan 20 21:45 test.txt

 

 

소유자와 그룹 모두 변경

chown test:test test.txt
# 소유자 test, 그룹 test로 test.txt 권한 변경
-rw-r--r-- 1 test test   31 Jan 20 21:45 test.txt

 

 

하위 모든 파일 및 디렉토리 권한 변경

-R, --recursive 옵션을 추가하면 하위 모든 파일 디렉터리 권한을 변경할 수 있다.

chown -R test:test test.txt

 

반응형
profile

흔자

@heun_n

즐겁게 개발하고 싶은 사람입니다.