安装 ssh 服务器端
sudo apt install openssh-server
把公钥加入认证列表
cd ~/.ssh
cat id_rsa.pub >> authorized_keys
chmod 600 authorized_keys
修改配置文件
sudo vim /etc/ssh/sshd_config
// 允许公钥认证
PubkeyAuthentication yes
// 禁止密码登陆
PasswordAuthentication no
// 禁止 root 用户登陆
PermitRootLogin yes
不要忘记重启 ssh 服务!
service ssh restart