sshpass 抛出错误“无法获得伪终端:成功" [英] sshpass throwing error 'Failed to get a pseudo terminal: Success'

查看:151
本文介绍了sshpass 抛出错误“无法获得伪终端:成功"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试运行 sshpass 工具来自动执行 sftp 操作.

I am trying to run the sshpass tool to automate an sftp action.

在另一台服务器上,该命令有效,但在这台服务器上,它只返回一行错误消息.

On another server, the command works, but on this server it just returns one line of error mesage.

这是我正在使用的命令:

Here is the command I am using:

sshpass -p Password sftp Uname@Host

我得到了错误:

Failed to get a pseudo terminal: Success

我已经在许多不同的主机上以 root 用户的身份尝试过它,我可以毫无问题地进行 sftp,所以我很确定这是 sshpass 或伪终端问题.

I've tried it with lots of different hosts and as the root user, and I can sftp in without a problem so I am pretty sure it is either a sshpass or pseudo terminal issue.

我对伪终端知之甚少,似乎无法找到有关错误的任何信息.文件夹/dev/pts 是空的,cat/proc/sys/kernel/pty/nr 是 0,我认为这意味着没有任何运行.有 256 个 pty** 项目,从 ptya0 到 ptyzf,这让我相信我可能已经达到了伪终端数量的限制.我认为我的最大终端(通过查看 cat/proc/sys/kernel/pty/max)是 4096.

I don't know a whole lot about pseudo terminals and can't seem to find anything on the error. The folder /dev/pts is empty and cat /proc/sys/kernel/pty/nr is 0, which I think means that there aren't any running. There are 256 pty** items, from ptya0 through to ptyzf which makes me believe that I may have reached a limit for the number of pseudo terminals. I think my max terminals (by looking at cat /proc/sys/kernel/pty/max) is 4096.

有没有其他人遇到过这个错误或知道什么可能是错误的?这是一个生产服务器,所以我不能让它停机.对此的任何帮助将不胜感激.

Has anyone else experienced this error or know what may be wrong? It is a production server so I can't afford for it to be down. Any help on this would be greatly appreciated.

推荐答案

想通了.对于任何有类似错误的人来说,pts 目录由于某种原因被卸载了.执行以下操作即可解决问题:

Figured it out. To anyone who has a similar error, the pts directory was unmounted for some reason. Doing the following did the trick:

rm -rf /dev/ptmx
mknod /dev/ptmx c 5 2
chmod 666 /dev/ptmx 
umount /dev/pts
rm -rf /dev/pts
mkdir /dev/pts
vim /etc/fstab
    (added: none  /dev/pts  devpts  defaults 0 0)
mount /dev/pts

这篇关于sshpass 抛出错误“无法获得伪终端:成功"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆