Reputation: 650
I connect to my remote computer with :
self.client = paramiko.SSHClient()
self.client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
self.client.connect(hostname=ip_address, username=self.user, password=self.password, look_for_keys=False)
When I send commands :
chan = self.client.get_transport().open_session(timeout=timeout)
chan.request_x11()
chan.settimeout(timeout)
chan.exec_command(command)
stdin = chan.makefile('wb', -1)
stdout = chan.makefile('r', -1)
stderr = chan.makefile_stderr('r', -1)
return stdin, stdout, stderr
If I do not use this line :
chan.request_x11()
I tried using :
self.client.exec_command(command)
but same error
I get the error message from the title. When I use the line I get a timeout connection when trying to read from stdout. I tried setting
DISPLAY=:0
Did nothing. I'm trying to send dbus commands through ssh. When I connect in ssh manually through the terminal I can use the -X or not use it and I can use my dbus calls it does not matter.
Upvotes: 3
Views: 2457
Reputation: 437
To use Dbus from Shell without X11/Display. Dbus need to know DBUS_SESSION_BUS_ADDRESS. so either you export this or export DISPLAY...
1) Export DBUS_SESSION_BUS_ADDRESS method.
First Launch server. eval 'dbus-launch --auto-syntax ' ./server
from the server environ (/proc/pid-server/environ) you can get DBUS_SESSION_BUS_ADDRESS. Export that value in your shell where you are launching client program, launch client ./client ... It should work without problem.
Upvotes: 1