X11 forwarding request failed on channel 0

这一生的挚爱 提交于 2020-06-24 08:24:22

问题


When I do "ssh -X abcserver", I got message "X11 forwarding request failed on channel 0". I checked online and it was suggested to solve it by switching "X11UseLocalhost no" to "X11UseLocalhost yes".

However, both my manager and I don't have this administrative privilege. I am wondering, except this solution, whether there is another option to solve the issue ? I also don't have sudo privilege to directly install X11 on the server.

My local platform is:

Linux version 3.16.0-4-amd64 (debian-kernel@lists.debian.org)
(gcc version 4.8.4 (Debian 4.8.4-1) ) #1 SMP Debian 3.16.7-ckt25-2+deb8u3 (2016-07-02)

The remote platform is:

Linux version 3.13.0-88-generic (buildd@lgw01-16) 
(gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04.3) ) 
#135-Ubuntu SMP Wed Jun 8 21:10:42 UTC 2016

回答1:


Adding the -v option to ssh when trying to log in will give a lot of debug information which might give a clue to exactly what the problem is, like for instance

debug1: Remote: No xauth program; cannot forward with spoofing.

which in my case installing xauth on the server fixed the issue.




回答2:


I had to edit the sshd config file on the remote server to fix the issue. It worked on Ubuntu 16.04 Server:

$ sudo vim /etc/ssh/sshd_config

Set X11UseLocalhost no

Save the file.

$ sudo service sshd restart

$ exit

Now it works!

ssh -X user@remotehost
$ xclock




回答3:


1.make sure that during ssh -X root@server you have root permission.

2.update the /etc/ssh/sshd_config and make sure this line is uncommented

    X11Forwarding yes

3.systemctl restart sshd

4.exit from server

5.ssh -X root@server

6.virt-manager




回答4:


  1. sudo apt install xauth
  2. change the line #AddressFamily any to AddressFamily inet in /etc/ssh/sshd_config
  3. sudo service ssh restart

This is enough on Ubuntu 18.04 LTS.

After login with ssh -X (or after activating the PuTTY / KiTTY option "Enable X11 forwarding") you should see that the environment variable DISPLAY is automatically defined to localhost:10.0 or similar. After first successful login (with a functional X11 forwarding) the file .Xauthority will be generated. Another positive sign of success.

If you are interested to see and to understand the details of X11 forwarding within your session you can try with lsof -i -P|grep ssh.



来源:https://stackoverflow.com/questions/38961495/x11-forwarding-request-failed-on-channel-0

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!