Showing posts with label UNIX. Show all posts
Showing posts with label UNIX. Show all posts

Sunday, June 2, 2019

Unix root app log file permission

We may need some log files read access for other user process for tailing logs or monitoring logs or collecting logs using collectd, telegraf, splunk, etc. So When an application started by root user, all the log files or runtime files are created with only root user access permission. Changing the file permission will not helps since log files are rotated after sometime with only root user access(600). Here sharing one way of making only log file readable by all the users.

# Before starting the application create directories and set permission using setfacl. From below example application should be creating the log files in /opt/application/logs path.

mkdir -p /opt/application/logs

chmod 755 /opt/application
chmod 755 /opt/application/
chmod 755 /opt/application/logs

setfacl -d -m u:telegraf:r /opt/application/logs

touch /opt/application/audit.log

Then start your application

Thursday, August 19, 2010

RPM Relocatable

Relocatable package is give control to installer for installing in a perferred location. A RPM software package install files in /usr/share by default but user may want to install package in /etc/ location then specifying the relocatable will be useful for the users.
All the RPM are not relocatable and it is just a vendor giving control or option for installing in perferred locations. Most package are not relocatable.
To make it a package as relocatable you should add some scripts in SPEC file.

Below line has to written in Preamble/introduction section of RPM SPEC file.

Prefix: dir

Given file installating in /usr/share and /etc are relocatable.
Prefix: /usr/share
Prefix: /etc

RPM will install as like given in %files section. You can override with "--prefix dir". For example, if your package is going to install in /etc directory, you can install package in /usr/share by "rpm --prefix /usr/share"

For the multiple relocation, use --relocate argument as rpm.

rpm . --relocate /etc/=/usr/share --relocate /var=/usr