[Solved] Permission denied (dialparties.agi)

for the last couple of days, maybe a week, we have had some strange things happen, I finally was able to capture a debug of what the call was doing. A simple reload fixes it, but I don’t understand why it’s happening. Here is the error message from the debug…

– Executing [s@macro-dial:6] AGI(“SIP/WOW-SIP-00000009”, “dialparties.agi”) in new stack
Launched AGI Script /var/lib/asterisk/agi-bin/dialparties.agi
dialparties.agi: Failed to execute ‘/var/lib/asterisk/agi-bin/dialparties.agi’: Permission denied
[2016-04-05 06:24:56] ERROR[3485][C-00000008]: utils.c:1339 ast_carefulwrite: write() returned error: Broken pipe

I have already changed the permissions for this file to 777 hoping that would fix it, but wanted you guys opinion as to why it happened, or if I needed to do more?

From the console, log in as root and ‘su’ to asterisk.
Enter the command “/var/lib/asterisk/agi-bin/dialparties.agi” and see what the actual error message is.

Permission denied errors can be a lot of different things, including permissions on “intervening” directories, ownership of various files and directories, and other problems like that. If the AGI script is in an interpreted language, the first like will include the interpreter - check to make sure that Asterisk has permissions to that.

If these permissions are changing randomly, something in changing them. It would be prudent to scan your machine for possible nefarious activities.

[root@pbx1 ~]# su asterisk
This account is currently not available.

so I’ve never done this before is this how you do it?
linux skills are basic at best…

the machine is never on the internet, behind a firewall, no open ports from the firewall to the box… hard to see how nefarious activities could be the cause most likely my less than adequate Linux skills… so I changed the permissions to 777 for the folder and all the files in the folder. but when the server restarts at 4 AM everyday, the permissions are back to this…

Thanks for your quick reply… when modules are updated it also sets the permissions on files correct?

Run fwconsole chown

2 Likes

Hi Andrew, do I need to be in a certain directory? or just run once I log in? what does that do?

You do not need to be in a certain directory.
http://wiki.freepbx.org/pages/viewpage.action?pageId=37912685#fwconsolecommands(13+)-Chown

2 Likes

ok I ran it this morning, I’ll let you know if I have anymore issues, or should I do anything else?

Andrew Thank you! it’s been 2 weeks and not one issue since!!! Thanks! Thanks to avayax as well for the info on the command… #LinuxIsNotMyFriend

well, I’m sorry to say the issue came back after another week… :frowning: but I found a work around just in case someone runs into this… add this to your crontab an hour or so before people get to work, or whenever after the daily reboot…
so obviously this doesn’t fix anything but hopefully the issue will not show up!!!

0 5 * * * /sbin/shutdown -r now
0 6 * * * /usr/local/sbin/fwconsole reload