我有一台运行 Ubuntu 10.10 的 STRATO V-PowerServer 用于我的东西,但最近通过 ssh 连接服务器时遇到了问题。
基本上我所拥有的只是对服务器的 ssh 访问权限,并且如果有必要,我可以启动到恢复模式,其中我所有的东西都在 /repair 中,以便我可以对系统进行任何修复。
问题是,当我尝试通过 ssh 连接到服务器时出现此错误:
Using username "florian".
[email protected]'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 分配请求在通道 0 上失败”,而不是其他错误。对于这个问题,我所能找到的只有以下内容:
https://www.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 和 tty 设备?
[email protected]:~# /sbin/MAKEDEV tty
[email protected]:~# /sbin/MAKEDEV pty
这似乎是虚拟服务器上的一个已知问题......
如果您无权访问任何 shell,您可以尝试通过 ssh 发送命令:
florian@localmachine:~$ ssh [email protected] "/sbin/MAKEDEV tty"
florian@localmachine:~$ ssh [email protected] "/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
现在它应该可以工作了。
答案2
如果您有控制台访问权限
mount devpts /dev/pts -t devpts
答案3
每次遇到这个错误,我都会修复它,确保 udev 包已安装并正在运行。Udev 会在需要时创建设备节点,例如 ssh 所需的 PTS/x。试试看。
答案4
我必须结合这里发布的内容进行操作。我的权限错误,并且/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。如果是,请将其注释掉或设置为 yes。然后重新启动 sshd。
vi /etc/ssh/sshd_config
service sshd restart
systemctl restart sshd