通过putty(ssh)连接发送和执行脚本

时间:2016-04-02 00:25:14

标签: bash ssh putty

我可以通过putty(ssh)访问一些机器。 有时我需要在这些机器上运行脚本。有没有一种简单而安全的方法通过ssh连接将文件从我的电脑发送到机器?

1 个答案:

答案 0 :(得分:2)

您可以使用scp通过ssh复制文件:

scp local_file remote_machine:/target/location

您也可以通过ssh运行命令目录:

ssh remote_machine 'echo 1 > remote_file'

甚至连接到ssh然后继续远程:

cat local_file | ssh remote_machine 'cat > remote_file'