Asterisk.ctl file in ASL3

I am getting the dreaded message below which is due to file permissions.

Unable to connect to remote asterisk (does /var/run/asterisk/asterisk.ctl exist?)

Each time Asterisk is restarted, the file gets re-created but the owner is the asterisk user. Other users do not have permission to write to the file. Because the other users cannot write to the file, any asterisk -r commands cannot be run under their user id…

The link below explains what is happening but doesn’t provide any guidence for a permanent workaround.

https://docs.asterisk.org/Deployment/Troubleshooting/Unable-to-connect-to-remote-Asterisk/

I can run a chmod command against the file to grant the required permissions but I don’t want to do this after each restart.

What are others are doing to resolve this?

Tom G0JSV

This is by design and is not a problem to be resolved. See Permissions - AllStarLink Manual for more information.

Thanks for the reply. OK I understand that the asterisk process now runs as the asterisk user. If I want to create a simple test cron job such as * * * * * /usr/sbin/asterisk -rx ‘rpt localplay /var/lib/asterisk/sounds/hal_cantdo’ it will throw an error because the asterisk.ctl file can only be written to by the asterisk user. If I then modify the permissions of the asterisk.ctl file to allow everyone to have write access the crontab job starts running correctly. So how do I run cron jobs going forward? Without having to reset the permissions on the .ctl file after every Asterisk restart?

Put it in the asterisk crontab, not the root crontab.

crontab -u asterisk -e

Or, to state it more generally, anything you want to interact with asterisk needs to run as the asterisk user. There’s a number of ways to do that, including user crontabs, the /etc/cron.d structure, and even systemd services/timers.

Thanks, that has worked. Douglas Rain (Voice of HAL in 2001 a Space Odessy) is now announcing some of the telemetry on the gateway again giving Allison Smith a rest. :wink:

1 Like