Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have set ForwardX11 yes in /etc/ssh/ssh_config which normally enables me to open GUI programs on CentOS5 by ssh -X server

But doing the same on CentOS6 I get

# firefox -no-remote
Error: no display specified
# 

What could be wrong?

Update

Have tried the following

# firefox -no-remote
Error: no display specified
# echo $DISPLAY

# export DISPLAY=localhost:0.0
# echo $DISPLAY
localhost:0.0
# firefox -no-remote
Error: cannot open display: localhost:0.0
# 

Update 2

~$ echo $DISPLAY
:0.0
~$ export DISPLAY=localhost:0.0
~$ ssh -X root@net2
[root@net2 ~]# xclock 
Error: Can't open display: 
[root@net2 ~]# 
share|improve this question
add comment

closed as off-topic by Magellan, Jenny D, mdpc, Nathan C, Scott Pack Oct 11 '13 at 0:57

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions must demonstrate a minimal understanding of the problem being solved. Try including attempted solutions, why they didn't work, and the expected results. See How can I ask better questions on Server Fault? for further guidance." – Magellan, Jenny D, mdpc, Nathan C, Scott Pack
If this question can be reworded to fit the rules in the help center, please edit the question.

2 Answers

up vote 7 down vote accepted

After changing the ForwardX11 to yes, have you restarted the sshd server? That is, by typing:

# /etc/init.d/sshd restart 

Also you might try getting something simpler like xclock working first, to isolate whether it's firefox related (to prove at least your remote X11 is working fine).

# /usr/bin/xclock &

You might need to install it first.

# yum install xorg-x11-xauth

After installing xorg-x11-xauth, exit the X11 window, then log back in as you did above. Then you can do:

# yum install xclock
# /usr/bin/xclock &

You might also need to use xhost. I believe it's inside xorg-x11-server-utils.

# yum install xorg-x11-server-utils
# xhost + enter.your.server.address.com

If that works for you, then it's a Firefox setup issue. It may be a security related issue you need to bypass to get Firefox working remotely as you're trying to do. I recall having to set something internal to Firefox to remotely access it over SSH as you're trying to do. In the end it was so slow to use (after I got it working), I gave up using it.

share|improve this answer
    
yum install xorg-x11-xauth did the trick. =) –  Sandra Feb 7 '12 at 10:01
add comment

The hash mark for the prompt suggests that you've done an su or sudo in a terminal? Or are you running in your GUI as root?

In any case, you need to have the DISPLAY variable set before initiating the SSH connection. Something like export DISPLAY=localhost:0.0, though that will depend on how you're running your local X server.

You can check if the variable is set in the prompt by running echo $DISPLAY. It should return something.

share|improve this answer
    
I have just tried your suggestion, and updated the post accordingly. I get the same error. –  Sandra Feb 6 '12 at 16:11
1  
I think the DISPLAY is set in the wrong machine, given your update. What's the sequence of events? You open a terminal, then do an ssh to the remote box, then try to start Firefox on that box? After you open the terminal, but before you run ssh, check you DISPLAY setting. Don't do it after you ssh. –  cjc Feb 6 '12 at 16:26
    
I have now tried that, and updated the post. So when a SSH connection is established, the $DISPLAY variable from the local machine is passed along to the remote machine? Is that how $DISPLAY works? –  Sandra Feb 7 '12 at 10:13
1  
The DISPLAY variable tells an X client what X server to connect to. With SSH X forwarding, the remote SSH session will set a fake DISPLAY variable that points to the SSH X forwarding port, which will tunnel to the local X server. The DISPLAY variable needs to be set before you SSH, otherwise the X forwarding will not know how to construct the tunnel and set the remote DISPLAY variable. In your update, it said that the DISPLAY was set to ":0.0". That's fine; no need to change it in that case. –  cjc Feb 7 '12 at 10:21
add comment

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