栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

一个机器管理多个ssh key

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

一个机器管理多个ssh key

1. ssh key生成(save the key 路径一定要区分开,不要覆盖)
ssh-keygen -t rsa -C "email"
Generating public/private rsa key pair.
Enter file in which to save the key (~/.ssh/id_rsa):<不要直接回车,填写自己定义的名字>
Enter passphrase(empty for on passphrase):<不要直接回车,填写自己定义的密码>
2. 上传公钥到仓库网站

读取*.pub的内容,粘贴到服务网站上。记住对应的用户名。

3. .ssh/config 配置要点在于Host与HostName的区别:
  • HostName:是填写真实的服务地址。
  • Host:是填写别名,后面会用上。
  • IdentityFile:填写的是证书的所在位置,你也可以把证书保存在任何地方。
# github
Host github.com
HostName github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa_github

# oschina
Host gitee.com
HostName gitee.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa_gitee
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/940522.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号