700字范文,内容丰富有趣,生活中的好帮手!
700字范文 > Windows利用SSH - X远程登录Linux主机(X11-forwarding)

Windows利用SSH - X远程登录Linux主机(X11-forwarding)

时间:2021-01-15 13:43:00

相关推荐

Windows利用SSH - X远程登录Linux主机(X11-forwarding)

pediawiki对X11的定义如下:

The X window system (commonly X Window System or X11, based on its current major version being 11) is a computer software system and network protocol that provides a basis for graphical user interfaces (GUIs) and rich input device capability for networked computers. It creates a hardware abstraction layer where software is written to use a generalized set of commands, allowing for device independence and reuse of programs on any computer that implements X. ... Each person using a networked terminal has the ability to interact with the display with any type of user input device. Due to the ubiquity of support for X software on Unix, Linux and Mac OS X, X is commonly used to run client applications on personal computers even when there is no need for time-sharing.【/wiki/X11】

即:X11是X Window System主版本11的缩写,它不光是一个基本的GUI软件,X11也被定义为一个网络协议,因为X11提供了非常灵活的网络访问接口。

通过SSH 的 X11 forwarding访问X11方便又安全

什么是 X11 forwarding?

X forwarding是X的一个功能,它可以让程序运行在一台主机上,而用户在另外一台机器上与之交互。其概念上与VNC和微软的远程桌面类似,而与这些软件不同,我们想要实现的是在Microsoft Windows平台运行特定的图形用户界面程序,而不是显示控制整个桌面。在X上下文中,客户端“client”是指运行程序的主机,而你坐在服务器“Server”前面,这点和常规的叫法不同。举例来说,你通过A远程打开B上面的程序,也就是说你在操作A,而你要远程控制B,那么B就是客户端,A是服务端。

Think of it this way: the X server is serving you, the human being, to the programs on the remote computer. The client, a program, makes requests of you through the X server by changing its graphical display, and you respond to it by clicking on it or typing into it.

SSH 的 X11 forwarding 特性可以使 X client 和 X server 安全地通讯。使用 X11 forwarding 后,从 X client 到 X Server 方向的数据先被送至SSH server,SSH server 利用和SSH client 的安全通道转发给SSH client,再由SSH client 转发给 X server,从 X server 到 X client 的数据流同理。这里SSH server 和SSH client 充当了 X client 和 X server 间数据的转发器,由于SSH server 和 X client、SSH client 和 X server 一般在同一台机器上,它们之间是一种安全的进程间通讯,而SSH server 和SSH client 间的通讯也是安全的,所以 X client 和 X server 间的通讯就是安全的。

需要哪些工具?

我们在Microsoft Windows平台通过SSH访问X11,参考上图所示,那么我们就需要:

1) SSH客户端 - 这里我们使用putty

下载地址:http://www..uk/~sgtatham/putty/

2)X Server端 - 我们使用标准 X server的Windows移植版本Xming

Xming的介绍见:/XmingNotes/

点击下载下面地址页面里的xming里面的exe文件下载(建议下载最近版)

/projects/xming/files/

注意这里面有两个xming和xming-mesa,前者用OpenGL展示界面,后者用Mesa展示界面,对于一般用户差别不大,任选一个即可

3) 字体库:

点击下载下面地址页面里的xming-fonts里面的字体库exe文件下载(建议下载最近版)

/projects/xming/files/

以上应用程序共putty免安装,后面两个是安装包,直接点击默认安装。

运行

运行XMing后系统右下角托盘里(任务栏)多了X字样的图标,鼠标放在上面会有类似“Xming server - 0:0”的字样。

运行putty,在host name里面填写你的目标IP地址,例如“192.168.2.225”。在putty界面的左边点击Connection/SSH/X11 子菜单。选中"Enable X11 Forwarding",在 "X display location"中输入 "localhost:0:0" 。注意这里的数字应该和鼠标移到系统托盘里显示出来的数字一致(上面红色字体),如果是“Xming server - x:y”那么这里应该是“localhost x:y”。 保持单选框"MIT-Magic-Cookie-1"不变。

点击左边“Session”按钮,输入名字“MyPC”点击“Saved Sessions”保存设置。然后双击打开终端,输入用户名和密码,运行gedit或者gnome-terminal试试。:-)

还有其他实现windows下访问X11 forwarding的方案,例如

Cygwin/X -/

WeirdX - /weirdx/index.html

参考:

http://courses.cms.caltech.edu/cs11/misc/xwindows.html

/edeed/blog/item/4f47738d98891e1ab21bba2f.html

/ossdocs/gnu/gtk+_FAQ/GTK+_FAQ.htm

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。