【问题标题】:Can't ssh into Apache server after changing file ownership?更改文件所有权后无法 ssh 进入 Apache 服务器?
【发布时间】:2018-03-29 15:02:08
【问题描述】:

我将 Apache Web 服务器上某些文件夹的所有者更改为我的用户名,以便进行编辑,我将它们全部更改回根目录。我正在使用sudo chown username:group -R *。现在没有人可以通过 SSH 连接到服务器。我不知道问题可能是什么。我所做的更改:

  • var/www/html 中的其他网络编辑
  • /var/www/html 中从here 创建了.htaccess 文件(试图启用gzip)
  • /etc/httpd/conf 中的“AllowOverride”从“None”更改为“All”(试图启用 .htaccess 文件):

#

# AllowOverride controls what directives may be placed in .htaccess files
# It can be "All", "None", or any combination of the keywords:
#   Options FileInfo AuthConfig Limit
#
AllowOverride All

为了完成所有这些,我需要将文件夹的所有者更改为我的用户名,我这样做了。然后我把它们改回来了。快换-o,没有人可以登录。我怎么搞砸了?

【问题讨论】:

    标签: apache ssh centos


    【解决方案1】:

    您需要做的第一件事是让某人在调试模式下进行 SSH。您可以使用-v 标志打开调试。例如,ssh -v user@hostname

    最可能的原因是您将身份验证设置为仅公钥,并且服务器上每个用户主目录中.ssh文件夹的权限不正确。验证:

    • .ssh 目录在服务器上的权限为 700 (drwx------)
    • 公钥(.pub 文件)为 644 (-rw-r--r--)
    • 用户机器上的私钥 (id_rsa) 应为 600 (-rw-------)
    • 最后,每个用户的主目录(在服务器上)不应被组或其他人写入(最多 755 (drwxr-xr-x))

    更多信息请参见this 回答。

    【讨论】:

    • 您好,非常感谢您的回复。我使用 ssh -v 进入并得到了这个:OpenSSH_6.9p1, LibreSSL 2.1.8 debug1: Reading configuration data /etc/ssh/ssh_config debug1: /etc/ssh/ssh_config line 21: Applying options for * debug1: Connecting to conference.cpes.vt.edu [128.173.89.44] port 22. debug1: Connection established. debug1: key_load_public: No such file or directory debug1: identity file /Users/laurenshutt/.ssh/id_rsa type -1 debug1: key_load_public: No such file or directory (this repeats for awhile)
    • 然后:debug1: Enabling compatibility mode for protocol 2.0 debug1: Local version string SSH-2.0-OpenSSH_6.9 debug1: Remote protocol version 2.0, remote software version OpenSSH_6.6.1 debug1: match: OpenSSH_6.6.1 pat OpenSSH_6.6.1* compat 0x04000000 debug1: Authenticating to conference.cpes.vt.edu:22 as 'support2' debug1: SSH2_MSG_KEXINIT sent Connection reset by 128.173.89.44
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-01-08
    • 2018-10-02
    • 2019-03-10
    • 2021-01-22
    • 1970-01-01
    • 2020-06-14
    相关资源
    最近更新 更多