Linux

reboot 하면 lastlog 권한이 664로 계속 바뀌어요

도경다경 2023. 6. 21. 18:54
반응형

리눅스 설정 값 중에 로그 파일들 권한을 설정해주는 파일이 있어서 그렇다.

/lib/tmpfile.d/var.conf

여기서 수정하면 리붓해도 설정한 권한으로 유지된다.(테스트 완료)

 

 

 

How to change default file permissions for /var/log/wtmp?

 SOLUTION VERIFIED - Updated April 21 2023 at 3:17 AM - 
 

Environment

  • Red Hat Enterprise Linux (RHEL) 7
  • Red Hat Enterprise Linux (RHEL) 8

Issue

  • How to permanently change the default file permissions for /var/log/wtmp ?

Resolution

For RHEL 7.3

  • Permissions for the /var/log/wtmp file is handled by /lib/tmpfiles.d/var.conf, which gets executed after every reboot.
  • To change default permissions, edit the permissions in below script.
  • # cat /lib/tmpfiles.d/var.conf | grep wtmp
      f /var/log/wtmp 0664 root utmp -
    

For RHEL 7.0, 7.1, 7.2

  • Permissions for the /var/log/wtmp file is handled by /lib/tmpfiles.d/systemd.conf, which gets executed after every reboot.
  • To change default permissions, edit the permissions in below script.
  • # cat /lib/tmpfiles.d/systemd.conf | grep wtmp
      f /var/log/wtmp 0664 root utmp -
    

NOTE: If a custom file /etc/tmpfiles.d/var.conf is created in /etc/tmpfiles.d/ directory, then irrespective of the RHEL version the file will take precedence over same file in /lib/tmpfiles.d/ directory.

반응형