把密钥保存到本地,把公钥添加进authorized_keys就不说了,可以看之前的文章。
开始修改:
1:修改/etc/ssh/sshd_config文件
找到:
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys
先把这3行命令改了,如果默认前面带了#,就把#给删掉,这里是让可以用密钥登录。
然后再找到:
PasswordAuthentication no
这里默认是yes,所以把改成no,就是禁止密码登录。
2:重启sshd服务
centos7 命令:
systemctl restart sshd.service
重点提示:
添加进去的公钥内容一定不要搞错了,密钥也不要搞丢了,如果你服务器的运营商没有web控制面板(比如novnc),那你要是改错了,就进不去服务器了。
微信公众号
手机浏览(小程序)
Warning: get_headers(): SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in
/mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line
57
Warning: get_headers(): Failed to enable crypto in
/mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line
57
Warning: get_headers(https://static.shanhubei.com/qrcode/qrcode_viewid_893.jpg): failed to open stream: operation failed in
/mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line
57