SSH Key
SSH Key (SSH 密钥)
What are SSH Keys?
What are SSH Keys? (什么是SSH密钥?)
SSH keys are an access credential used in SSH protocol (Secure Shell). A secure shell is a network protocol, which helps to login from one computer to another securely, as well as to manage networks, operating systems, and configurations. Functionally, SSH keys are nearly the same as passwords, but it’s more secure to log into a server with SSH keys than use only passwords because decrypt SSH is very difficult, almost impossible. (SSH密钥是SSH协议(安全外壳)中使用的访问凭据。安全外壳是一种网络协议,有助于安全地从一台计算机登录到另一台计算机,以及管理网络、操作系统和配置。在功能上, SSH密钥与密码几乎相同,但使用SSH密钥登录服务器比仅使用密码更安全,因为解密SSH非常困难,几乎不可能。)
SSH keys always come in pairs, and each of these pairs is composed of a public key and a private key. These two are types of keys. (SSH密钥始终成对出现,每对由公钥和私钥组成。这两种是钥匙的类型。)
Public keys, also known as authorized keys, determine who can access each system. Private or identity keys identify users and give them access. (公钥(也称为授权密钥)决定谁可以访问每个系统。 私钥或身份密钥用于识别用户并授予他们访问权限。)
How To Set Up SSH Keys?
How To Set Up SSH Keys? (如何设置SSH密钥?)
You need public-key cryptographic algorithms to generate SSH keys, mostly used of which are RSA key and DSA key. SSH keys are set up with the help of a key generation tool. (您需要公钥加密算法来生成SSH密钥,其中主要使用的是RSA密钥和DSA密钥。 SSH密钥是在密钥生成工具的帮助下设置的。)
Create an SSH key on Mac and Linux
Create an SSH key on Mac and Linux (在Mac和Linux上创建SSH密钥)
As these two operating systems have modern terminal applications, that combine with SSH package, the steps of creating an SSH key are the same for both of them. (由于这两个操作系统具有与SSH包相结合的现代终端应用程序,因此创建SSH密钥的步骤对于它们都是相同的。)
ssh-keygen -t rsa -b 4096 -C "[email protected]"
The ssh-agent is a tool responsible for holding private keys, but it also arranges requests to sign SSH requests with the private keys for security purposes. (Ssh-agent是负责保存私钥的工具,但出于安全目的,它还会安排使用私钥对SSH请求进行签名的请求。)
Execute the following code to make sure that the ssh-agent code is running:
$ eval "$(ssh-agent -s)"
> Agent pid 59566
If the ssh-agent code is running, add the new SSH key to the local SSH agent by executing the following command:
ssh-add -K /Users/you/.ssh/id_rsa
Create an SSH Key on Windows
Create an SSH Key on Windows (在Windows上创建SSH密钥)
You need Git Bash to create an SSH key on the Windows operating system. If you have it, you can generate the key following the same steps as given above. (您需要Git Bash才能在Windows操作系统上创建SSH密钥。如果您有密钥,可以按照上面给出的相同步骤生成密钥。)