I haven't had a need for this feature so far, therefore I had to do a bit of RTFM followed by some "poking around". But in the end its pretty simple: Apart from having the virtualbox-ose-additions.tcz
extension installed one also needs to ensure that the "active component on the inside" is running. I therefore started it via sudo VBoxService
, and following this 'VBoxManage guestcontrol' worked for me.
Some further remarks:
- to be able to "see" the 'stdout' output the '--wait-stdout' option has to be added to the 'VBoxManage guestcontrol' command,
- to be able to "see" the 'stderr' output the '--wait-stderr' option has to be added to the 'VBoxManage guestcontrol' command; doing this OTOH prevented me to "see" the 'stdout' output and even adding '--wait-stdout' as well did not change the outcome,
- any arguments for the remote command execution need to be added at the end of the 'VBoxManage guestcontrol' command (preceded by '--').
So all together: if one wants to run 'ls -lRa /home/tc/.local' (in a VM called 'TC4') this could be done like this:
C:\>VBoxManage guestcontrol TC4 exec --image /bin/ls --username tc --wait-stdout -- -lRa /home/tc/.local
drwxr-sr-x 3 tc staff 60 Mar 13 22:02 .
drwxr-sr-x 3 tc staff 120 Mar 13 22:02 ..
drwxr-sr-x 2 tc staff 40 Mar 13 22:02 bin
drwxr-sr-x 2 tc staff 40 Mar 13 22:02 .
drwxr-sr-x 3 tc staff 60 Mar 13 22:02 ..