I have a script, simply to run my Graphical (GUI) Application, as below.

#cat gui.sh
./gui -display    

When I run it from local machine (./gui.sh) it runs perfectly fine. But when I am trying to run it from remote machine via ssh, I got following error.

[root@localhost]# ssh -f "cd /root/Desktop/GUI/ && "./gui.sh""   
No protocol specified  
gdm: cannot connect to X server   

I don't know, which protocol it is asking or am I missing anything? I tried directly by starting the application, without script [ssh -f "cd /root/Desktop/GUI/ && "./gui""], but the result is same. I have tried various combinations like ssh -Y, ssh -fY and more but the result is same!
Secondly for my application, there is a must condition that, we have to first go into the directory where the program is located.
Any Solutions?


5 Answers 5


This video explains how to solve the error step by step. If you don't wan't to watch then follow the text below:

The No protocol specified error indicates that "the user doesn't know how to launch a GUI application" and the "user doesn't have permissions to launch a GUI application". In the video the GUI application is dbca.

The key piece of this video is in running the command xhost + which grants the user permissions to remotely display a GUI from a remote system, to the local system.

  • 12
    xhost + will give access to anybody to connect to your display. I would recommend xhost +local:[hostname or ip]
    – vimdude
    Apr 21, 2015 at 12:58
  • This and this is what fixed the error for me. +1
    – Yug Singh
    Jan 7, 2020 at 9:32

The meaning of the option -display depends on that gui program, but it's highly likely that it means “display on the X display”. This is the first local X display, accessed over TCP. This is almost certainly wrong for two reasons. First, the local X display should be :0, not, because including an IP address causes the traffic to go through TCP instead of local access. Going through TCP may not work depending on whether the X server accepts TCP connections. Even if it does, you lose the optimizations that local displays have.

The display to use is normally indicated by the DISPLAY environment variable, and that variable tends to be set correctly automatically. (Usually, if DISPLAY has the wrong value, it's because you've been messing with it. The main exception is use of screen or tmux.)

Your program probably does look up the value of the DISPLAY environment variable, because that tends to happen automatically with xlib calls. So you should just call ./gui, your script doesn't do anything useful. If your program insists on the -display argument, make it use the environment variable:

./gui -display "$DISPLAY"

ssh -Y and ssh -X should be a good start but did you forward your X server as well?

$ grep X /etc/ssh/sshd_config
X11Forwarding yes

otherwise it won't work.

Another thing to check is the DISPLAY variable it should show something like this:

$ echo $DISPLAY
$ localhost:10.0

this was run after ssh -Y. The same variable is empty if I ssh without -Y or -X.

For differences between -X and -Y read the man page of ssh.


Debian Jessie, add also:

export XAUTHORITY=/.Xauthority
  • xhost + fixed my problem (on the client side) Apr 24, 2018 at 11:31
  • 1
    That helped, thank you! My XAUTHORITY was /tmp/xauth-1000-_0 but after starting two additional X sessions that file had disappeared - only the third one remained. To fix the problem for all windows I restored it with: ln -s ~/.Xauthority /tmp/xauth-1000-_0 Dec 21, 2018 at 0:54

I was hit by same issue I resolved it by changing the DISPLAY environment variable from:

export DISPLAY=:0.0


export DISPLAY=:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .