Ubuntu – Cannot use gedit on multiple remote machines using ssh

geditsshx11-forwarding

After setting up the last of my 5 remote machines, I decided to test that the network was working well by connecting to each and opening gedit.

To my dismay, when I tried to open gedit on the second machine, I was greeted with:

** (gedit:1862): WARNING **; Could not connect: Connection refused

** (gedit:1862): WARNING **; Could not connect to session bus

Closing gedit didn't help, but when I closed my ssh connection to the first remote machine, I was able to open gedit on the second. I decided to check if this was a problem with all X programs, but I was able to open xeyes on multiple remote machines.

My question is, why does remotely opening gedit on one machine prevent me from opening it on another until the first ssh session is closed? And is there a way to fix this or a workaround? I don't need to have multiple gedits open at once, but I'd least like to be able to not have to close the connection to one of the machines before I can open it on another.

My ssh_config is set up with 'ForwardX11' and 'ForwardX11Trusted' both set to yes, in case this is pertinent.

Update: I decided to try a few more programs, and found that while I can have nautilus open through ssh on multiple machines, I get a number of the connection refused warnings before it opens.

Best Answer

export $(dbus-launch) on the remote machine solved this problem for me.

Related Question