I am trying to use gedit to see a file inside a mini-pc I connected through ssh but it get:

(gedit:3864): Gtk-WARNING **: Locale not supported by C library. Using the fallback 'C' locale. Failed to connect to Mir: Failed to connect to server socket: No such file or directory Unable to init server: Could not connect: Connection refused

(gedit:3864): Gtk-WARNING **: cannot open display:

Is there a way to see the file contents inside gedit in host computer?

  • No editor required : You can read a file with cat file-name. ( And you can edit a text file with e.g. sed or awk commands.) – Knud Larsen May 12 '18 at 12:51

Yes you can, but to achieve this, you need to meet several conditions:

  • allow X11 Forwarding in your SSH client (option -X or -Y if using openssh, or tick the option in SSH options if using putty for example)
  • have a X server on your client PC (for example if this is running on Windows, you can use Xming https://sourceforge.net/projects/xming/ , or cygwin)
  • allow X11 forwarding on the SSH server side (the mini-PC is I understand)
| improve this answer | |

This is because there is no x session for the TTY opened by the SSH connection.

You can specify it use the existing display with the w command and the PTY then set it as part of the session before running the application.

DISPLAY=:0 gedit
| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.