sed -i 's/^#\?PasswordAuthentication.*/PasswordAuthentication yes/' /etc/ssh/sshd_config && \sed -i 's/^#\?PermitRootLogin.*/PermitRootLogin yes/' /etc/ssh/sshd_config && \sshd -t && \systemctl restart ssh🔍 命令说明:
- PasswordAuthentication yes 允许使用密码登录(默认可能是 no)。
- PermitRootLogin yes 允许 root 用户直接用密码登录。
- sshd -t 验证配置文件 。
- systemctl restart ssh 重启 SSH 服务,使配置生效。
评论 (0)