웹서버 로그를 보려면 root 권한이 있어야 하므로 RHEL/CentOS 환경에서 일반 계정으로 web server log(/etc/httpd/logs) 나 기타 log 파일을 볼 수 있게 권한 부여하는 방법

대상 계정은 test 이라 가정

 

  1. root 로 su
  2. logs 폴더에 setfacl 로 read, execute 권한  적용

    setfacl -m u:test:rx /etc/httpd/logs/
    BASH

    그룹일 경우 (Ex: group1) u 대신 g 를 적어 주면 된다.

    setfacl -m g:group1:rx /etc/httpd/logs/
  3. getfacl 로 적용 여부 확인 (아래의 user:test:r-x 처럼 폴더일 경우 r과 x 권한이 부여되야 함)

    getfacl: Removing leading '/' from absolute path names
     
    # file: etc/httpd/logs/
    # owner: root
    # group: root
    user::rwx
    user:rnd:r-x
    group::---
    mask::r-x
    other::---
    BASH
  4. 해당 계정으로 로그인해서 제대로 보이는지 확인

    tail -f /etc/httpd/logs/access_log
    CODE
같이 보기