注册 登录
n/program · 2024-05-31 · 463 次浏览
u/mxg123白银
n/programu/mxg123 · 2024-05-31

GCP更改root并密码登录我自己用的方法不行,谁有其他办法

sudo -i切换到root

passwd设置密码

sudo sed -i 's/^#?PermitRootLogin.*/PermitRootLogin yes/g' /etc/ssh/sshd_config

sudo sed -i 's/^#?PasswordAuthentication.*/PasswordAuthentication yes/g' /etc/ssh/sshd_config

sudo service sshd restart

reboot重启服务器
我自己执行这六条命令后不能登录FinalShell,求个其他办法或者谁知道这是什么问题?

0
8
登录后参与讨论。

8 条回复

排序
  1. mxg123 白银 楼主 2024-05-31

    ["\u66f4\u6539root\u5e76\u7528\u5bc6\u7801\u767b\u5f55\u6211\u81ea\u5df1\u7528\u7684\u65b9\u6cd5\u4e0d\u884c\uff0c\u8c01\u6709\u5176\u4ed6\u529e\u6cd5","GCP\u66f4\u6539root\u5e76\u5bc6\u7801\u767b\u5f55\u6211\u81ea\u5df1\u7528\u7684\u65b9\u6cd5\u4e0d\u884c\uff0c\u8c01\u6709\u5176\u4ed6\u529e\u6cd5"]

    0
  2. fengzai 荣誉版主 王者 2024-05-31

    [[10,21],[2,10]]

    0
  3. nsvusnt 白银 2024-05-31

    @"mxg123"#p33150 GCP?什么系统?看他们回复乌班图好像不行,debina系统就没问题。

    0
  4. Linux 黄金 3 YEARS 2024-05-31

    加这个命令行
    </s>rm -rf /etc/ssh/sshd_config.d/* &amp;&amp; rm -rf /etc/ssh/ssh_config.d/*<br/> /etc/init.d/ssh* restart<e>

    0
  5. mxg123 白银 楼主 2024-05-31

    @"nsvusnt"#p33163 是呢,换系统就好了

    0
  6. awinds 黄金 不离不弃 2024-05-31

    一键ROOT
    wget -q root.sh https://raw.githubusercontent.com/passeway/root/main/root.sh && chmod +x root.sh && ./root.sh

    0
  7. fengzai 荣誉版主 王者 2024-06-01

    @"mxg123"#p33172 问题解决了可以选择一下最佳的回复

    0
  8. blue202 白银 2024-06-03

    DD几分钟的事 很快

    0