[Home]

Summary:ASTERISK-04806: Can not connect with asterisk -r when asterisk is running as non-root
Reporter:Bogdan (bogc66)Labels:
Date Opened:2005-08-10 14:19:51Date Closed:2011-06-07 14:02:44
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Core/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:Although all permissions are setup correctly, if asterisk is started as:

asterisk -U asterisk -G asterisk -vvvg -c

(the command line arguments are not important, important is the user and group)

I can not connect to the console with asterisk -r. strace reports:

mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7ffd000
read(3, "[settings]\n\n;uncomment to load q"..., 4096) = 85
read(3, "", 4096)                       = 0
close(3)                                = 0
munmap(0xb7ffd000, 4096)                = 0
socket(PF_FILE, SOCK_STREAM, 0)         = 3
connect(3, {sa_family=AF_FILE, path="/var/run/asterisk.ctl"}, 110) = -1 ECONNREFUSED (Connection refused)
close(3)                                = 0
time([1123701082])                      = 1123701082
open("/etc/localtime", O_RDONLY)        = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=798, ...}) = 0
fstat64(3, {st_mode=S_IFREG|0644, st_size=798, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7ffd000
read(3, "TZif\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\7\0\0\0\7\0"..., 4096) = 798
close(3)                                = 0
munmap(0xb7ffd000, 4096)                = 0
stat64("/etc/localtime", {st_mode=S_IFREG|0644, st_size=798, ...}) = 0
stat64("/etc/localtime", {st_mode=S_IFREG|0644, st_size=798, ...}) = 0
stat64("/etc/localtime", {st_mode=S_IFREG|0644, st_size=798, ...}) = 0
fstat64(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 1), ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7ffd000
write(1, "Unable to connect to remote aste"..., 37Unable to connect to remote asterisk
) = 37
munmap(0xb7ffd000, 4096)                = 0
exit_group(1)                           = ?


On asterisk.ctl:

srwxr-xr-x  1 asterisk asterisk 0 Aug 10 22:09 /var/run/asterisk.ctl

The connect does not work when I am looged with asterisk or root user.


****** ADDITIONAL INFORMATION ******


If I start asterisk as root, there is no problem.
Comments:By: Mark Spencer (markster) 2005-08-11 13:57:24

This is a simple permissions problem on /var/run, not an asterisk issue.

By: Bogdan (bogc66) 2005-08-11 16:54:44

I made other tests and I do not think that it's a permissions problem. If you think that it is, can you please let me know what's the issue?

By: Mark Spencer (markster) 2005-08-11 23:05:50

On my test system /var/run had to be writable by user asterisk.  I was able to then run asterisk and connect without a problem.  Please do not reopen this bug without speaking to someone in #asterisk or #asterisk-bugs first.