本文采用默认命令安装
1:安装open-server
apt-get install openssh-server
2:生成密钥文件
ssh-keygen -t rsa -P ''
3:将私钥匙文件复制到授权文件中
cat id_rsa.pub >> ~/.ssh/authorized_keys
4:修改文件权限
chmod 600 id_ras
chmod 600 authorized_keys
5:修改配置开启密钥登入,以及关闭密码登入
vim /etc/ssh/sshd_config
PasswordAuthentication no #关闭密码登入
AuthorizedKeysFile .ssh/authorized_keys #配置授权密
PasswordAuthentication no
6:重启ssh服务
service ssh restart