[Nagios] Error: Could not stat() command file ‘/var/lib/nagios3/rw/nagios.cmd’!

System: Ubuntu 9.10 | Nagios 3.x

This is another post that is more of a note to myself than anything else. Been doing a lot of Nagios configuring and decided to implement the ability to push commands from the web interface. I followed the basic instructions to configure "External Commands" but after doing and going to the web interface to test it, I got the following error message;

Error: Could not stat() command file '/var/lib/nagios3/rw/nagios.cmd'!

The external command file may be missing, Nagios may not be running, and/or Nagios may not be checking external commands. An error occurred while attempting to commit your command for processing.

The file was there so I did what any good geek should do, I did a quick google search. The closet thing I could find was some commands to fix the issue on Debian systems. Since I was running Ubuntu, which is for all intensive purposes Debian, I figured I would try it.  So I ran the following set of command;

sudo /etc/init.d/nagios3 stop
sudo dpkg-statoverride --update --add nagios www-data 2710 /var/lib/nagios3/rw
sudo dpkg-statoverride --update --add nagios nagios 751 /var/lib/nagios3
sudo /etc/init.d/nagios3 start

This worked like a charm and the web interface began accepting commands.