您的位置:首页 > 其它

是否允许分配伪终端解决

2017-02-21 20:07 483 查看

问题

当使用jenkins构建触发器执行ssh命令的时候出现如下错误:

Pseudo-terminal will not be allocated because stdin is not a terminal


意思是无法分配一个伪终端,在伪终端执行脚本,可以进行交互;而没有伪终端,则不能进行交互。

解决方案

1.禁止分配伪终端-使用ssh -T

2.强制分配伪终端-使用ssh -t 或 ssh -tt

参数描述

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


:此处解决方案采用使用了ssh -T,因为对于自动化来说,基本上不用交互。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  ssh 脚本