需要 运行 从本地机器 Unix 远程机器上的远程脚本

Need to run remote script on remote machine from local machine Unix

我想 运行 一个脚本 test.sh 位于机器 A 上的 A 本身,但来自机器 B。有没有办法在 Unix 中做同样的事情

您可以使用 ssh 来实现:

ssh -t user@host '/path/to/test.sh'

根据 man ssh,这就是 -t 选项的作用:

Force pseudo-tty allocation. This can be used to execute arbitrary screen-based programs on a remote machine, which can be useful, e.g. when implementing menu services. Multiple -t force tty allocation, even if ssh has no local tty.