"Go" The same computer about multiple SSH Key Management

Source: Internet
Author: User

Original link http://yijiebuyi.com/blog/f18d38eb7cfee860c117d629fdb16faf.html

Usage environment: Use multiple SSH key switches for the same computer Linux system (or multiple users using SSH to submit code)

requirements, you can create a different public KEY, set according to the following steps.

(1) For example, there are AAA,BBB,CCC three accounts need to generate a different public KEY

$ ssh-keygen -t rsagenerating public/private rsa key pair. enter file in which to save the key  (/ROOT/.SSH/ID_RSA):/root/.ssh/id_ rsa_aaaenter passphrase  (empty for no passphrase): Enter same passphrase  again:your identification has been saved in /root/.ssh/id_rsa_aaa. Your public key has been saved in /root/.ssh/id_rsa_aaa.pub.the key  fingerprint is:9b:92:f6:1f:d2:72:bd:72:19:45:42:5f:e4:65:33:64 [email protected]The  Key ' s randomart image is:+--[ rsa 2048]----+|           &NBSP, ....  . e=| |            &NBSP, .... o++| |              o. .| |               .  | |         s    .   | |        . +&NBSP, ....     | |       + = + .o   | |      . o +. o.   | |         ...o.    |+-----------------+

Into the shell above we create the ID_RSA_AAA private key and id_rsa_aaa.pub public key in the/root/.ssh/directory

Watch this.

Enter file in which to save the key (/root/.ssh/id_rsa):/root/.ssh/id_rsa_aaa #设置路径 If default build Id_rsa and Id_rsa.pub are not set

(2) Follow the above steps to generate the BBB and CCC corresponding public and private keys ....

(3) Check the system Ssh-key Agent, execute the following command

$ ssh-add-lcould Not open a connection to your authentication agent. If you find the above hint, the system agent does not have any key, do the following operations exec ssh-agent bash

If the system already has a Ssh-key agent, execute the following command to remove

$ ssh-add-d

(4) Add the 3 private keys under the. SSH directory ssh-agent

$ ssh-add ~/.ssh/id_rsa_aaa$ ssh-add ~/.ssh/id_rsa_bbb$ ssh-add ~/.SSH/ID_RSA_CCC

Execute the above three shells in turn to add three private keys to the Ssh-key agent

(5) Open the GitHub or open source China SSH Admin page to save the corresponding public key submission to the Code Management Server (. Pub end)

(6) Create config profile in. SSH Directory

Nano ~/.ssh/config

Enter the following configuration information

#aaa (GitHub config) host AAA HostName github.com User git identityfile ~/.ssh/id_rsa_aaa#bbb (open source China config) host BBB H Ostname git.oschina.net User git identityfile ~/.ssh/id_rsa_bbb#ccc ...

(6) Remember the alias set in the previous step of the Host, start cloning the project to open source China as an example

git clone [email protected]:username/projectname.git

To this end, multiple Ssh-key can already be used simultaneously.

"Go" The same computer about multiple SSH Key Management

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.