本文主要是介绍记录linux的SSH免密登录,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
当我们从一台机器通过ssh登录到另外一台机器的时候,总是会要求输入登录密码,为了不输入密码登录,ssh提供了免密码登录,也就是所谓的公钥登录,公钥登录就是用户把自己的公钥发送到远程主机上,当远程主机需要登录的时候会做一个验签名的操作,如果签名通过那么就不需要密码登录啦。具体操作如下。
1、生成rsa的秘钥对
进入当前用户的根目录,执行ssh-keygen -t rsa,输入四个回车就行,不需要写啥..
[hadoop@hadoop ~]$ cd
[hadoop@hadoop ~]$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/hadoop/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/hadoop/.ssh/id_rsa.
Your public key has been saved in /home/hadoop/.ssh/id_rsa.pub.
The key fingerprint is:
48:28:73:09:f6:8a:03:d0:ab:37:2d:34:65:23:18:89 hadoop@hadoop.madmant.com
The key's randomart image is:
+--[ RSA 2048]----+
|+=o |
|E.oo+o |
|. o==.. |
|..+= . . |
|oo.o . S
这篇关于记录linux的SSH免密登录的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!