华为云Debian12 ssh开启root远程登录
# 常规操作打开SSH配置文件/etc/ssh/sshd_config并编辑该文件
```
vi /etc/ssh/sshd_config
```
查找并修改以下两行内容(如果不存在则添加):
```
PermitRootLogin yes
PasswordAuthentication yes
```
将PermitRootLogin设为"yes"表示允许通过SSH登录到Root账户;
将PasswordAuthentication设为"yes"表示允许密码验证。
保存更改后重新启动SSH服务:
```
systemctl restart ssh
```
# 报错
ssh重启可能报错,第一时间检查了22端口也是打开的。
好像第一次遇到就是华为云的机器,不知道是不是有啥特殊设置。
# 解决方案
重装openssh
```
sudo apt-get remove openssh-server openssh-client --purge && sudo apt-get autoremove && sudo apt-get autoclean && sudo apt-get update
sudo apt-get install openssh-server openssh-client
systemctl restart ssh # 再重启
```
就暴力解决了。
页:
[1]