I have two Debian Linux servers on the same network. I would like server A to execute this command on server B: run.sh VARIABLE
, and it needs to be able to process the output of said command. The script run.sh
is on server B I do not want its contents to be visible to server A. I need there to be some kind of authentication between these two machines as well.
2
Answers
Perhaps the easiest and fastest way you can accomplish this is to setup a standalone python REST server. On the client side you can use any client, even curl or python requests.
How to make a simple Python REST server and client?
As authentication it can be as simple as requiring a username and password in the JSON fields.
Your specs are somewhat vague. Assuming that
run.sh
exists somewhere onserver B
, the easiest would be to use anssh forced command
and using a key-pair for the ssh connection.You define the forced command in the
~/.ssh/authorized_keys
onserver B
and pull theVARIABLE
out ofSSH_ORIGINAL_COMMAND
inrun.sh
.server A
never gets to seerun.sh
, is able to pass arguments torun.sh
. and runningrun.sh
is all it can ever do …