Ubuntu

無法通過 SSH 連接到伺服器 - “伺服器拒絕分配 pty”

  • November 27, 2019

我有一個執行 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

所以shell沒有打開,我不能輸入任何命令。我已經嘗試用Google搜尋“伺服器拒絕分配 pty”,但找不到任何有幫助的東西,儘管這個問題以前也發生在其他人身上。此外,有時我什至會收到不同的錯誤:“pty allocation request failed on channel 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

您是否嘗試重新創建 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

它現在應該可以工作了。

引用自:https://serverfault.com/questions/233962