Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

/var/run/kamailio/ owned by root after Kamailio start #2334

Closed
arkadiam opened this issue May 20, 2020 · 3 comments
Closed

/var/run/kamailio/ owned by root after Kamailio start #2334

arkadiam opened this issue May 20, 2020 · 3 comments

Comments

@arkadiam
Copy link

Environment:

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04.6 LTS"

Kamailio installed from:

/etc/apt/sources.list
deb     http://deb.kamailio.org/kamailio53 xenial main
deb-src http://deb.kamailio.org/kamailio53 xenial main

After Kamailio start, ownership of /var/run/kamailio/ and related files looks like:

# ls -l  /var/run/kamailio/
total 4
srw-rw---- 1 kamailio kamailio 0 May 20 15:41 kamailio_ctl
-rw-r--r-- 1 kamailio kamailio 5 May 20 15:41 kamailio.pid
prw-rw---- 1 root     root     0 May 20 15:41 kamailio_rpc.fifo
srw-rw---- 1 root     root     0 May 20 15:41 kamailio_rpc.sock
# ls -ld  /var/run/kamailio/
drwxr-x--- 2 root root 120 May 20 15:41 /var/run/kamailio/

Note 'root' ownership.
This causes these errors during Kamailio stop and probabaly some other issues too.

May 20 16:11:24 sip01 /usr/sbin/kamailio[5919]: ERROR: jsonrpcs [jsonrpcs_fifo.c:599]: jsonrpc_fifo_destroy(): FIFO stat failed: Permission denied
May 20 16:11:24 sip01 /usr/sbin/kamailio[5919]: ERROR: jsonrpcs [jsonrpcs_sock.c:516]: jsonrpc_dgram_destroy(): socket stat failed: Permission denied
May 20 16:11:24 sip01 /usr/sbin/kamailio[5919]: ERROR: ctl [ctl.c:390]: mod_destroy(): ERROR: ctl: could not delete unix socket /var/run/kamailio//kamailio_ctl: Permission denied (13)

To get the ownership right I have to modify /lib/systemd/system/kamailio.service
and add:

User=kamailio
Group=kamailio

Now ownership after start looks like bellow and stops are clean too.

# ls -l  /var/run/kamailio/
total 4
srw-rw---- 1 kamailio kamailio 0 May 20 15:52 kamailio_ctl
-rw-r--r-- 1 kamailio kamailio 5 May 20 15:52 kamailio.pid
prw-rw---- 1 kamailio kamailio 0 May 20 15:52 kamailio_rpc.fifo
srw-rw---- 1 kamailio kamailio 0 May 20 15:52 kamailio_rpc.sock
# ls -ld  /var/run/kamailio/
drwxr-x--- 2 kamailio kamailio 120 May 20 15:52 /var/run/kamailio/
@miconda
Copy link
Member

miconda commented May 22, 2020

@linuxmaniac, @sergey-safarov - is it something that has to be done in systemd unit files?

The jsonrpcs module has also params to set user/group as well -- iirc the values should be inherited from the core user/group, if not set explicitely.

@sergey-safarov
Copy link
Member

Suggested modification already done for RPM packaging.

@linuxmaniac
Copy link
Member

this was already at master, backported to 5.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants