Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
作为复杂 BASH 脚本的一部分,我想从脚本本身在远程系统上执行命令。
现在,我运行为远程系统定制文件并上传它们的脚本,然后通过 ssh 登录执行单个命令。
所以要满分:
按照蒂姆·波斯特的回答:
设置公钥,然后您可以执行以下操作:
#!/bin/bash ssh user@host "chmod 755 /go && /go"