You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Rocky Linux 9.2下修改root主目录为/后SSH无法连接的问题求助

Rocky Linux 9.2下修改root主目录为/后SSH无法连接的问题求助

大家好,我目前用的是Rocky Linux 9.2,想把root用户的主目录改成单纯的/,而不是默认的/root或者其他路径,于是修改了sshd的配置文件,内容如下:

Match User root
    ChrootDirectory none
    AuthorizedKeysFile .ssh/authorized_keys
    AllowTcpForwarding yes
    PermitTunnel yes
    ForceCommand none

但改完之后我完全没法通过SSH连接了,不同应用的提示略有差异,但核心都是“初始化失败”。之后我还尝试了几种配置组合,都没能解决问题:

第一种组合:

Match User root
    ChrootDirectory /
    AuthorizedKeysFile .ssh/authorized_keys
    AllowTcpForwarding yes
    PermitTunnel yes
    ForceCommand none

第二种组合:

Match User root
    ChrootDirectory /

第三种组合:

Match User root
    ChrootDirectory /var

有没有大佬能帮我看看这到底是哪里出问题了呀?

备注:内容来源于stack exchange,提问作者Cain Nuke

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.16 09:29:30