ssh登录问题出现Pseudo-terminal will not be allocated because stdin is not a terminal错误

本文介绍了SSH远程登录过程中出现的Pseudo-terminal will not be allocated错误及其解决方案,并提供了配置ssh服务支持特定加密算法的方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

原文地址::http://www.jianshu.com/p/e66014b67506



问题:

今天遇到一个ssh登录问题,当远程登录主机时出现Pseudo-terminal will not be allocated because stdin is not a terminal. 错误。

原因:用脚本调用或者程序调用ssh登陆远程的时候出现的这个情况。背后的机制和深层次的原因没有深究。

解决方案:

写登陆脚本ssh的时候加个参数

ssh -t -t user@10.242.1.1

或者

ssh user@10.242.1.1 -tt

记录下ssh远程执行脚本

cmd="echo 'hello'>/home/user/XL_WORK/test.bak"

ssh -t -t user@10.242.1.1 $cmd

另:

ssh在6.7版本以后,对一些加密算法不支持,需要手动添加

应该是jsch默认使用diffie-hellman-group-exchange-sha1算法,请在主机ssh服务的sshd_config文件中添加下列加密算法并重启ssh服务验证。 KexAlgorithms diffie-hellman-group1-sha1,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group-exchange-sha256





评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值