How to have my program on the host to execute a binary/shell-script inside the Bhyve VM

I would love to find a way to allow my program that runs on FreeBSD 14.3 host, to execute binary or shell-script in a Bhyve Linux VM. The binary does not need to be executed with root. The binary need to be executed per requests so I cannot do a periodic run.

Few ideas I come up with, but not sure if I am over-complicating things or doing it in a non-secure way.
  1. Establish a ssh connection from my host to the VM and use ssh to execute
  2. Have a simple web-server in the VM to listen on the requests from my host program, then triggers the execution, e.g. (nginx)
Do you guys have any thoughts? Thanks!
 
I suggest setting up an SSH “authorized key” so that the host can ssh without prompting for a password.

Do a web search on “ssh authorized_keys” for more details — the file you need to modify/create on the client is $HOME/.ssh/authrorized_keys and you can run ssh-keygen -t rsa on the host to create $HOME/.ssh/id_rsa.pub (if you don’t have one already) that you copy/merge into the client’s $HOME/.ssh/authorized_keys file, then you should be able to ssh from that user on the host to the target user on the client.
 
Back
Top