无法通过SSH连接到服务器-“服务器拒绝分配pty”


10

我有一个在Ubuntu 10.10上运行的STRATO V-PowerServer,但最近却无法通过ssh连接到服务器。

基本上,我所拥有的只是对服务器的ssh访问,如果有必要,我可以启动进入恢复模式,在此模式下,我所有的东西都在/ repair中,以便可以对系统进行任何修复。

问题是,当我尝试通过ssh连接到服务器时,出现此错误:

Using username "florian".
florian@mydomain.de's password:
Server refused to allocate pty
Linux hwn36335 2.6.18-028stab070.5 #1 SMP Fri Sep 17 15:37:23 MSD 2010 i686 GNU/Linux
     Ubuntu 10.10

                 Welcome to Ubuntu!
                                    * Documentation:  https://help.ubuntu.com/
                                                                              /home/florian/.zlogin:1: command not found: display_info

因此外壳无法打开,我无法输入任何命令。我已经尝试在Google上搜索“服务器拒绝分配pty”,但是找不到任何有帮助的东西,尽管以前其他人都遇到了问题。此外,有时我什至会收到另一个错误:“ pty分配请求在通道0上失败”,而不是另一个错误。对于这个问题,我只能找到的是:

http://blog.dinotools.de/2010/10/03/fehler-pty-allocation-request-failed-on-channel-0

但不幸的是,它没有帮助...

是否有人知道为什么会导致此错误,以及我可以尝试如何解决?

如果您能给我提示,那就太好了。我知道一些基本的知识,并且知道如何使用服务器,但是如果它深入解决问题,我将处于极限……;-)谢谢!

加法1:

/var/log/auth.log

Jan 24 16:20:01 h1696522 CRON[3417]: PAM unable to dlopen(/lib/security/pam_smbpass.so): /lib/security/pam_smbpass.so: cannot open shared object file: No such file or directory
Jan 24 16:20:01 h1696522 CRON[3417]: PAM adding faulty module: /lib/security/pam_smbpass.so
Jan 24 16:20:01 h1696522 CRON[3417]: pam_unix(cron:session): session opened for user www-data by (uid=0)
Jan 24 16:20:03 h1696522 CRON[3417]: pam_unix(cron:session): session closed for user www-data

/var/log/daemon.log

Jan 24 16:00:02 h1696522 update.pl[14292]: /var/drweb/bases/dwr50003.vdb - dwr50003.vdb with such CRC32 already exists, downloading has been skipped
Jan 24 16:00:02 h1696522 update.pl[14292]: /var/drweb/bases/dwr50004.vdb - dwr50004.vdb with such CRC32 already exists, downloading has been skipped
Jan 24 16:00:02 h1696522 update.pl[14292]: /var/drweb/bases/dwr50005.vdb - dwr50005.vdb with such CRC32 already exists, downloading has been skipped
Jan 24 16:00:02 h1696522 update.pl[14292]: /var/drweb/bases/dwr50006.vdb - dwr50006.vdb with such CRC32 already exists, downloading has been skipped
Jan 24 16:00:02 h1696522 update.pl[14292]: /var/drweb/bases/dwr50007.vdb - dwr50007.vdb with such CRC32 already exists, downloading has been skipped
Jan 24 16:00:02 h1696522 update.pl[14292]: /var/drweb/bases/dwr50008.vdb - dwr50008.vdb with such CRC32 already exists, downloading has been skipped
Jan 24 16:00:02 h1696522 update.pl[14292]: /var/drweb/bases/dwr50009.vdb - dwr50009.vdb with such CRC32 already exists, downloading has been skipped
Jan 24 16:00:02 h1696522 update.pl[14292]: /var/drweb/bases/dwrtoday.vdb - dwrtoday.vdb with such CRC32 already exists, downloading has been skipped
Jan 24 16:00:02 h1696522 update.pl[14292]: /var/drweb/updates/timestamp -    timestamp with such CRC32 already exists, downloading has been skipped
Jan 24 16:00:02 h1696522 update.pl[14292]: /var/drweb/bases/update.drl -   update.drl with such CRC32 already exists, downloading has been skipped
Jan 24 16:00:02 h1696522 update.pl[14292]: deleting old files ...
Jan 24 16:00:02 h1696522 update.pl[14292]: moving downloaded files from temporary to working directory ...
Jan 24 16:00:02 h1696522 update.pl[14292]: sending notifications ...
Jan 24 16:00:02 h1696522 update.pl[14292]: summary => updated: 0, removed: 0 files and 0 messages
Jan 24 16:00:02 h1696522 update.pl[14292]: Finish Success:   2011-01-24 16:00:02
Jan 24 16:00:02 h1696522 update.pl[14292]: Socket path is /var/drweb/run/updateSock

1
不要被pty错误所困扰,您应该验证您的。用户主目录中的文件没有损坏。创建另一个用户,并将新用户目录中的默认文件与florian的文件进行比较。
Patrick R

谢谢...我添加了另一个用户,但其中的文件相同。.bash_rc稍有不同,但是由于我的shell设置为zsh,所以它甚至都不应尝试使用此选项,对吗?@Fussy:我已经在问题中添加了auth.log和daemon.log的最后几行。该drweb内容似乎是原始安装中遗留的部分,原始安装中包含Plesk(它仍在8.04上,我在不久前进行了升级)
florianbaethge 2011年

Answers:


3

您是否尝试过重新创建pty和tty设备?

root@mydomain.de:~# /sbin/MAKEDEV tty
root@mydomain.de:~# /sbin/MAKEDEV pty

这似乎是虚拟服务器上的已知问题。

如果您无权访问任何shell,则可以尝试通过ssh发送命令:

florian@localmachine:~$ ssh root@mydomain.de "/sbin/MAKEDEV tty"
florian@localmachine:~$ ssh root@mydomain.de "/sbin/MAKEDEV pty"

编辑以反映您的评论:

如果使用chroot,还必须挂载/ proc,/ dev和/ sys:

root@h1696522:/# mount -o bind /proc /repair/proc
root@h1696522:/# mount -o bind /dev /repair/dev
root@h1696522:/# mount -o bind /sys /repair/sys

现在应该可以工作了。


是的,当我使用恢复模式(并chroot到/ repair)时,我可以访问:root @ h1696522:/ home#/ sbin / MAKEDEV tty / sbin / MAKEDEV:警告:无法读取/ proc / devices root @ h1696522:/主页#/ sbin / MAKEDEV pty / sbin / MAKEDEV:警告:无法读取/ proc / devices / sbin / MAKEDEV:警告:无法读取/ proc / devices
florianbaethge 2011年

这对我有用!!!非常感谢您的帮助!
florianbaethge,2011年

7

如果您具有控制台访问权限

mount devpts /dev/pts -t devpts

1
如果您可以以root用户身份使用SSH(有时将系统配置为允许它),则可以在上面通过SSH使用此方法。实际上,我就是这么做的。 ssh root@host "mount devpts /dev/pts -t devpts"正是医生命令的。
Emmaly Wilson 2014年

这对我有用,但是我现在需要在每次重新启动时进行。我该如何自动化?
Andrew Savinykh '18

3

遇到此错误时,我修复了该错误,以证明已安装并正在运行udev软件包。Udev会在需要时创建设备节点,例如ssh所需要的PTS / x。试试看。



0

我必须将此处发布的内容组合在一起。我的权限错了,/dev/pts已经被挂载了。

mount -t devpts -o remount,seclabel,nosuid,noexec,uid=0,gid=5,mode=620 devpts /dev/pts

使用它来验证您的权限是否正确。

grep devpts /proc/mounts

同时检查/dev/pts。它应该是755,并由root拥有。

ls -dl /dev/pts
chmod 755 /dev/pts
chown root:root /dev/pts

检查sshd_config文件。PermitTTY不应设置为no。如果是,则将其注释掉或将其设置为“是”。然后重新启动sshd。

vi /etc/ssh/sshd_config
service sshd restart
systemctl restart sshd
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.