简体   繁体   English

如何通过SSH在远程Linux服务器上启动GUI软件?

[英]How to start a GUI software on a remote Linux server via SSH?

I am trying to open Matlab software installed in remote Linux server from my Windows 7 PC. 我试图从我的Windows 7 PC打开安装在远程Linux服务器上的Matlab软件。 I am using SSH secure shell to connect with the Linux server. 我使用SSH安全shell连接Linux服务器。 After successful connection, I am able to see and access the folders under my user account. 成功连接后,我可以查看和访问我的用户帐户下的文件夹。 I am able to start Matlab software using the following command in the SSH secure shell window: 我可以在SSH安全shell窗口中使用以下命令启动Matlab软件:

[sushma@scorpio home]$ matlab [sushma @ scorpio home] $ matlab

On doing so the following message gets displayed on the SSH secure shell window: 执行此操作时,SSH安全shell窗口中将显示以下消息:

MATLAB is selecting SOFTWARE OPENGL rendering. MATLAB正在选择SOFTWARE OPENGL渲染。 No protocol specified 没有指定协议

                               < M A T L A B (R) >
                     Copyright 1984-2015 The MathWorks, Inc.
                     R2015b (8.6.0.267246) 64-bit (glnxa64)
                                 August 20, 2015

From the above message it seems that the software is running. 从上面的消息看,软件似乎正在运行。 I want to access the GUI of the software. 我想访问该软件的GUI。

Give a try to ssh -X 试试ssh -X

From ssh manual: 从ssh手册:

-X Enables X11 forwarding. -X启用X11转发。 This can also be specified on a per-host basis in a configuration file. 这也可以在配置文件中基于每个主机指定。

X11 forwarding should be enabled with caution. 应谨慎启用X11转发。 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. 能够绕过远程主机(对于用户的X授权数据库)的文件权限的用户可以通过转发的连接访问本地X11显示器。 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. 因此,默认情况下,X11转发受X11 SECURITY扩展限制。 Please refer to the ssh -Y option and the ForwardX11Trusted directive in ssh_config(5) for more information. 有关更多信息,请参阅ssh -Y选项和ssh_config(5)中的ForwardX11Trusted指令。

-Y Enables trusted X11 forwarding. -Y启用可信X11转发。 Trusted X11 forwardings are not subjected to the X11 SECURITY extension controls. 受信任的X11转发不受X11 SECURITY扩展控制的约束。

steps that worked for me: 对我有用的步骤:

  1. connect to the server by using the ssh -X flag 使用ssh -X标志连接到服务器
  2. execute Matlab with matlab & (you should see Matlab opening on your local machine) 使用matlab &执行Matlab matlab & (您应该在本地计算机上看到Matlab打开)
  3. check within Matlab with the command opengl info if either software or hardware opengl is being used (if you're having trouble loading opengl go to step 2 and execute matlab -softwareopengl & ) 如果正在使用软件或硬件opengl,请在matlab中使用命令opengl info检查(如果您在加载opengl时遇到问题,请转到步骤2并执行matlab -softwareopengl &
  4. run your gui script with run <script> run <script>运行你的gui脚本

If the script is supposed to run independent of your ssh connection, I suggest to use the program tmux and repeat step 2-4 inside a tmux session 如果脚本应该独立于ssh连接运行,我建议使用程序tmux并在tmux会话中重复步骤2-4

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM