I have a file
/var/logs/apache2/error.log. And every time I boot, Its file permission is changed to default (unwritable) by the system. So, i have to run
chmod command every time i boot-up. How to change it's file permission permanently.
As per the discussion in comments, for the purpose the OP is trying to achieve (looking at a simple subset of logs for a specific purpose), this may be an appropriate alternative solution:
Tail will let you look at the last lines of a file
Grep lets you search through a file for instances you want to find
Both are available as part of Unix/Linux and should be part of your essential toolkit.
If so, try editing the configuration file
to whatever you prefer, e.g.
But other than the
If this is on a server, it's probably a bad idea to make the file world writable. For example, if somebody breaks in to your system, they can remove the log entries that would help you find the problem.
If you want read access, it might be better to add yourself to the
This would also help if you really do need write access, e.g.
would be sufficient.
Log files are usually created by logrotate. The apache logfiles definition is stored on /etc/logrotate.d/apache2
The file looks like this in one of my servers:
If you look at the create option, the values after the keyword are the permissions, user and group. Just edit your file and change this values.