用SSH登录远程的机器,在远程机器上执行本地机器上的脚本

假设本地的机器IP为10.245.111.90,我们想要在10.245.111.93上执行一个保存在10.245.111.90上的脚本。


经过测试通过的命令如下:

ssh root@10.245.111.93 'bash -s' < /root/testlocal.sh


如果要带参数的话,那就需要参考这篇文章中描述的代码了。


参考资料

=========

Execute Bash script stored in a file over SSH

https://stackoverflow.com/questions/5663679/execute-bash-script-stored-in-a-file-over-ssh

原文地址:https://www.cnblogs.com/awpatp/p/9935820.html