94 字
1 分钟
debian开启root用户ssh登录
#!/bin/bashset -e
# 设置 root 密码echo "请输入新的 root 密码:"passwd root
# 修改 SSH 配置文件SSHD_CONFIG="/etc/ssh/sshd_config"
# 备份配置文件cp $SSHD_CONFIG ${SSHD_CONFIG}.bak.$(date +%F-%T)
# 开启 root 登录sed -i 's/^#\?PermitRootLogin.*/PermitRootLogin yes/' $SSHD_CONFIGsed -i 's/^#\?PasswordAuthentication.*/PasswordAuthentication yes/' $SSHD_CONFIG
# 重启 SSH 服务if command -v systemctl &>/dev/null; then systemctl restart ssh || systemctl restart sshdelse service ssh restart || service sshd restartfi
echo "✅ Root SSH 登录已开启!"发现错误或想要改进这篇文章?
在 GitHub 上编辑此页 debian开启root用户ssh登录
https://jk.sb/posts/debian-root-ssh/