服务器版本: Ubuntu 20.04.5 LTS
ssh-keygen
cd .ssh/
cat id_rsa.pub >> authorized_keys
chmod 600 authorized_keys
chmod 700 ~/.ssh/
编辑配置文件
vim /etc/ssh/sshd_config
进行如下设置
RSAAuthentication yes
PubkeyAuthentication yes
PasswordAuthentication no
最后,重启 SSH 服务
service sshd restart