我在 centOS 上运行 Xen。我没有 GUI,我想从 Domain-0 在虚拟机(Domain-U/Guest Domain)上运行可执行文件。可以这样做吗?
更多信息
我正在运行带有 KVM 的 CentOS 桌面。我的xm list
命令给出以下内容:
Name ID Mem(MiB) VCPUs State Time(s)
Domain-0 0 98 1 r----- 5068.6
vm1 231 128 1 r----- 7.6
我没有运行服务器或任何东西。只是在玩 Xen 虚拟化。
答案1
ssh
可能是实现您想要的最简单的方法。
从 dom0,你可以执行
ssh domU <remote executable command> > localfile
因此这将 ssh 到 domU,运行remote executable command
,然后将该命令的输出定向到名为的本地文件localfile
。
例如:
ssh domU cat /etc/passwd > passwd.txt
这将从 dom0 ssh 到 domU,cat passwd 文件,并将结果存储在名为passwd.txt
请注意,这些都与虚拟化无关,一旦您拥有虚拟机,它就与拥有物理机器相同 - 您可以以相同的方式对待它。
答案2
假设你有 ssh 权限访问 DomU,只需使用 X-Forwarding,如下所示:ssh -XY qdot@domU
,或者甚至ssh -XY qdot@domU executable
-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.
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.
-x Disables X11 forwarding.
-Y Enables trusted X11 forwarding. Trusted X11 forwardings are not subjected to the X11 SECURITY extension controls.