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

前端 未结 17 1790
南笙
南笙 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:39

    You can use runoverssh:

    sudo apt install runoverssh
    
    runoverssh -s localscript.sh user host1 host2 host3...
    

    -s runs a local script remotely


    Useful flags:
    -g use a global password for all hosts (single password prompt)
    -n use SSH instead of sshpass, useful for public-key authentication

提交回复
热议问题