遇到的问题情景:

在A机子上执行脚本去远程执行B机子中的另一个启动脚本,A、B两台机子都做了SSH安装、在使用

ssh root@IP "cd /root"; sh test.sh;exit

出现:Pseudo-terminal will not be allocated because stdin is not a terminal 报错

使用-t -t 无法解决

ssh -t -t root@IP "cd /root"; sh test.sh;exit

最终解决:

ssh root@10.70.200.161 << remotessh
- cd /root
- sh test.sh
-

参考:​​https://blog.csdn.net/wyl9527/article/details/72770455​