Paw*_*tal 20 ssh gui command-line xorg telnet
我试图在谷歌搜索这个主题,但没有任何显着的结果。
我需要从终端启动一些 GUI 应用程序,但我不在乎这个应用程序向我展示了什么。此外,我需要在不同的会话中启动此应用程序的几个实例。它与一些 GUI 自动化测试有关,所以我知道我想要什么,我正在寻找答案:)。
我认为正确的步骤应该是:
但我被困在第一步。这里有人有类似的问题吗?
--- 编辑:1)我不关心 GUI 输出 - 我只需要我的应用程序中的 stdout 和 stderr。- 这就是为什么这个问题不是重复的 - 非常了解谷歌:)。我不想将输出重定向到我自己的 GUI。
roa*_*dmr 21
如果您不关心应用程序在做什么,您可以为它提供一个带有 xvfb 的“虚拟”x 服务器:
Xvfb 提供了一个 X 服务器,它可以在没有显示硬件和物理输入设备的机器上运行。它使用虚拟内存模拟哑帧缓冲区。该服务器的主要用途旨在用于服务器测试,但已发现它的其他新用途,包括针对异常深度和屏幕配置测试客户端,使用 Xvfb 作为后台渲染引擎进行批处理,负载测试,作为辅助将 X 服务器移植到新平台,并提供一种不显眼的方式来运行不需要 X 服务器但无论如何都坚持拥有一个的应用程序。
安装后,您可以使用以下命令启动它:
sudo Xvfb :10 -ac -screen 0 1024x768x24 &
Run Code Online (Sandbox Code Playgroud)
它会在后台运行,然后你启动你的客户端:
DISPLAY=:10 your-client
Run Code Online (Sandbox Code Playgroud)
A.B*_*.B. 17
一个简短的命令:
ssh -X <username>@<host> gedit &
Run Code Online (Sandbox Code Playgroud)
从 man ssh
-X Enables X11 forwarding.
This can also be specified on a per-host basis in a configuration file.
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.
Run Code Online (Sandbox Code Playgroud)
/etc/ssh/sshd_config在服务器端检查:
sudo nano /etc/ssh/sshd_config
Run Code Online (Sandbox Code Playgroud)
对于以下几行:
X11Forwarding yes
X11UseLocalhost no
Run Code Online (Sandbox Code Playgroud)
如果您进行了更改,请重新启动 ssh srever:
sudo service ssh restart
Run Code Online (Sandbox Code Playgroud)/etc/ssh/ssh_config在客户端检查:
sudo nano /etc/ssh/ssh_config
Run Code Online (Sandbox Code Playgroud)
对于下面的行
ForwardX11 yes
ForwardX11Trusted yes
Run Code Online (Sandbox Code Playgroud)May*_*hux 12
你只需要在你的 ssh 会话中运行 export DISPLAY=:id# 并且程序运行将在远程显示器上运行。一个简单的例子:
maythux@maythuxPC:~$ ssh testSSH@myServer
maythux@maythuxPC:~$ export DISPLAY=:0
maythux@maythuxPC:~$ gedit
Run Code Online (Sandbox Code Playgroud)
现在gedit将运行在名为 testSSH 的用户上显示
您可以将其全部缩短为单个命令:
ssh testSSH@myServer "DISPLAY=:0 nohup gedit"
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
122909 次 |
| 最近记录: |