35.3. 创建 SSH 密钥
在 Business Central 中添加或注册 SSH 密钥前,您必须在您的系统中生成 SSH 密钥。
流程
- 在 系统上打开一个命令终端。
运行
ssh-keygen命令创建 SSH 密钥,如下例所示,其中 <user_login> 是您的用户名:ssh-keygen -t rsa -b 4096 -C "<user_login>"
ssh-keygen -t rsa -b 4096 -C "<user_login>"Copy to Clipboard Copied! Toggle word wrap Toggle overflow 注意Business Central 密钥存储支持的 SSH 密钥格式是
ssh-rsa、ssh-dss、ecdsa-sha2-nistp256、ecdsa-sha2-nistp384和ecdsa-sha2-nistp521。提示时,按 Enter 并接受默认密钥文件位置,如下例所示,其中 <
user_login> 是您的用户名:Enter a file in which to save the key (/home/<user_login>/.ssh/id_rsa): [Press enter]
Enter a file in which to save the key (/home/<user_login>/.ssh/id_rsa): [Press enter]Copy to Clipboard Copied! Toggle word wrap Toggle overflow 在命令提示符处,输入并确认密码短语:
Enter passphrase (empty for no passphrase): [Type a passphrase] Enter same passphrase again: [Type passphrase again]
Enter passphrase (empty for no passphrase): [Type a passphrase] Enter same passphrase again: [Type passphrase again]Copy to Clipboard Copied! Toggle word wrap Toggle overflow 启动
ssh-agent:eval "$(ssh-agent -s)" Agent pid <any-number-here>
eval "$(ssh-agent -s)" Agent pid <any-number-here>Copy to Clipboard Copied! Toggle word wrap Toggle overflow 将新的 SSH 私钥添加到
ssh-agent。如果您使用了不同的密钥名称,请在该代码中替换id_rsa:ssh-add ~/.ssh/id_rsa
ssh-add ~/.ssh/id_rsaCopy to Clipboard Copied! Toggle word wrap Toggle overflow