ssh X11转发赢得';行不通
我一直在尝试从我的笔记本电脑上进行X11端口转发。我不明白为什么它不起作用 我在尝试运行xterm时收到以下消息:ssh X11转发赢得';行不通,ssh,x11-forwarding,Ssh,X11 Forwarding,我一直在尝试从我的笔记本电脑上进行X11端口转发。我不明白为什么它不起作用 我在尝试运行xterm时收到以下消息: X11 connection rejected because of wrong authentication. xterm Xt error: Can't open display: localhost:10.0 我不知道这是否相关,但当我登录时,我收到以下消息: /usr/bin/xauth: timeout in locking authority file /home/
X11 connection rejected because of wrong authentication.
xterm Xt error: Can't open display: localhost:10.0
我不知道这是否相关,但当我登录时,我收到以下消息:
/usr/bin/xauth: timeout in locking authority file /home/sphillips/.Xauthority
我想知道问题是不是我笔记本电脑上的本地用户是skp,而这个服务器上的用户名是sphillips。我已经能够让X11转发与使用相同skp登录的其他计算机一起工作
此外,X11端口使用Xming和Putty从Windows机器转发到同一服务器。我必须手动将DISPLAY变量配置为IP地址并显示0.0,但它可以工作
我在我的机器上运行了xhost+,试图绕过任何安全问题。那仍然不起作用
在服务器上,我检查配置:
$ sudo grep X11Forwarding /etc/ssh/sshd_config
#X11Forwarding no
X11Forwarding yes
# X11Forwarding no
在我的机器上:
$ sudo grep X11Forwarding /etc/ssh/sshd_config
[sudo] password for skp:
#X11Forwarding no
X11Forwarding yes
# X11Forwarding no
我的服务器是RedHat Enterprise Linux 6,笔记本电脑是Fedora 15
有谁能给我一些想法,让SSH X11转发从我的笔记本电脑开始工作吗?我在Debian OpenVZ容器上遇到了同样的问题,问题似乎来自我的/etc/hosts文件,其中“localhost”受LAN IP影响,而不是127.0.0.1 之前:
192.168.0.15 dagi dagi.domain.net localhost localhost.localdomain
之后:
192.168.0.15 dagi dagi.domain.net
127.0.0.1 localhost localhost.localdomain
在那之后,
ssh-X
和ssh-Y
在没有重新启动sshd的情况下都发挥了巨大的作用。我终于找到了答案(至少就我的情况而言)!问题是塞利努克斯。我关闭了SELinux,它工作起来没有问题
如果你对这些血淋淋的细节感兴趣的话,你可以继续读下去,但让我在这里详细介绍一下相关的事实
在远程机器上,我使用dmesg查看日志消息:
dmesg | tail
我发现了很多这样的信息:
type=1400 audit(1332520527.110:51337): avc: denied { read } for pid=25240 comm="sshd" name="authorized_keys" dev=dm-5 ino=167 scontext=unconfined_u:system_r:sshd_t:s0-s0:c0.c1023 tcontext=unconfined_u:object_r:home_root_t:s0 tclass=file
您可以使用以下命令检查SELinux的状态:
$ sestatus
SELinux status: enabled
SELinuxfs mount: /selinux
Current mode: permissive
Mode from config file: permissive
Policy version: 24
Policy from config file: targeted
setenforce 0
您可以使用以下命令将其转换为许可模式:
$ sestatus
SELinux status: enabled
SELinuxfs mount: /selinux
Current mode: permissive
Mode from config file: permissive
Policy version: 24
Policy from config file: targeted
setenforce 0
有关SELinux的更多信息,我发现。另外,对于其他SSH问题,我发现日志记录有助于提供帮助
对我来说,在那之后,我的X11转发开始工作,没有任何问题
SELinux正在阻止其他一些不同的事情。它无法创建使密钥身份验证工作的必要文件。我还发现它阻止了ssh keygen在主目录中创建密钥。除了上面的@Chl答案之外,我还有一个损坏的~/.Xauthority文件
sudo grep X11Forwarding /etc/ssh/sshd_config
X11Forwarding yes
#sestatus
SELinux status: enabled
SELinuxfs mount: /selinux
Current mode: permissive
Mode from config file: permissive
Policy version: 24
Policy from config file: targeted
#You can turn it to permissive mode with this command:
#setenforce 0
出于某种原因,它甚至在我的主目录下也归root所有。所以我不得不sudo-s
,然后把它删除了
然后用touch~/.Xauthority
在那之后,X转发在Ubuntu 14.04下为我工作。我也遇到了这个问题。但就我而言,这是因为我几天前删除了IPv6支持。然后我无意中解释了如何确保sshd只使用IPv4 我就是这样做的,加上:
AddressFamily inet
到你的ssh_配置文件(在Ubuntu/etc/ssh/sshd_配置上),让sshd重新加载它的配置(sshd的kill-SIGHUP pid)。我为此获得了风滚草徽章!这是坏事还是好事?我只是希望有人能想到我还可以尝试些什么。谢谢Chi——这是一个很好的建议。我确实有这个问题。笔记本电脑上的My/etc/hosts将主机指向127.0.0.1。但是,我改变了它,它仍然没有改变。我实际上试过了所有3个IP地址。我尝试了硬连线IP、无线IP和VPN(tun0-00)。我仍然得到了相同的结果。Thnks Chi——这为我节省了很多时间。而且谷歌计算引擎最新的Ubuntu启动盘映像在尝试使用Putty进行ssh时需要这行代码!我花了一个工作日来解决这个问题。您可以使用
ssh
cli args-o“AddressFamily inet”
来测试这一点。类似地,我没有~/.Xauthority
文件,创建它(空)解决了问题。