Add these lines into you ~/.ssh/config file. It can help you send keepalive message 6 times every 30 seconds.
Host *
ServerAliveInterval 30
ServerAliveCountMax 6
Add these lines into you ~/.ssh/config file. It can help you send keepalive message 6 times every 30 seconds.
Host *
ServerAliveInterval 30
ServerAliveCountMax 6
其实步骤很简单:
1)在本地主机生成密钥对
ssh-keygen -t rsa
再输入密钥时候,直接按回车,我们的目的是不用输入密码嘛。
这个命令生成一个密钥对:id_rsa(私钥文件)和 id_rsa.pub(公钥文件)。默认被保存在 ~/.ssh/ 目录下。
2)将公钥添加到远程主机的 authorized_keys 文件中
SSH 到登陆到远程主机,将公钥追加到 authorized_keys 文件中