SSH配置与使用

1 SSH是什么

SSH(Secure Shell Protocol)是一种加密的网络传输协议。

2 基本用法

2.x config配置

配置项 说明
Host 对其他的声明项做分组。
HostName 指明登录的服务器真实域名。
User 指明登录HostName使用的用户名。
IdentityFile 指明User登录HostName时,使用的密钥位置。

如下是一个示例:

Host github.com
	HostName github.com
	User user1
	IdentityFile ~/.ssh/id_rsa

Host anotherHost
	HostName github.com
	User user2
	IdentityFile ~/.ssh/id_rsa_user2

3 原理

4 Github使用场景