Skip to content

Latest commit

 

History

History
66 lines (51 loc) · 1.18 KB

ssh.md

File metadata and controls

66 lines (51 loc) · 1.18 KB

ssh 配置

1. 生成公私钥

# ssh-keygen -t [rsa / ed25519] -C "[email protected]"

Generating public/private rsa key pair.
Enter file in which to save the key (/home/binacs/.ssh/id_rsa): /home/binacs/.ssh/xxx
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /home/binacs/.ssh/xxx.
Your public key has been saved in /home/binacs/.ssh/xxx.pub.
The key fingerprint is:
SHA256:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx [email protected]
The key's randomart image is:
+---[RSA 2048]----+
|X= .  ..o        |
|*.=  . . o       |
|.o oE   . .      |
|.. .. ....       |
|. .  ..=S  .     |
|      *++.+ .    |
|     . B=B o     |
|      + X*o .    |
|       o+B+o     |
+----[SHA256]-----+

2. 配置 ~/.ssh/config

Host github
  HostName github.*
  User [email protected]
  IdentityFile ~/.ssh/github

Host host1
  HostName host1.cn
  User [email protected]
  IdentityFile ~/.ssh/host1

Host host2
  HostName host2.cn
  User [email protected]
  IdentityFile ~/.ssh/host2

3. ssh agent

ssh-agent -s

ssh-add ~/.ssh/github

ssh-add ~/.ssh/host1

ssh-add ~/.ssh/host2

4. TEST