ssh配置

生成ssh-key

ssh-keygen

免密登录

将本机的ssh-key复制到远程服务器的.ssh/authorized_keys

可能需要改权限 chmod 600 .ssh/authorized_keys

禁止SSH口令登录

为了安全性更高,我们既然已经使用了密钥免密登录,那么就可以直接禁止再使用口令来连接SSH远程主机了。

编辑配置文件

vi /etc/ssh/sshd_config

#PasswordAuthentication yes 改为
PasswordAuthentication no

systemctl restart sshd.service

添加新评论

icon_mrgreen.gificon_neutral.gificon_twisted.gificon_arrow.gificon_eek.gificon_smile.gificon_confused.gificon_cool.gificon_evil.gificon_biggrin.gificon_idea.gificon_redface.gificon_razz.gificon_rolleyes.gificon_wink.gificon_cry.gificon_surprised.gificon_lol.gificon_mad.gificon_sad.gificon_exclaim.gificon_question.gif