在命令行中输入: ssh-keygen -t rsa -C "your_email@example.com" cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys chmod 600 ~/.ssh/authorized_keys chmod 700 ~/.ssh vim /etc/ssh/sshd_config

RSAAuthentication yes
PubkeyAuthentication yes
#添加心跳检测
ClientAliveInterval 60
ClientAliveCountMax 1

service sshd restart