关闭ssh的密码登录 首先编辑sshd的配置文件: ``` vim /etc/ssh/sshd_config ``` 注意,`/etc/ssh/`下可能会有`sshd_config.d`的配置文件夹,不要漏掉里面的文件。 修改下面的内容,确保: ``` PubkeyAuthentication yes PasswordAuthentication no ``` 确认`.ssh/authorized_keys`里面已经配置了你准备用来登录的合适的证书。否则可能会有麻烦。 然后,可以在客户端,使用这个命令进行登录方式的检查。 ``` ssh -o PreferredAuthentications=none -o PubkeyAuthentication=yes root@47.xx.xx.94 ``` 返回**不带有**(publickey,password),则认为是成功 ``` Permission denied (publickey). ``` 来自 大脸猪 写于 2025-01-24 16:43 -- 更新于2025-01-24 16:44 -- 0 条评论