Can't open GUI from Bash from Windows in remote server via ssh -X

5,898

I finally managed to solve the problem. These are the steps:

  1. Install Xming or any similar X server to Windows 10.
  2. Open up Bash for Windows and configure the display ENV variable by adding it to your .bashrc:

    echo "export DISPLAY=localhost:0.0" >> ~/.bashrc
    
  3. With Xming running in Window's background, ssh -X the desired remote host and run GUI applications normally.

Share:
5,898

Related videos on Youtube

DogTag
Author by

DogTag

Currently studying Telecommunications Engineering at UPCT (Universidad Politécnica de Cartagena). Electronics and music lover.

Updated on September 18, 2022

Comments

  • DogTag
    DogTag over 1 year

    I am trying to open applications with GUI on a remote server from bash for Windows 10. By just inputting "gedit", I get the following error message:

    Unable to init server: Could not connect: Connection refused
    (gedit:2089): Gtk-WARNING **: cannot open display:
    

    I have tried several suggestions in other questions but nothing seems to work. I assume the problem must be in the server, since I am able to open atom on local files in bash for Windows, for example. For reference, the server is running a fresh install of Ubuntu 17.04. I currently have Xming installed and running on my Windows machine.

    UPDATE: I have been able to run GUI applications using PuTTy, so the problem is definetely on Bash for Windows.

    • DogTag
      DogTag over 6 years
      I have Xming currently installed and running on Windows. That is the reason why I believe it has something to do with the remote. I will update my question with this detail.