I would like to have my c++ program on PC1 launch another program on PC2 given the hostname of PC2. I don't really want to overcomplicate things right now, so let's just assume that the program is on the search path for executables on PC2. From what i understand this can be done over ssh somehow? Assuming (to simplify further) i have an account on both PC1 and PC2 so that ssh would just connect me if i'm logged in on PC1 (without any kind of interaction that would require my to supply the username and password) how would i go about doing this? Would https://www.libssh.org/ help simplify things?
Construct a command line to execute the remote command using
ssh. Then execute that command using
std::string pc2_hostname; std::string cmd = "ssh " + pc2_hostname + " command_to_execute"; system(cmd.c_str());