Error commiting external commands

I got error when trying to commit commands via web interface. I did all the necessary things like create folder, change permission, etc. Here is the error:

Error: Could not open command file ‘/usr/local/nagios/var/rw/nagios.cmd’ for update!

The permissions on the external command file and/or directory may be incorrect. Read the FAQs on how to setup proper permissions.

An error occurred while attempting to commit your command for processing.

Here is my permission:

drwxrwxr-x 2 nagios nagios 4096 May 9 00:00 archives
-rw-rw-r-- 1 nagios nagios 238 May 6 13:48 comments.dat
-rw-rw-r-- 1 nagios nagios 239 May 6 13:48 downtime.dat
-rw-r–r-- 1 nagios nagios 5 May 9 09:26 nagios.lock
-rw-r–r-- 1 nagios nagios 3186 May 9 09:26 nagios.log
-rw-r–r-- 1 nagios nagios 21897 May 9 09:26 objects.cache
-rw------- 1 nagios nagios 25917 May 9 09:26 retention.dat
drwxrwsr-x 2 nagios nagioscmd 4096 May 9 09:26 rw
-rw-rw-r-- 1 nagios nagios 24858 May 9 09:28 status.dat

In the rw dir:
prw-rw---- 1 nagios nagioscmd 0 May 9 09:26 nagios.cmd

ls -la /usr/local/nagios/var
drwxrwsr-x 2 nagios nagcmd 4096 May 6 12:48 rw

grep nagios /etc/group
nagios:x:502:
nagcmd:x:503:apache,nagios

So, I have to assume(and that would be wrong) that nagioscmd group has members of apache and nagios, since you didn’t show us.

So, please show us.