6

免xauth进行X11转发

 2 years ago
source link: https://z-rui.github.io/post/2015/10/bypass-xauth/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

免xauth进行X11转发

Tue Oct 20, 2015

之前谈到如何通过SSH进行X11转发。其中有一个前提,即主机B上要装有xauth。事实上,X11的转发和普通的TCP端口转发并无差别。如果主机B中未安装xauth,则需要用户手动设置远程TCP端口转发,并设置主机B的DISPLAY变量:

hostA$ ssh -R6010:localhost:6000 user@hostB
hostB$ export DISPLAY=':10'

在图形界面客户端例如PuTTY或者Bitvise Tunnelier中,也都有远程TCP端口转发的设置。

在主机A中,仍然启动X服务器的TCP监听。不同的是,由于没有.Xauthority认证文件,需要用xhost允许本地主机(即SSH客户端)连接X服务器。在Cygwin中:

hostA$ startxwin -- :0 -multiwindow -listen tcp &
hostA$ xhost +localhost

具体采用哪一种办法见仁见智。建议在主机B中安装xauth,这样可以免去手工设置远程端口转发和DISPLAY变量。



About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK