[Ubuntu/Debian] 开启 root的ssh权限

1. 设置 root 用户密码

sudo passwd root

2. 安装 ssh

sudo apt update # 更新软件包列表
sudo apt install ssh -y # 安装 ssh

3. 编辑 sshd_config

sudo nano /etc/ssh/sshd_config

添加以下内容(如果已经存在,去除注释即可)

Port 22
AddressFamily any
ListenAddress 0.0.0.0
ListenAddress ::
PermitRootLogin yes
PasswordAuthentication yes

4. 重启 ssh 服务

sudo systemctl restart sshd

5. 测试 ssh 服务

输入以下指令, 并输入你设置的root的密码. 192.168.10.3是你的Ubuntu的IP

ssh root@192.168.10.3


[Ubuntu/Debian] 开启 root的ssh权限
https://blog.onanii0721.website//archives/ubuntu-kai-qi-root-yuan-cheng-fang-wen
作者
Gzcheng
发布于
2024年09月29日
更新于
2025年02月18日
许可协议