MOUNTING FILE SYSTEMS



파일 및 디렉토리에 ACL 을 사용하기 전에 파일 또는 디렉토리의 파티션을 ACL 이 지원 가능하도록 마운트를 해야함

로컬 ext3 파일 시스템인 경우 다음 명령을 사용해서 마운트 하면된다. 


mount -t ext3 -o acl device-name partition 


ex. mount -t ext3 -o acl /dev/VolGroup00/LogVol02 /work

파티션이 /etc/fstab 에 설정되어 있는경우 항목에 다음과 같은 acl 설정 부분을 넣어줄수 있음


LABEL = /work    /work    ext3    acl    1 2


Samba 를 통해 ext3 파일 시스템에 액세스 하는경우 ACL 이 활성화 되어 있으면 Samba 가 --with-acl-support 옵션으로 컴파일 되어 있기에 ACL 이 정상적으로 인식이 됨, Samba 로 액세스 하는경우 특별한 플러그인이 추가적으로 필요하지 않음



NFS


기본적으로 NFS 에서 내보내는 파일 시스템이 ACL 을 지원하고, NFS 클라이언트가 ACL을 읽을수 있는경우 ACL 을 클라이언트에서 사용가능


NFS 에 대해 ACL을 비활성화 하려면 /etc/exports 파일에 no_acl 옵션을 포함해야함

NFS 에서 ACL 을 사용하지 않으려면 no_acl 명령옵션이나 /etc/fstab 옵션을 추가해주면 됨



SETTING ACCESS ACLS


ACL 은 2가지 type 이 있음, access ACLs 와 default ACLs

access ACLS 은 특정 파일이나 디렉토리에 대한 액세스 제어목록

default ACLs 는 디렉토리만 연결이 가능, 디렉토리 내의 파일에 access ACLs 가 없느경우 디렉토리에 대한 기본 ACLs 규칙이 적용, default ACLs 은옵션이다.


ACLs 는 

- Per user (사용자별)

- Per group (그룹별)

- Via the effective rights mask (권한 mask 를 통해서)

- For users not in the user group for the file (파일에 대한 사용자 그룹에 없는 사용자의 경우)


"setfacl" 유틸리티는 파일 및 디렉토리에 대한 ACL 을 설정한다. "-m" 옵션을 사용해서 ACL 을 추가하거나 수정가능


# setfacl -m rules files


u:uid:perms

- 유저에 대한 access ACL 설정, 사용자 이름 혹은 UID 사용가능, 사용자는 시스템 사용자 일수도 있음


g:gid:perms

- 그룸에 대한 access ACL 설정, 그룹 이름 혹은 GID 사용가능, 그룹은 시스템 그룹 일수도 있음


m:perms

- Mask 를 설정, Mask 는 소유그룹 그리고 모든 사용자 및 그룹값 이다. 


o:perms

- 파일의 그룹에 속한 사용자 이외의 사용자에 대한 access ACL 을 설정


권한은 문자 조합으로 설정됨, r 읽기, w 쓰기, x 실행 


파일 및 디렉토리에 이미 ACL이 설정되어 있는경우 setfacl 명령이 실행되면 규칙이 추가 되거나 기존 규칙이 수정됨


# setfacl -m u:andrius:rw /project/somefile
# setfacl -x rules files
# setfacl -x u:500 /project/somefile


SETTING DEFAULT ACLS


default ACL 을 설정하려면 d: 옵션을 추가한다. 


/share 디렉토리에 대한 default ACL ㅇ르 설정하는 내용이다. 


# setfacl -m d:o:rx /share


RETRIEVING ACLS


ACLs 을 확인하려면 "getfacl" 명령을 이용해서 확인한다. 


# getfacl home/john/picture.png
# file: home/john/picture.png 
# owner: john 
# group: john 
user::rw- 
group::r-- 
other::r--

default ACL 이 설정되어 있는경우 아래처럼 확인이 된다. 


# file: home/sales/ 
# owner: john 
# group: john 
user::rw- 
user:barryg:r-- 
group::r-- 
mask::r-- 
other::r-- 
default:user::rwx 
default:user:john:rwx 
default:group::r-x 
default:mask::rwx 
default:other::r-x


ARCHIVING FILE SYSTEMS WITH ACLS


dump command 는 기본적으로 ACLs 을 보존한다. 파일이나 파일 시스템을 아키이브 할때에 ACL 을 보존하는옵션은 tar 명령으를 사용하면서 --acls 옵션을 사용하면 된다. cp 로 파일을 복사하는경우 --preserve=mode 옵션을 허용해 주면 된다. -a 옵션을 사용하게되면 timestamp, Selinux 등과 같은 다른 정보와 함께 ACLs 정보도 보존하게된다. "-a" = "-dR --preserve=all"


star 유틸리티는 tar 와 유사함을 가진 유틸리티이다. 


OptionDescription
-cCreates an archive file.
-nDo not extract the files; use in conjunction with -x to show what extracting the files does.
-rReplaces files in the archive. The files are written to the end of the archive file, replacing any files with the same path and file name.
-tDisplays the contents of the archive file.
-uUpdates the archive file. The files are written to the end of the archive if they do not exist in the archive, or if the files are newer than the files of the same name in the archive. This option only works if the archive is a file or an unblocked tape that may backspace.
-xExtracts the files from the archive. If used with -U and a file in the archive is older than the corresponding file on the file system, the file is not extracted.
-helpDisplays the most important options.
-xhelpDisplays the least important options.
-/Do not strip leading slashes from file names when extracting the files from an archive. By default, they are stripped when files are extracted.
-aclWhen creating or extracting, archives or restores any ACLs associated with the files and directories.


COMPATIBILITY WITH OLDER SYSTEMS


파일 시스템의 모든 파일에 ACL 이 설정된 경우 ext_attr 속성이 설정된다. 


# tune2fs -l filesystem-device

ext_attr 속성을 가지게된 파일 시스템은 이전 커널에 마운트 할수 있지만, 이러한 커널은 설정된 ACL을 모두 적용하진 않는다. 


e2fsck 유틸리티중 버전 1.22 이상 버전에 포함된 e2fsprogs 패키지는 ext_attr 속성을 확인할수 있으나 이전 버전에서는 확인이 되지 않음





ACL REFERENCES


man acl

man getfacl

man setfacl

man star




'Linux > Redhat 7 system administrator's guide' 카테고리의 다른 글

8. YUM  (0) 2017.08.01
5. GAINING PRIVILEGES  (0) 2017.07.14
3. MANAGING USERS AND GROUPS  (0) 2017.07.05
2. CONFIGURING THE DATE AND TIME  (0) 2017.03.16
1. system locale and keyboard configuration  (0) 2017.03.16

+ Recent posts