Linux X11 Connection Rejected Because of Wrong Authentication Error and Solution
I have setup X desktop and want to connect to the X server through ssh. As you know ssh provides X forwarding which is very useful feature and used a lot of system administrators.
Try To Connect Ssh X Forwarding
We will try to connect X service of remote ssh server by providing -X parameter.
$ ssh -X ubu1
We get an error like “Unable to init server: Could not connect: Connection refused” or “/usr/bin/xauth: /home/ismail/.Xauthority not writable, changes will be ignored”
Change Ownership Of Xauthority
We will change Xauthority file ownerhsip because it will used by the current user to read and write.
$ sudo chown ismail:ismail .Xauthority
Check Disk If It Is Full
One of the root cause of a lot of problems is fulling disk. It is hidden problem and generally do not show himself. We should all ways count this option for troubleshot.
$ df -lh
As we can see in the third line of output our root path have enough free space to run X
Check Ssh Server X Forwarding Setting
Ssh server configuration have a line X11Forwarding which enables or disable X11 forwarding. It may be disabled because of security reasons.
$ cat /etc/ssh/sshd_config | grep X11Forwarding
Check Ssh Client ForwardX11 Setting
The client side of ssh configuration also includes X11 forwarding. It shouldn’t be disabled or explicitly enabled like below.
$ cat /etc/ssh/ssh_config | grep ForwardX11
We should uncomment line ForwardX11 no and change to yes.