VPS密码密匙双重认证登录
为了vps安全一点配置禁止密码登录,只允许密匙登录的。
1 2 3 4 5 6 7 8 9 |
ssh-keygen cd .ssh cat id_rsa.pub >> authorized_keys chmod 600 authorized_keys chmod 700 ~/.ssh vi /etc/ssh/sshd_config PubkeyAuthentication yes PermitRootLogin yes PasswordAuthentication no |
到这里按说已经完成了,但是奇怪的是密码还是能登录,上一篇牢骚有说,然后弄了一个没有办法的办法,双登录验证
1 2 3 |
PasswordAuthentication yes AuthenticationMethods "publickey,password" systemctl restart sshd.service |
然后就成功了,除了网站漏洞和系统漏洞,那是绝对的安全啊。
空空如也!