java免密访问linux,Linux免密登录
1、生成秘钥
root@ubuntu:/# ssh-keygen -t rsa
Created directory '/root/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:4ryyjfIbH/pAR6e1Q9yisdTtawHk1d3Kntoe4hXQeF0 root@slave2
The key's randomart image is:
+---[RSA 2048]----+
| . .. . .E|
| = + .o..o|
| + X o o.o..|
| o O = oo |
| . * S o ... |
| . + . . o o. |
| o + o .oo |
| . .B o . ..o.. |
| o*== ... |
+----[SHA256]-----+
一路回车即可
2、复制秘钥到指定机器
root@ubuntu:/# ssh-copy-id 10.12.204.232
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
The authenticity of host '10.12.204.232' can't be established.
ECDSA key fingerprint is SHA256:lUzIk/WnlpldJp4AZP6mn18osHhXMjkJvj2x4JInnQc.
Are you sure you want to continue connecting (yes/no)? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@slave2.com's password:
Number of key(s) added: 1
Now try logging into the machine, with: "ssh '10.12.204.232'"
and check to make sure that only the key(s) you wanted were added.
完成.......
本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!
