'dbus: difference between system bus and session bus

I do not understand the difference between DBus system bus and session bus. For example, when I run the command

$ dbus-daemon --<session/system> --print-address --fork

it seems to me that the situation is as follows (please correct me if and where I am wrong):

  • There is no principle difference between these buses. This magical word in options is only a refence to the file name in /usr/share/dbus-1/. If we start dbus-daemon with the option --session then settings from /usr/share/dbus-1/session.conf are used, and for --system settings from /usr/share/dbus-1/system.conf are used. But this is a difference only in settings...

  • There is no difference in using these buses. For both we need to use --print-address when starting the daemon and this address has to be passed somehow to all programs, which are going to use DBus. The system bus seems to not have a special pre-defined address, that is known to all clients.

If the statements above are true, then what is the difference between these types of DBus? Is it like some agreement, that the word system will be used for one group of communications and the word session will be used for some other group of communications? We can definitely start several buses by calling several times

$ ADDRESS1=$(dbus-daemon --session --print-address --fork)
$ ADDRESS2=$(dbus-daemon --session --print-address --fork)
...

And then use several independent session buses. Can we do the same for system bus?

Sorry for so many questions...



Solution 1:[1]

There is one system bus, and it runs as a system-level service. System-wide services are accessible on it.

There are zero or more session buses, one for each user session. They run as the user, and do not have elevated privileges. The user’s applications are accessible on each of them (to other applications within that user session).

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Philip Withnall