Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot open display on RHEL

I am trying to ssh to a server (myserver) installed with RHEL 5.8 from a desktop client (mydesktop) with RHEL 6.2. I have group installed the "X Window" on the remote server, the DISPLAY variable on the remote server is also set to be localhost:0.0, but I still cannot get firefox started. The command to connect is

$ ssh -X -l myname myserver

The error message is

$ firefox
Error: cannot open display: localhost:0.0

I tried to execute the command on myserver below

$ xhost +localhost

but it gives me an error message

xhost:  unable to open display "localhost:0.0"

There are three phenomena I want to mention

  1. another user of mydesktop is able to start firefox after logging into myserver.
  2. I was able to start firefox when I remotely logged into another server: myserver2.
  3. firefox is just an example. In general, I cannot launch any x window programs.

I have no idea what is going on. Please help me.


This is an update of my problem. The problem was solved "partially". What I did was to delete the "export DISPLAY==localhost:0.0" from my ".bashrc" file, logout and then login again and I can start firefox!!!


However, this is not the end of the story. I have a new problem: $ sudo wireshark

does not work. Here is the error message:

[myself@myserver ~]$ sudo wireshark
debug1: client_input_channel_open: ctype x11 rchan 2 win 65536 max 16384
debug1: client_request_x11: request from 127.0.0.1 46595
debug1: channel 1: new [x11]
debug1: confirm x11
debug1: client_input_channel_open: ctype x11 rchan 3 win 65536 max 16384
debug1: client_request_x11: request from 127.0.0.1 46596
debug1: channel 2: new [x11]
debug1: confirm x11
X11 connection rejected because of wrong authentication.
debug1: channel 2: free: x11, nchannels 3
The application 'wireshark' lost its connection to the display localhost:10.0;
most likely the X server was shut down or you killed/destroyed
the application.
debug1: channel 1: FORCE input drain

Why can't I start x window under sudo?

like image 468
fanchyna Avatar asked Dec 17 '12 19:12

fanchyna


1 Answers

The problem is solved by doing the following two things:

  1. commenting out the export DISPLAY=Localhost:10.0 from my .bashrc file. I think this is because I overwrites the default value of DISPLAY environmental variable. By doing this, I am able to start 'firefox' under my regular account.
  2. logout, login and add export XAUTHORITY='/home/myself/.xauthority into my .bashrc file. Then logout and login again so that I can run sudo wireshark.

The -v option in the ssh command is very useful when diagnosing the problem.

like image 180
fanchyna Avatar answered Sep 21 '22 14:09

fanchyna