ssh-keygen -t ed25519 -C "xxxxxx@xx.com"
Generating public/private ed25519 key pair.
Enter file in which to save the key (/Users/fyhsurvivors/.ssh/id_ed25519):
/Users/fyhsurvivors/.ssh/id_ed25519 already exists.
Overwrite (y/n)? y
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /Users/fyhsurvivors/.ssh/id_ed25519.
Your public key has been saved in /Users/fyhsurvivors/.ssh/id_ed25519.pub.
The key fingerprint is:
SHA256:eVTC9BP7dZ4mQVyJiIrWD2xhTDzorgsZI78zTJ+zB6k xxxxxx@xx.com
The key's randomart image is:
+--[ED25519 256]--+
| x. xx x.x..|
| . * .x.x +. |
| . x . xxx. o|
| x * x .xxx|
|.x ..x x . ..o.|
|.x. .x x x |
| .xx.x |
| xx .x |
| x.x. |
+----[SHA256]-----+
fyhsurvivors@survivors-deMacBook-Pro ~ % cat id_rsa.pub
cat: id_rsa.pub: No such file or directory
fyhsurvivors@survivors-deMacBook-Pro ~ % cd ~/.ssh
fyhsurvivors@survivors-deMacBook-Pro .ssh % ls
config id_ed25519.pub id_rsa.pub
id_ed25519 id_rsa known_hosts
fyhsurvivors@survivors-deMacBook-Pro .ssh % cat id_rsa.pub
ssh-rsa xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxx= xxxxxx@xx.com
fyhsurvivors@survivors-deMacBook-Pro .ssh %
首先,全部操作如上,在生成 生成新的 SSH 密钥 后复制其公钥的时候执行 cat id_rsa.pub 抛出了 No such file or directory
其次,重新 cd 到 ssh 层级后尝试获取
cd ~/.ssh
ls
最后,成功获取到其 list 后复制其需要的 id_rsa.pub 即可.
注:需要将其 copy 至类似记事本的文本框中后再次复制至 ssh 配置处,不然可能会出现格式异常的情况.
以上便是此次分享的全部内容,希望能对大家有所帮助!
网友评论