SSH 设置免密登录
生成本机的 SSH 公钥
$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/xxx/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/xxx/.ssh/id_rsa.
Your public key has been saved in /home/xxx/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:WZPLsTKhNoeqzL6lCBhG1XaHvQw2dCiTO5uvXHm5HLU xxx@300-15isk
The key's randomart image is:
+---[RSA 2048]----+
| .. o.+. |
| . * B.o . |
| . . * * * |
|. o o B = |
|.. O S +. |
|o. = o.oo . |
|o o .o + E |
|.+ +. ..o o |
|..B. o. o |
+----[SHA256]-----+
$ cat ~/.ssh/id_rsa.pub
ssh-rsa ... xxx@xxx
将公钥内容拷贝追加到远程机器的指定文件中
ssh xx@xx
cd ~/.ssh
echo '公钥内容' >> ./authorized_keys
(本文完)