| 权限 | 私钥 600、authorized_keys 600、~/.ssh 目录 700 |
|---|---|
| 算法 | 优先 ed25519;使用 RSA 时长度不低于 3072 位 |
| 治理 | 按用途与主机拆分密钥,加口令,必要时使用 SSH 证书或集中管理 |
生成与核查
生成与核查
ssh-keygen -t ed25519 -C 'deploy@ci'
chmod 700 ~/.ssh && chmod 600 ~/.ssh/authorized_keys ~/.ssh/id_ed25519
ssh-keygen -lf ~/.ssh/id_ed25519.pubauthorized_keys 中的 command= 与 from= 限制可降低密钥滥用影响面,启用前需测试确认不影响业务。