gpt4 book ai didi

ubuntu - ssh 到 localhost 显示 "Connection closed by remote host"

转载 作者:行者123 更新时间:2023-12-04 18:55:17 24 4
gpt4 key购买 nike

我已经安装了 ssh 并且可以正常工作。我跑了sudo chmod -R 777 /var它停止工作。我用 sudo chmod -R 700 /var 更改了权限但这并没有使它再次起作用。

当我做 ssh -v localhost我得到这个输出:

rajat@ubuntu:/$ ssh -v localhost
OpenSSH_5.8p1 Debian-1ubuntu3, OpenSSL 0.9.8o 01 Jun 2010
debug1: Connecting to localhost [127.0.0.1] port 22.
debug1: Connection established.
debug1: identity file /home/rajat/.ssh/id_rsa type -1
debug1: identity file /home/rajat/.ssh/id_rsa-cert type -1
debug1: identity file /home/rajat/.ssh/id_dsa type -1
debug1: identity file /home/rajat/.ssh/id_dsa-cert type -1
debug1: identity file /home/rajat/.ssh/id_ecdsa type -1
debug1: identity file /home/rajat/.ssh/id_ecdsa-cert type -1
ssh_exchange_identification: Connection closed by remote host
rajat@ubuntu:/$

最佳答案

OpenSSH 在文件和目录权限和所有权方面非常挑剔。 /var下的唯一目录至少在 RHEL/CentOS 上,它触及的是 /var/empty/sshd目录,它执行 chroot如果 UsePrivilegeSeparation设置为是。

将此设置在您的sshd_config文件:

UsePrivilegeSeparation no

然后重新启动 sshd,看看它是否有效。如果是这样,很可能是 /var/empty/sshd 上的权限/所有权这就是问题所在。

关于ubuntu - ssh 到 localhost 显示 "Connection closed by remote host",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8753682/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com