Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm running Xen on centOS. I've no GUI and I would like to run a executable file on a virtual machine (Domain-U/Guest Domain) from Domain-0. Is it possible to do this?

Some more Information

I'm just running a CentOS Desktop with KVM. My xm listcommand gives the following:

Name                         ID Mem(MiB) VCPUs State  Time(s)
Domain-0                      0       98     1 r-----  5068.6
vm1                         231      128     1 r-----     7.6

I'm not running a server or anything. Just playing around with Xen virtualization.

share|improve this question
Do you mean that you want to run a gui based app on DomU, but have the output go to an X server on Dom0? – Paul Mar 2 '12 at 8:27
No. I just want to be able to run an executable on DomU and have the output go to a file on Dom0 and want to be able to kill the process (if needed) I started on DomU from Dom0. – Sunil Mar 2 '12 at 11:16
up vote 2 down vote accepted

ssh might be the easiest way to achieve what you want.

From dom0, you can do

ssh domU <remote executable command> > localfile

So this will ssh to domU, run the remote executable command and then direct the output from that command to a local file called localfile.

For example:

ssh domU cat /etc/passwd > passwd.txt

This will ssh to domU from dom0, cat the passwd file, and store the results in a local file called passwd.txt

Note that none of this has anything to do with virtualisation, once you have a VM it is the same as having a physical machine - you treat it the same way.

share|improve this answer
ssh is a good option but is there no other way yo do it? Just curious. – Sunil Mar 2 '12 at 12:40
You have to consider dom0 and domu as separate machines, no different then any other two physical boxes. So any approach for running executables remotely apply. There are no additional approaches because virtualisation is in play. – Paul Mar 3 '12 at 2:25

Assuming you have ssh access to DomU, just use X-Forwarding, like that: ssh -XY qdot@domU, or even 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.
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .