多个ssh key 配置多个网址
多个 ssh key 配置多个网站
一、生成ssh key
ssh-keygen -t rsa -C "你的邮箱" -f ~/.ssh/id_rsa_one ssh-keygen -t rsa -C "你的邮箱" -f ~/.ssh/id_rsa_two # 不添加-f 参数 会默认将私钥保存在~/.ssh/id_rsa
二、修改配置文件config
vim ~/.ssh/config
Host github.com HostName github.com PreferredAuthentications publickey IdentityFile ~/.ssh/id_rsa_one # 默认使用的是id_rsa Host gitee.com HostName gitee.com PreferredAuthentications publickey IdentityFile ~/.ssh/id_rsa_two # 默认使用的是id_rsa Host ubuntu-1 HostName 192.168.0.91 Port 22 # ssh 访问端口 User root # 登陆用户 IdentityFile ~/.ssh/id_rsa
三、用ssh 命令验证
ssh -T ssh -T ssh ubuntu-1 # 类似登陆 ssh -p 22
四 、refer
相关推荐
returnspace 2020-06-21
hulao 2020-06-12
projava 2020-11-14
WanKaShing 2020-11-12
airfish000 2020-09-11
tryfind 2020-09-14
yegen00 2020-09-10
kkaazz 2020-09-03
风语者 2020-09-02
BraveWangDev 2020-08-19
lichuanlong00 2020-08-15
gsl 2020-08-15
pandaphinex 2020-08-09
yhuihon 2020-08-09
CheNorton 2020-08-02
xiangqiao 2020-07-28
hpujsj 2020-07-26
hpujsj 2020-07-26
sshong 2020-07-19