-2

How do I login to another UNIX machine and execute a shell script stored there?

jofel
  • 26,758
Afsar
  • 1

1 Answers1

2

From machine1, you can login to machine2 and execute a shell script there using SSH:

ssh myusername@machine2 /home/myusername/myscript.sh
dr_
  • 29,602
  • 1
    And see http://unix.stackexchange.com/questions/87405/how-can-i-execute-local-script-on-remote-machine-and-include-arguments – Simon Hoare Aug 05 '15 at 08:26
  • Thanks. But how to make it an automated one. That is whether the ssh connection (along with the password of the machine 2) and name of the scripts which i want to execute can be embedded in a single shell scripts, so that calling the scripts will automatically connect with the machine 2,and will execute the scripts residing there – Afsar Aug 05 '15 at 08:58
  • Please edit your post to add all the necessary details. – dr_ Aug 05 '15 at 09:53