0

我已经安装了 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:/$ 
4

2 回答 2

4

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

sshd_config在你的文件中设置这个:

UsePrivilegeSeparation no

然后重新启动 sshd,看看它是否有效。如果这样做,则可能是/var/empty/sshd导致问题的权限/所有权。

于 2012-01-06T07:02:39.203 回答
2

如果有人在尝试连接到在 VirtualBox 上运行的 Ubuntu VM 时遇到类似的错误消息,请在网络设置中将第二个网络适配器设置为“桥接”,并将“NAT”上的端口转发设置为 22。

于 2013-06-25T01:17:21.963 回答