It's not often that I have to restart a Asterisk VoIP PBX. I recently upgraded to the latest version of Asterisk 1.4. After the installation was complete, I restarted the service and everything appeared to be functioning OK. Processes were running and owned by the asterisk user. When I tried to connect to the running asterisk (
asterisk -r
) with a non-superuser account, I got the following message:
Unable to connect to remote asterisk (does /var/run/asterisk/asterisk.ctl exist?)
The control file (/var/run/asterisk/asterisk.ctl
) did exist, but I wasn't able to write to it:
$ cd /var/run/asterisk/
$ ls -l asterisk.ctl
srwxr-xr-x 1 asterisk asterisk 0 Mar 23 00:23 asterisk.ctl
My user was part of the asterisk group, but needed write permission in order to connect to the running asterisk server.
The fix:
$ sudo chmod g+w asterisk.ctl
$ asterisk -r
Asterisk 1.4.30, Copyright (C) 1999 - 2010 Digium, Inc. and others.
Created by Mark Spencer
Asterisk comes with ABSOLUTELY NO WARRANTY; type 'core show warranty' for details. This is free software, with components licensed under the GNU General Public License version 2 and other licenses; you are welcome to redistribute it under certain conditions. Type 'core show license' for details.
=====================================================================
== Parsing '/etc/asterisk/extconfig.conf': Found
Connected to Asterisk 1.4.30 currently running on asterisk (pid = 29432)
Verbosity is at least 3
asterisk*CLI>
Further reading: Asterisk: The Definitive Guide
i tried these steps but the same problem,
also i found the permission resturns as before after executing :
asterisk service restart
You are correct that the permissions reset after a restart.
Two pieces of information would be helpful here:
1) Output of
ls -l /var/run/asterisk/asterisk.ctl
(or the equivalent on your system). FIXED2) Output of
id
.what you mean by output of asterisk.ctl and id??
-executing /var/run/asterisk.ctl gives:
gulfsipcom06:~# /var/run/asterisk.ctl
-bash: /var/run/asterisk.ctl: Permission denied
Sorry Mostafa, I mean `ls -l /var/run/asterisk.ctl`.
I apologize for the confusion.
So, to restate:
1) output of `ls -l /var/run/asterisk.ctl`, and
2) output of `id`.
it is the required output:
gulfsipcom06:~# id
uid=0(root) gid=0(root) groups=0(root)
gulfsipcom06:~# ls -l /var/run/asterisk.ctl
srwxr-xr-x 1 root root 0 Jul 20 19:13 /var/run/asterisk.ctl
If you get the "Unable to connect to remote asterisk" message when running the command as root, you are definitely experiencing a different. The issue mentioned here is related to trying to run the command as a non-root user and getting denied because of the permissions on the asterisk.ctl file.
Hello, i think that i noticed you visited my web site so i came to return the choose?.I am attempting to in finding issues to enhance my web site!I guess its adequate to use some of your concepts!!