mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-01-13 22:30:37 +08:00
[Translated]Linux FAQs with Answers--How to fix “X11 forwarding request failed on channel 0″
This commit is contained in:
parent
afb6e81a92
commit
0871125a2a
@ -1,52 +0,0 @@
|
||||
Translating----------geekpi
|
||||
|
||||
|
||||
Linux FAQs with Answers--How to fix “X11 forwarding request failed on channel 0″
|
||||
================================================================================
|
||||
> **Question**: When I tried to SSH to a remote host with X11 forwarding option, I got "X11 forwarding request failed on channel 0" error after logging in. Why am I getting this error, and how can I fix this problem?
|
||||
|
||||
![](https://farm6.staticflickr.com/5562/14909594691_ce7ca01b2d_z.jpg)
|
||||
|
||||
First of all, we assume that you already enabled [X11 forwarding over SSH][1] properly.
|
||||
|
||||
If you are getting "X11 forwarding request failed on channel 0" message upon SSH login, there could be several reasons. Solutions vary as well.
|
||||
|
||||
### Solution One ###
|
||||
|
||||
For security reason, OpenSSH server, by default, binds X11 forwarding server to the local loopback address, and sets the hostname in DISPLAY environment variable to "localhost". Under this setup, some X11 clients cannot handle X11 forwarding properly, which causes the reported error. To fix this problem, add the following line in /etc/ssh/sshd_config file, which will let X11 forwarding server bind on the wild card address.
|
||||
|
||||
$ sudo vi /etc/ssh/sshd_config
|
||||
|
||||
----------
|
||||
|
||||
X11Forwarding yes
|
||||
X11UseLocalhost no
|
||||
|
||||
Restart SSH server to activate the change:
|
||||
|
||||
$ sudo /etc/init.d/ssh restart (Debian 6, Ubuntu or Linux Mint)
|
||||
$ sudo systemctl restart ssh.service (Debian 7, CentOS/RHEL 7, Fedora)
|
||||
$ sudo service sshd restart (CentOS/RHEL 6)
|
||||
|
||||
### Solution Two ###
|
||||
|
||||
The broken X11 forwarding error may also happen if the remote host where SSH server is running has IPv6 disabled. To fix the error in this case, open /etc/ssh/sshd_config file, and uncomment "AddressFamily all" (if any). Then add the following line. This will force SSH server to use IPv4 only, but not IPv6.
|
||||
|
||||
$ sudo vi /etc/ssh/sshd_config
|
||||
|
||||
----------
|
||||
|
||||
AddressFamily inet
|
||||
|
||||
Again, restart SSH server to finalize the change.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://ask.xmodulo.com/fix-broken-x11-forwarding-ssh.html
|
||||
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[1]:http://xmodulo.com/2012/11/how-to-enable-x11-forwarding-using-ssh.html
|
@ -0,0 +1,50 @@
|
||||
Linux FAQ -- 如何修复“X11 forwarding request failed on channel 0”错误
|
||||
================================================================================
|
||||
> **问题**: 当我尝试使用SSH的X11转发选项连接到远程主机时, 我在登录时遇到了一个 "X11 forwarding request failed on channel 0" (X11 转发请求在通道0上失败)的错误。 我为什么会遇到这个错误,并且该如何修复它
|
||||
|
||||
![](https://farm6.staticflickr.com/5562/14909594691_ce7ca01b2d_z.jpg)
|
||||
|
||||
首先,我们假设你已经正确启用了[SSH的X11转发][1]。
|
||||
|
||||
如果你在登录时遇到"X11 forwarding request failed on channel 0" (X11 转发请求在通道0上失败),这里可能有不同的原因,解决的方法也不同。
|
||||
|
||||
### 方案一 ###
|
||||
|
||||
出于安全原因,OpenSSH服务默认将X11转发请求绑定到本地回环地址上,并且在DISPLAY环境变量中将主机名设置为“localhost”。在这样的设定下,一些
|
||||
X11客户端不能正确处理X11转发,这会导致报告中的错误。要解决这个问题,在/etc/ssh/sshd配置文件中加入下面这几行,它可以将X11转发请求绑定到外网卡地址上。
|
||||
|
||||
$ sudo vi /etc/ssh/sshd_config
|
||||
|
||||
----------
|
||||
|
||||
X11Forwarding yes
|
||||
X11UseLocalhost no
|
||||
|
||||
重启SSH使设置生效:
|
||||
|
||||
$ sudo /etc/init.d/ssh restart (Debian 6, Ubuntu or Linux Mint)
|
||||
$ sudo systemctl restart ssh.service (Debian 7, CentOS/RHEL 7, Fedora)
|
||||
$ sudo service sshd restart (CentOS/RHEL 6)
|
||||
|
||||
### 方案而 ###
|
||||
|
||||
如果远程主机的SSH服务禁止了IPv6,那么X11转发失败的错误也有可能发生。要解决这个情况下的错误。打开/etc/ssh/sshd配置文件,打开"AddressFamily all" (如果有的话)的注释。接着加入下面这行。这会强制SSH服务只使用IPv4而不是IPv6。
|
||||
|
||||
$ sudo vi /etc/ssh/sshd_config
|
||||
|
||||
----------
|
||||
|
||||
AddressFamily inet
|
||||
|
||||
再说一次,重启SSH服务来完成设置
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://ask.xmodulo.com/fix-broken-x11-forwarding-ssh.html
|
||||
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[1]:http://xmodulo.com/2012/11/how-to-enable-x11-forwarding-using-ssh.html
|
Loading…
Reference in New Issue
Block a user