Link to home
Start Free TrialLog in
Avatar of Balbir Singh
Balbir SinghFlag for United States of America

asked on

How to monitor char file permission using monit

I am wondering how can we monitor the permission on char file using monit application

I have below char file

/dev/null

and below monitrc config

check file dev_null with path /dev/null
if failed permission 666 then exec "chmod 666 /dev/null" as uid root and gid wheel

But it doesn't seems to work when file /dev/null has permission 600

I really appreciate any help on that.
Avatar of arnold
arnold
Flag of United States of America image

/dev/null is in short considered a trash bin.
anything sent here is discarded.

not sure I understand what you are asking /dev/null is a "system device"


It should not be changing permissions.
Avatar of Balbir Singh

ASKER

Hi Arnold,

I have observed that file permission on /dev/null keeps on changing and I guess it is due to some package or process which cause issue to my other application which needs write permission to trash few things. So I want to monitor its permission using monit and if it is not there then correct the permission.

Please let me know if you have any recommendation on how to do it.

Best Regards!
you should double check what cron jobs you have or scripts that run chmod on /dev/null
I do not believe there is any system level task, or mechanism that will be doing that.


not sure monit is in a position to monitor a character device.  usually I think monit can monitor fles or folders.

if you have this issue, setup a cron under root to run every minute to issue the chmod 666 /dev/null
* * * * * chmod 666 /dev/null >/dev/null

also not sure which linux system you have, but ownership of /dev/null should commonly be by root with root or other as the group.
ASKER CERTIFIED SOLUTION
Avatar of David Favor
David Favor
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial