linux 免密码登录

linux 免密码登录 配置

test 为本地linux

 192.168.1.70 为远程linux

[root@test:/home/root]$ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/root/.ssh/id_rsa.
Your public key has been saved in /home/root/.ssh/id_rsa.pub.
The key fingerprint is:
44:xx:30:xx:xx:76:4b:3a:82:fc:xx:0b:bf:xx:xx:fb root@test
The key's randomart image is:
+--[ RSA 2048]----+
| +.. |
| + = |
| o + = |
| . . o * . |
| o . = S |
| . o.+ . |
| . +o |
| . +. |
| oE. |
+-----------------+
[root@test:/home/root]$ssh-copy-id -i ~/.ssh/id_rsa.pub 192.168.1.70
The authenticity of host '192.168.1.70 (192.168.1.70)' can't be established.
RSA key fingerprint is 36:1f:9f:42:fe:7c:bd:34:5b:b0:06:3a:a2:52:b8:ba.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.1.70' (RSA) to the list of known hosts.
root@192.168.1.70's password:
Permission denied, please try again.
root@192.168.1.70's password:
Now try logging into the machine, with "ssh '192.168.1.70'", and check in:

.ssh/authorized_keys

to make sure we haven't added extra keys that you weren't expecting.

[root@test:/home/root]$

原文地址:https://www.cnblogs.com/testway/p/7723187.html