How to use SSH to run a local shell script on a remote machine?

前端 未结 17 1585
南笙
南笙 2020-11-21 22:33

I have to run a local shell script (windows/Linux) on a remote machine.

I have SSH configured on both machine A and B. My script is on machine A which will run some o

17条回答
  •  鱼传尺愫
    2020-11-21 22:42

    Assuming you mean you want to do this automatically from a "local" machine, without manually logging into the "remote" machine, you should look into a TCL extension known as Expect, it is designed precisely for this sort of situation. I've also provided a link to a script for logging-in/interacting via SSH.

    https://www.nist.gov/services-resources/software/expect

    http://bash.cyberciti.biz/security/expect-ssh-login-script/

提交回复
热议问题