简体   繁体   English

如何使用SSH连接执行bash

[英]How to execute bash with ssh connection

I'm trying to write a bash script to automatically do stuff in clients machines in the network. 我正在尝试编写bash脚本以自动在网络中的客户端计算机中执行操作。 But after the code 但是在代码之后

ssh -i ~/.ssh/key root@machine

The bash program just stops What can I do to send the command to the remote machine? bash程序刚刚停止我该怎么做才能将命令发送到远程计算机? Thanks 谢谢

Same way as if you were invoking bash directly. 就像您直接调用bash一样。

ssh ... somescriptontheserver.sh

ssh ... ls -lR /

ssh ... << EOF
ls -lR /
EOF

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM