首页 > 其他 > 详细

ssh自动化出现的莫名报错

时间:2014-09-25 21:18:18      阅读:340      评论:0      收藏:0      [点我收藏+]

代码如:

ssh -q user@host <<EOF
  ping -c 3 localhost
EOF

会出现提示如:

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

google了下,有人提出加上-T(ssh -T -q user@host)参数可避免此情况。如这篇文章介绍的:

http://buralin.iteye.com/blog/2035691

参数解释:

     -T      Disable pseudo-tty allocation.

     -t      Force pseudo-tty 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 services.  Multiple -t options force tty allocation, even if ssh has no local tty.

基于上述可以看出,当调用一个使用ssh自动化的脚本时,ssh登录到远程后会当前角色分配一个tty,但由于当前登录模式并非本地模式所以就会报错。

所以使用-T禁用该行为即可。

ssh自动化出现的莫名报错

原文:http://www.cnblogs.com/lichmama/p/3993683.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!