内容目录
环境
ubuntu24.04
问题情况
明明PasswordAuthentication yes 然后
systemctl restart ssh
了还报错
Permission denied (publickey).
"Public Key" / "Password and Public Key" method required. (33)
解决
查看配置文件 发现还引用/etc/ssh/sshd_config.d/*.conf
root@ubuntu24-04:~# grep -v '^#' /etc/ssh/sshd_config | grep -v '^$'
Include /etc/ssh/sshd_config.d/*.conf
PermitRootLogin yes
AuthorizedKeysFile .ssh/authorized_keys .ssh/authorized_keys2
PasswordAuthentication yes
KbdInteractiveAuthentication no
UsePAM yes
X11Forwarding yes
PrintMotd no
AcceptEnv LANG LC_*
Subsystem sftp /usr/lib/openssh/sftp-server
进去一看
root@ubuntu24-04:~# grep -v '^#' /etc/ssh/sshd_config.d/60-cloudimg-settings.conf | grep -v '^$'
PasswordAuthentication no
改为yes 重启可用密码登陆了
小知识点grep过滤注释以及空行
grep -v '^#' /path/to/filename | grep -v '^$'
近期评论