Skip to main content
Topic: Running DBus on IP port as non-root user. (Read 513 times) previous topic - next topic
0 Members and 3 Guests are viewing this topic.

Running DBus on IP port as non-root user.

Good evening,

I've got a problem while trying to run DBus Daemon as dbus user on port 2426.
In short - when I'm trying to connect to it, I'm getting empty response although nmap shows the port as open.
When I start DBus Daemon as root when it starts replying over port 2426.
What's wrong?

Config(s):
 - dbus.conf
Code: [Select]
<!DOCTYPE busconfig PUBLIC
          "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
          "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>
  <listen>tcp:host=0.0.0.0,port=2426</listen>
  <!-- Only root or user avahi can own the Avahi service -->
  <policy user="avahi">
    <allow own="org.freedesktop.Avahi"/>
  </policy>
  <policy user="root">
    <allow own="org.freedesktop.Avahi"/>
  </policy>
  <policy group="dbus">
    <allow own="org.freedesktop.DBus"/>
  </policy>
  <policy group="network">
    <allow own="org.freedesktop.DBus"/>
  </policy>

  <!-- Allow anyone to invoke methods on Avahi server, except SetHostName -->
  <policy context="default">
    <allow send_destination="org.freedesktop.Avahi"/>
    <allow receive_sender="org.freedesktop.Avahi"/>
    <allow send_destination="org.freedesktop.DBus"/>
    <allow receive_sender="org.freedesktop.DBus"/>
  </policy>

  <!-- Allow everything, including access to SetHostName to users of the group "network" -->
  <policy group="network">
    <allow send_destination="org.freedesktop.Avahi"/>
    <allow receive_sender="org.freedesktop.Avahi"/>
    <allow send_destination="org.freedesktop.DBus"/>
    <allow receive_sender="org.freedesktop.DBus"/>
  </policy>
  <policy group="dbus">
    <allow send_destination="org.freedesktop.DBus"/>
    <allow receive_sender="org.freedesktop.DBus"/>
  </policy>
  <policy user="root">
    <allow send_destination="org.freedesktop.Avahi"/>
    <allow receive_sender="org.freedesktop.Avahi"/>
  </policy>
</busconfig>

 - DBus Daemon launch command:
Code: [Select]
sudo -u dbus dbus-daemon --config-file /path/to/dbus.conf --nofork --syslog --print-address

 - DBus Test Tool response:
Code: [Select]
~> DBUS_SESSION_BUS_ADDRESS="tcp:host=127.0.0.1,port=2426" dbus-test-tool echo
Failed to connect to bus: org.freedesktop.DBus.Error.NoReply: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.

There's nothing inside syslog log files even if dbus is in both network & log group.

Re: Running DBus on IP port as non-root user.

Reply #1
It might be something related to the communication with elogind, but not sure.

Also when running dbus-daemon as root, if refuses non-root users from connecting.

Re: Running DBus on IP port as non-root user.

Reply #2
What are you actually trying to do ?
dbus is normally started as a system service by your init.

Your user gets/needs another dbus session. I think most Display Managers sort this out for you.
If using startx you might have to create it yourself. It seems to vary based on the DE.

Whatever is in ~/.xinitrc that starts your desktop gets edited to start a dbus session
So for example
Code: [Select]
exec startlxqt
becomes
Code: [Select]
exec dbus-launch --exit-with-session startlxqt

Re: Running DBus on IP port as non-root user.

Reply #3
I'm trying to serve another D-Bus session separately from the system D-Bus on a server port.