I am getting a error while accessing the firefox using X11Forwarding.
[root@station2 ~]# firefox
KiTTY X11 proxy: wrong authorisation protocol attemptedKiTTY X11 proxy: wrong authorisation protocol attemptedError: cannot open display: localhost:10.0
setup the following values: /etc/ssh/sshd_config
X11Forwarding yes
X11DisplayOffset 10
X11UseLocalhost yes
** Installed the package**
#yum install xorg-x11-xauth
#yum -y install xauth
[root@station2 .ssh]# echo $DISPLAY
localhost:10.0
#mkxauth -c
adding key for station2.example.com to /root/.Xauthority ... done
A bad authentication credential indicates that the client (in most instances, the web browser) has requested a restricted resource (such as a web page) from the server but has failed to provide sufficient authentication credentials, as mentioned in the introductory paragraphs.
Overview. The X Window System (also known as X11, or just X) is a software package and network protocol that lets you interact locally, using your personal computer's display, mouse, and keyboard, with the graphical user interface (GUI) of an application running on a remote networked computer.
export XAUTHORITY=$HOME/.Xauthority
This fix worked for me
There is a hard, if not even impossible, to find (by search engine) scenario that may may cause that error message.
Preliminary note: The topic of this answer is not to discuss if it is a safety risc or recommondable at all to use a graphical desktop as root on an remote, display-less, webserver.
Scenario:
example
.127.0.0.1 localhost example.com example
.DenyUsers root
in /etc/ssh/sshd_config, but
allowed for a dummy user user1
. From a client computer C a ssh
connection, using the ssh parameter -X
or -Y
, is established to S
as user user1
.Then, in a remote terminal on S owned by user1, if any X11 related command is tried to be executed as root, may it be by
su
, then trying to start the X11 desktop environment
or, as in the concrete case executing a script containing
#!/bin/bash
su --preserve-environment -c "xfce4-session &" root
the error message
X11 connection rejected because of wrong authentication.
is output and the start of any X11 related program fails. The DISPLAY variable of root's environment contains
example.com:10.0
then.
One solution to the problem is, in this special case, to modify the line
127.0.0.1 localhost example.com example
in /etc/hosts to
127.0.0.1 localhost
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With