SRE/Linux Basics

Access Control Lists, ACLs

게임이 더 좋아 2022. 12. 30. 21:13
반응형
728x170

정의

접근 제어 목록이다.

Linux에서는 실제로  Linux Standard Permission을 통해서 Access to Resource를 관리하고 있는데

ACL을 통해서 조금 더 고도화된 제어가 가능하다.

 

 

관련 파일 및 커맨드

setfacl , getfacl

 

기능

Linux의 Permission은 User, Group, Owner를 기준으로 permission 관리가 되는데

ACL에서는 조금 더 유연하게 Resource 접근 제어가 가능하다.

물론 ACL에서도 Permission과 같이 Read, Write, Execute에 대해서 제어를 할 수 있고 더 나아가서는

file을 delete 하거나 append 하는 것까지 제어할 수 있다.

또한 ACLs에서는 inheritance(상속)을 지원한다.

즉, resource에 대한 permission이 상속된다는 말이다.

그렇게 되면 새로운 resource가 생기더라도 parent directory의 permission과 같은 권한을 가지게 되는 것이다.

또한 ACLs는 user, group과 같은 것들이 실제로 시스템 데이터베이스에 등록되지 않아도 제어가 가능하다.

다시 말해서 ACLs에 추가 시에 직접 설정할 수 있다는 말과 같다.

즉, Linux Server에 접근하는 개발 1팀이 기존에 원래 있었고 새로운 개발 2팀이 생겨났다면 

개발 2팀을 Server에 등록하지 않더라도 ACLs 수준에서 Resource Access 제어가 가능하단 말과 같다.

이렇게 함으로써 조금 더 유연해지고 실제로 실무에 쓰이는 수준은 여기라고 볼 수 있다.

 

예를 들면 ACLs 의 설정은 아래처럼 하게 된다.

#대부분 아래 형식을 따름
#command {option} {user or group} : {name} : {permission} {resource}


#특정 유저나 그룹에게 rw 권한 주기 -> jane에게 주기, accounting 그룹에게 주기
setfacl -m u:jane:rw file.txt
setfacl -m g:accounting:rw file.txt

#특정 유저나 그룹 권한 회수
setfacl -x u:jane file.txt
setfacl -x g:accounting file.txt

#디렉토리에 ACL 설정
setfacl -m d:u:jane:rwx dir
setfacl -m d:g:accounting:rwx dir

 

 

 

Options

  • -m: This option is used to add an ACL entry to a file or directory.
  • -x: This option is used to delete an ACL entry from a file or directory.
  • -b: This option is used to remove all non-default ACL entries from a file or directory.
  • -d: This option is used to set default ACLs for a directory.
  • -R: This option is used to apply the specified ACLs recursively to all files and directories within a specific directory.
  • -n: This option is used to disable the translation of group names to group IDs.
  • -v: This option is used to enable verbose output, which displays the ACLs that are being modified.

 

 

 


참고링크

 

https://www.geeksforgeeks.org/access-control-listsacl-linux/

 

 

반응형
그리드형

'SRE > Linux Basics' 카테고리의 다른 글

Register Service, 서비스 등  (0) 2023.01.04
touch  (0) 2022.12.31
rmdir  (0) 2022.12.25
mkdir  (1) 2022.12.25
Linux_Network  (0) 2022.12.18