리눅스 기초 다지기 - 48. ACL - setfacl, getfacl

ACL(Access Control List)

: chmod 명령어보다 더 다양한 권한을 부여할 수 있다.

 

user, group, other 권한을 건드리지 않고 특정 사용자에게 권한을 부여할 수 있다.

 

setfacl(Set File Access Control Lists)

: 파일 및 디렉터리의 ACL 정보를 설정한다.

 

setfacl —modify(-m) user:test:rwx test01

: test 사용자에게 test01 파일에 읽기, 쓰기, 실행 권한을 부여한다.

 

setfacl -x user:test test01

: test01 파일에 부여한 test 사용자 acl 권한을 제거한다.

 

setfacl -b test01

: test01 파일의 모든 acl 권한을 제거한다.

 

getfacl(Get File Access Control Lists)

: 파일 또는 디렉터리의 ACL 정보를 확인한다.

 

ACL 권한 부여

ls -al
-rw-r--r--.  1 root root   0 Nov  9 14:10 test01

# test 사용자에게 test01 파일 권한 부여
setfacl --modify user:test:rwx test01
getfacl test01
# file: test01
# owner: root
# group: root
user::rw-
user:test:rwx
group::r--
mask::rwx
other::r--

su - test
echo "Hello World!" > test01
cat test01
Hello World!

 

 

ACL 권한 제거

setfacl -x user:test test01
getfacl test01
# file: test01
# owner: root
# group: root
user::rw-
group::r--
mask::r--
other::r--