Is it possible to write a bash script, thatwould be started from machine A, logs in on a different machine B by ssh (both machines A and B would be Linux-Machines),copys some files on to machine Bruns a python script a given python script on these machines.transfers the results back to machine Alogs off from machine B.Is this technically doable?
How to write a bash script, that logs onto an other machine to do stuff?
bash;ssh;shell script
Of course it is doable:scp file user@host:ssh user@host path_to_scriptscp user@host:file_to_copy ./and that's it...But there is one problem: you will be asked for password three times. To avoid that you could generate ssh keys and authorize users by these keys. To generate ssh keys run ssh-keygen -t rsa, answer questions and copy public key to remote host (machine B) to ~/.ssh/authorized_keys file. Private key should be saved in ~/.ssh/id_rsa on local machine (A).