ssh

ssh user@host 'bash -s' < test.sh init   #ssh运行加参数的本地脚本

ssh user@host < test.sh #ssh直接运行.sh脚本

ssh user@host 'mkdir -p .ssh && cat >> .ssh/authorized_keys' < ~/.ssh/id_rsa.pub ##将本地公钥id_rsa.pub传给远程主机
原文地址:https://www.cnblogs.com/chenzhaoyu/p/10329138.html