I have a local (local network, behind NAT router and firewall) Ubuntu machine and a publicly reachable (Ubuntu) server. I want to initiate a connection from the local machine to the server, then, on the server execute one specific Python script (no other commands or scripts) on the local machine. But here is the problem: I want to execute that Python script anytime in the future, sometimes multiple times after each execution. My first thought was a SSH tunnel like (executed on the local machine):
ssh user@remoteserver -R 21000:127.0.0.1:8081
But this doesn't get me anything. The next try I had was this answer here. But that executes the script at connection time, and then drops the connection after execution.
So finally, my question is: How can I establish a secure connection, initiated by the local machine to the server, on which I can execute Python scripts on the local machine on demand, not just on connection time of the SSH command?
(Please let me know if anything was just too confusing, and I will re-phrase parts of the question).
ssh user@remote.example.com /path/to/swanky_script.py
on demand not a valid answer to this? – DopeGhoti Apr 02 '21 at 18:57