sudo apt-get install openssh-server vim
sudo vim /etc/ssh/sshd_config
修改这几行
PubkeyAuthentication yes
#指定公钥数据库文件
AuthorsizedKeysFile.ssh/authorized_keys
#PasswordAuthentication yes 改为
PasswordAuthentication no
然后重启ssh服务
systemctl restart sshd.service