0

I usually use software on a windows machine, but now need to call one commandline executable that I only have a Linux version of. I installed a linux virtual machine, but I would like to be able to call the linux executable on the virtual machine from my windows commandline so that I can automate using it.

Does anybody know how to perform this? Thanks in advance.

There is one similar question I found, but I dont understand the answer. It looks like they set up some sort of connection between the host and the virtual machine already and then log on to it through "vmrun" to execute the command.

Another question was about doing this for two linux machines which doesnt solve it for me.

Oh maybe this is important: I run windows 7 and use oracle vm virtualbox to run a debian distribution on it.

-edit: so I need to set up an SSH connection to the virtual machine. I found a website that explains how to do it from a linux machine, might work the same way for windows hosts.

2 Answers 2

3

I'm a big fan of using cygwin on Windows systems to give me a bash shell. You can use that to SSH into a virtual machine or remote host just as you might from another Linux machine, you just have to set up an SSH server on the guest (or remote server). Depending on the commandline executable you need, it may even just be available within cygwin, and no true Linux environment would be required.

5
  • Thanks for your answer. I dont know what the words bash shell and ssh mean. I generally dont use linux, maybe thats why. Will go and google those, but maybe you could elaborate your answer as well?
    – Leo
    Jan 14, 2015 at 15:47
  • bash is one of the available command-line interfaces widely used in Linux. Cygwin is essentially a set of Windows ports of many of the utilities widely used in this way, giving you the Linux command line and Linux utilities running within a Windows system. If cygwin itself doesn't support the utility you're interested in, SSH is a utility you can use to log into another machine over the network (or a virtual machine, if you prefer) and give you a command line interface to the system. It can actually be used for a lot more than just this, but I'm trying to keep my answer relevant to you.
    – eemikula
    Jan 14, 2015 at 15:52
  • Bash Shell = linux version of a window's command prompt. SSH = telnet in windows. Those are both gross over-simplifications, but it should give you the idea.
    – EBGreen
    Jan 14, 2015 at 15:52
  • Ok thanks, now setting up SSH. Added a host-only network adapter, and ipconfig in windows sees this adapter now. However ifconfig on my virtual machine does not show it. When using putty (cygwin has been downloading for some time now) to connect to the ip found by ipconfig, I get connection rejected.
    – Leo
    Jan 14, 2015 at 16:23
  • Ok found this easy way to set up SSH: stackoverflow.com/questions/5906441/… Then I use Putty to log in and Plink to send commands, so I did not need to install anything. Cygwin was still downloading, will cancel that now.
    – Leo
    Jan 14, 2015 at 17:02
0

As eemikula says, I needed to get an SSH connection to my VM. So I run this line in windows that sets the vmware settings up for ssh over the 127.0.0.1 ip loop (first add a second network adapter in VM settings and make it a host only adapter):

VBoxManage modifyvm myserver --natpf1 "ssh,tcp,,3022,,22"

Where I found 'myserver' with

VBoxManage list vms

Then I install an SSH server in the VM:

sudo apt-get install openssh-server

Then I put putty in a folder thats in the system path. This command then executes commands in a certain txt file:

putty.exe -agent -ssh [email protected] -P 3022 -pw password -t -m "commandsfile.txt"

Or downloading plink from the same link can execute commands directly it seems, will look into that now. Plink and putty are both very small portable executables. I started installing cygwin as suggested in the answer that was posted first by eemikula, but cygwin was still downloading from some vague ftp address after I figured out how to do it this way.

You must log in to answer this question.

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