在使用 dbus时,bus type 是system, dbus-daemon 也是以–system 模式拉起的。运行某个客户端,向dbus 建立链接,并输出bus name 时,出现如下错误:
org.freedesktop.DBus.Error.AccessDenied
修改system.conf中如下部分
<!-- Holes must be punched in service configuration files for
name ownership and sending method calls -->
<deny own="*"/>
<deny send_type="method_call"/>
为
<!-- Holes must be punched in service configuration files for
name ownership and sending method calls -->
<allow own="*"/>
<allow send_type="method_call"/>
或者增加配置文xxx.conf件到/etc/dbus-1/system.d/ 目录下
<!DOCTYPE busconfig PUBLIC
"-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>
<!-- Only root and devel can own the service -->
<policy user="root">
<allow own="com.aa.xxxx.camera"/>
<allow send_destination="com.aa.xxxx.camera"/>
<allow send_interface="com.aa.xxxx.camera"/>
</policy>
</busconfig>
来源:CSDN
作者:noyoghurt
链接:https://blog.csdn.net/yager0203/article/details/89321999