Skip to content

Instantly share code, notes, and snippets.

@robertu7
Last active August 29, 2015 14:16
Show Gist options
  • Save robertu7/7e405a92c87bd8088861 to your computer and use it in GitHub Desktop.
Save robertu7/7e405a92c87bd8088861 to your computer and use it in GitHub Desktop.
使用 SSH 证书登录
1. 本地生成公私钥:ssh-keygen -t rsa
2. 复制 id_rsa.pub 到 远端 .ssh/authorized_keys(权限:644)
3. 修改配置 /etc/ssh/sshd_config
- RSAAuthentication yes
- PubkeyAuthentication yes
- AuthorizedKeysFile .ssh/authorized_keys
- 可选:PasswordAuthentication no
4. 重启 sshd 服务:service sshd restart
5. 注意本地 id_rsa 文件权限
# https://www.digitalocean.com/community/tutorials/how-to-set-up-ssh-keys--2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment