【发布时间】:2020-08-03 05:26:13
【问题描述】:
我正在使用 SystemD 版本 241 和 Linux 内核版本 4.19.78 的嵌入式 Linux 平台工作。
我想用 D-Feet 远程检查各种 DBus 接口。
我过去曾使用 these 指令使用旧版本的 SystemD 完成此操作。
我创建了一个新的 DBus 配置文件/usr/share/dbus-1/system.d/d-feet.conf:
<listen>tcp:host=localhost,bind=*,port=55556,family=ipv4</listen>
<listen>unix:tmpdir=/tmp</listen>
<busconfig>
<auth>ANONYMOUS</auth>
<allow_anonymous/>
</busconfig>
当我运行netstat -plntu | grep 55556 时,我可以看到端口已绑定:
tcp6 0 0 :::55556 :::* LISTEN 1/init
我还编辑了 /lib/systemd/system/dbus.socket 文件:
[Unit]
Description=D-Bus System Message Bus Socket
[Socket]
ListenStream=/var/run/dbus/system_bus_socket
ListenStream=55556
但是,当我尝试从同一网络上的 Ubuntu 18.04 Linux 机器连接时,我发现它失败了,并且没有提供我定义的“匿名”身份验证方法:
can not connect to 'tcp:host=192.168.1.16,port=55556': g-io-error-quark: Exhausted all available authentication mechanisms (tried: EXTERNAL) (available: EXTERNAL) (0)
我怎样才能让它工作?谢谢。
更新:我尝试使用 '0.0.0.0' 作为绑定地址:
<listen>tcp:host=localhost,bind=0.0.0.0,port=55556,family=ipv4</listen>
<listen>unix:tmpdir=/tmp</listen>
<busconfig>
<auth>ANONYMOUS</auth>
<allow_anonymous/>
</busconfig>
但是,它仍然失败并出现同样的错误,systemctl show dbus.socket 的输出包括以下内容:
PassCredentials=no
PassSecurity=no
RemoveOnStop=no
Listen=/var/run/dbus/system_bus_socket (Stream)
Listen=[::]:55556 (Stream)
Mark=-1
MaxConnections=64
MaxConnectionsPerSource=0
MessageQueueMaxMessages=0
【问题讨论】:
-
请将配置改为
bind=0.0.0.0,然后运行systemctl daemon-reload和systemctl restart dbus.socket。然后用systemctl show dbus.socket的输出更新问题 -
嗨 - 感谢您的评论。我尝试了你的建议,不幸的是它仍然失败 - 但我在问题中粘贴了更多细节。
-
您使用哪个命令连接 DBus?
-
我在单独的 Ubuntu 18 机器上运行 D-Feet 并使用 tcp:host=192.168.1.16,port=55556
标签: linux embedded-linux dbus