sshpass throwing error 'Failed to get a pseudo terminal: Success'

三世轮回 提交于 2019-12-25 01:44:16

问题


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

And I get the error:

Failed to get a pseudo terminal: Success

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.

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.


回答1:


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


来源:https://stackoverflow.com/questions/11314647/sshpass-throwing-error-failed-to-get-a-pseudo-terminal-success

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!