SSH 中的 X11 转发

use*_*119 7 xorg x11-forwarding openssh

如何使用 SSH 从远程服务器运行 X11 GUI 应用程序?

例如:

  • 我的第一个桌面 192.168.1.1
  • 我的第二个桌面 IP 192.168.1.12

我从我的第一个桌面到第二个桌面,我想从第二个桌面运行 GUI 应用程序并将 X11 重定向到第一个。

Syl*_*eau 6

尝试以下命令来创建 ssh 连接:

ssh -X remote_login@192.168.1.12
Run Code Online (Sandbox Code Playgroud)

只需用您的第二个桌面登录名替换 remote_login

ssh 手册页:

-X 启用 X11 转发。这也可以在配置文件中针对每个主机进行指定。

 X11 forwarding should be enabled with caution.  Users with the
 ability to bypass file permissions on the remote host (for the
 user's X authorization database) can access the local X11 display
 through the forwarded connection.  An attacker may then be able
 to perform activities such as keystroke monitoring.

 For this reason, X11 forwarding is subjected to X11 SECURITY
 extension restrictions by default.  Please refer to the ssh -Y
 option and the ForwardX11Trusted directive in ssh_config(5) for
 more information.
Run Code Online (Sandbox Code Playgroud)


use*_*119 2

好吧,我找到了一个方法:

ssh -X user@192.168.1.12
Run Code Online (Sandbox Code Playgroud)

然后,当我登录时,我可以轻松启动我需要的任何 GUI 应用程序。我尝试了 Firefox,是的,我可以在第二台计算机上使用 Firefox。这是非常好的。