Skip to content
This repository was archived by the owner on Apr 7, 2026. It is now read-only.

Commit 7561949

Browse files
authored
Merge pull request #3 from ICS-25Fall-FDU/Zecyel-patch-1
Refine SSH server documentation language
2 parents b4adce4 + c4ca491 commit 7561949

1 file changed

Lines changed: 31 additions & 20 deletions

File tree

docs/appendix/ssh-server.md

Lines changed: 31 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
## 1. SSH 简介
66

7-
SSH(Secure Shell)是一种加密的网络传输协议,可以在不安全的网络中为网络服务提供安全的传输环境。通过 SSH,您可以安全地连接到远程服务器并执行命令
7+
SSH(Secure Shell)是一种加密的网络传输协议,可以在不安全的网络中为网络服务提供安全的传输环境。通过使用 SSH,你可以安全地连接到远程服务器并执行命令
88

99
> [!tip]
1010
>
@@ -14,69 +14,80 @@ SSH(Secure Shell)是一种加密的网络传输协议,可以在不安全
1414
> - **便利性**:配置完成后无需每次输入密码
1515
> - **自动化**:支持脚本自动化操作
1616
17-
如果你好奇密钥是如何工作的,可以参考[这篇文章](https://www.ruanyifeng.com/blog/2011/08/what_is_a_digital_signature.html)
17+
如果你好奇密钥是如何工作的,可以参考[这篇文章](https://www.ruanyifeng.com/blog/2011/08/what_is_a_digital_signature.html)
1818

1919
## 2. 生成 SSH 密钥对
2020

21+
下文将引导大家创建自己的 Ed25519 算法加密的 SSH 密钥对。不过,如果你已经有了 RSA 算法加密的密钥对,不用担心,它也能正常工作。
22+
2123
### 检查现有密钥
2224

2325
在生成新密钥之前,先检查是否已经存在 SSH 密钥:
2426

2527
```bash
26-
# 在终端输入以下命令
27-
ls -la ~/.ssh
28+
ls ~/.ssh
2829
```
2930

30-
如果目录不存在或为空,说明您还没有 SSH 密钥,可以继续下面的步骤。
31+
如果目录不存在或为空,说明你还没有 SSH 密钥,可以继续下面的步骤。
3132

3233
> [!tip]
3334
>
34-
>如果您有 `id_rsa``id_rsa.pub` 文件,说明您已经有 SSH 密钥对了。可以移步到配置服务器连接
35+
>如果你有 `id_rsa``id_rsa.pub` 文件(由 RSA 算法加密),或 `id_ed25519``id_ed25519.pub` 文件(由 Ed25519 算法加密),说明你已经有 SSH 密钥对了。可以移步到[向他人分享你的公钥](#向他人分享你的公钥)
3536
3637
### 生成新的密钥对
3738

3839
在终端中输入以下命令生成 SSH 密钥对:
3940

4041
```bash
41-
# 在终端输入,替换自己的邮箱地址
42-
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
42+
ssh-keygen
4343
```
4444

45-
执行上述命令后,系统会提示您进行一系列配置:
45+
执行上述命令后,系统会提示你进行一系列配置。除非你有配置 passphrase 的需求并且知道自己在做什么,否则连按三个回车即可。
4646

4747
```bash
48-
# 连按三个回车即可
49-
Enter file in which to save the key (/Users/yourusername/.ssh/id_rsa):
48+
Enter file in which to save the key (/home/yourusername/.ssh/id_ed25519):
5049
Enter passphrase (empty for no passphrase):
5150
Enter same passphrase again:
5251
```
5352

5453
### 验证密钥生成
5554

56-
密钥生成完成后,您可以查看生成的文件
55+
密钥生成完成后,你可以查看生成的文件
5756

5857
```bash
59-
ls -la ~/.ssh
58+
ls ~/.ssh
6059
```
6160

62-
您应该能看到以下文件:
61+
你应该能看到以下文件:
62+
63+
- `id_ed25519`:私钥文件(请妥善保管,不要泄露)
64+
- `id_ed25519.pub`:公钥文件(可以安全地分享给服务器)
6365

64-
- `id_rsa`:私钥文件(请妥善保管,不要泄露)
65-
- `id_rsa.pub`:公钥文件(可以安全地分享给服务器)
66+
私钥和公钥统称为一组“密钥”或“密钥对”。
6667

67-
查看公钥内容:
68+
### 向他人分享你的公钥
69+
70+
如果你使用 RSA 算法加密的密钥,在终端中运行下面的命令:
6871

6972
```bash
7073
cat ~/.ssh/id_rsa.pub
7174
```
7275

73-
观察到输出为:`ssh-rsa xxxxxxxxxxxxxxx = xxxxx@xxxx.xx` 即正确
76+
如果你使用 Ed25519 算法加密的密钥,在终端中运行下面的命令:
77+
78+
```bash
79+
cat ~/.ssh/id_ed25519.pub
80+
```
81+
82+
观察到输出为 `ssh-rsa xxxxxxxxxxxxxxx xxxxx@xxxx``ssh-ed25519 xxxxxxxxxxxxxxx xxxxx@xxxx`,这就是你的公钥,可以复制并分享给他人。
7483

7584
## 3. 使用 VS Code 的 Remote 插件进行远程开发
7685

86+
注意,下面的操作请在已经分配到服务器之后再执行。
87+
7788
### 安装 VS Code 插件
7889

79-
![remote_explorer](remote_explorer.png)
90+
![remote_explorer](remote_explorer.png)
8091

8192
### 配置文件
8293

@@ -107,4 +118,4 @@ Are you sure you want to continue connecting (yes/no/[fingerprint])?
107118
108119
输入 `yes` 并按回车键继续。
109120
110-
如果配置正确,您应该能够成功登录到服务器而无需输入密码
121+
如果配置正确,你应该能够成功登录到服务器而无需输入密码

0 commit comments

Comments
 (0)