[hadoop@hadoop01 ~]$ cd .ssh
[hadoop@hadoop01 .ssh]$ ll -d ./  #查看.ssh文件夹的权限
drwx------. 2 hadoop hadoop 4096 Jun 19 23:44 ./  #.ssh文件夹的权限为700,如果不是,必须执行chmod 700 ./进行修改,否则,即使配置了无密钥登录后面仍然需要密码
[hadoop@hadoop01 .ssh]$ ls
authorized_keys id_rsa id_rsa.pub known_hosts
[hadoop@hadoop01 .ssh]$ rm -rf ./*  #清空文件夹
[hadoop@hadoop01 .ssh]$ 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:
a2:78:65:72:49:9a:71:91:aa:8f:3b:3e:a8:b3:74:87 hadoop@hadoop01.zjl.com
The key's randomart image is:
+--[ RSA 2048]----+
| .. |
| .. |
| ..o |
| .* . |
| .+ * S |
| ...* . |
| o.Eo. |
|+ =.o |
|++o+ |
+-----------------+
[hadoop@hadoop01 .ssh]$ ll
total 8
-rw-------. 1 hadoop hadoop 1675 Jun 19 23:41 id_rsa  #秘钥
-rw-r--r--. 1 hadoop hadoop 405 Jun 19 23:41 id_rsa.pub  #公钥 [hadoop@hadoop01 .ssh]$ ssh-copy-id hadoop02.zjl.com  #将公钥发送给远程主机
The authenticity of host 'hadoop01.zjl.com (192.168.0.131)' can't be established.
RSA key fingerprint is 60:10:35:2f:64:08:bf:82:e5:bc:56:8c:3d:60:18:13.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'hadoop01.zjl.com,192.168.0.131' (RSA) to the list of known hosts.
hadoop@hadoop01.zjl.com's password:
Now try logging into the machine, with "ssh 'hadoop01.zjl.com'", and check in: .ssh/authorized_keys to make sure we haven't added extra keys that you weren't expecting. [hadoop@hadoop01 .ssh]$ ssh hadoop01.zjl.com  #无密码登录
 Last login: Mon Jun 19 23:30:46 2017 from 192.168.0.1
[hadoop@hadoop02 ~]$  #无密码登录成功

  所谓公钥登录,就是用户将自己的公钥储存在远程主机上。登录的时候远程主机回向用户发送一段随机字符串,用户用自己的秘钥加密后再发送给远程主机。远程主机用事先储存的公钥进行解密,如果成功,就证明用户是可信的,直接允许登录shell,不再要求密码。

配置SSH无秘钥登录的更多相关文章

  1. ssh无秘钥登录

    服务器1:172.16.20.136 服务器2:172.16.20.134 在服务器2上输入:ssh-keygen -t rsa           (一路回车) scp /root/.ssh/id_ ...

  2. 配置SSH使用秘钥登录

    使用密码远程登录ssh还是有比较大的风险的,比较安全的方法是使用秘钥登录 配置步骤如下 首先生成秘钥 ssh-keygen  (直接默认回车也可以,生成的秘钥和公钥默认防止在/root/.ssh/文件 ...

  3. ssh 无秘钥登录

    三台centos 一台服务器192.168.2.152 一台客户端192.168.2.142 一台客户端192.168.2.151 (1)产生无密钥 [root@localhost ~]#  ssh- ...

  4. Linux SSH 免秘钥登录

    SSH 免秘钥登录 ssh:是一种安全加密协议 ssh  username@hostname     ssh gongziyuan.com:以当前用户登录该机器(如果不是当前用户,需要这么干:ssh ...

  5. ansible-playbook 打通ssh无秘钥

    建议参考: http://www.cnblogs.com/jackchen001/p/6514018.html 这个代码清晰,效果佳! 参考链接: http://www.cnblogs.com/cao ...

  6. linux下ssh免秘钥登录

    1.检查防火墙是否关闭 (1)切换到root用户 (2)查看防火墙状态 service iptables status 这是没有关闭 (3)设置关闭 service iptables stop 2.检 ...

  7. SSH设置秘钥登录

    设置 SSH 通过密钥登录 我们一般使用 PuTTY 等 SSH 客户端来远程管理 Linux 服务器.但是,一般的密码方式登录,容易有密码被暴力破解的问题.所以,一般我们会将 SSH 的端口设置为默 ...

  8. ssh免秘钥登录

    简介 SSH 为 Secure Shell 的缩写,由 IETF 的网络小组(Network Working Group)所制定:SSH 为建立在应用层基础上的安全协议.SSH 是目前较可靠,专为远程 ...

  9. Centos7 配置ssh 免秘钥登陆

    1.yum install -y openssh 2.servier1: ssh-keygen -t rsa #有提示的直接enter 3.server 2: ssh-keygen -t rsa # ...

随机推荐

  1. ZooKeeper实践:(2)集群管理

    前言: 随着业务的扩大,用户的增多,访问量的增加,单机模式已经不能支撑,从而出现了从单机模式->垂直应用模式->集群模式,集群模式诞生了,伴随着一堆问题也油然而生,Master怎么选举,机 ...

  2. 空间索引 - GeoHash算法及其实现优化

    h1,h2,h3,h4,h5,h6,p,blockquote { margin: 0; padding: 0 } body { font-family: "Helvetica Neue&qu ...

  3. php对文件操作(读、写、)的基础知识(详细)

    文件位置如下图所示: 1.判断是文件还是目录 var_dump(filetype("./aa/bb/cc.txt")); 输出: string(4) "file" ...

  4. jQuery插件ImgAreaSelect 实例讲解一(头像上传预览和裁剪功能)

    上一节随笔中,我们已经知道了关于jQuery插件ImgAreaSelect基本的知识:那么现在看一下实例: 首先,要知道我们应该实现什么功能? (1)图片能够实现上传预览功能 (2)拖拽裁剪图片,使其 ...

  5. Day2-字符编码转换

    1.在python2默认编码是ASCII, python3里默认是unicode 2.unicode 分为 utf-32(占4个字节),utf-16(占两个字节),utf-8(占1-4个字节), so ...

  6. SpringBoot系列(一)RestTemplate

    作为springBoot的开篇系列,RestTemplate只能表示我只是个意外 what RestTemplate是spring提供的用于访问rest服务的客户端(其实类似Apache的HttpCl ...

  7. Eclipse中如何关联Javadoc

    MySQL重置密码:http://www.jb51.net/article/35061.htm Eclipse有直接查看java文档和类库源码的功能,不过得手工添加才行,下面对如何在Eclipse中添 ...

  8. 【Netty】Netty之ByteBuf

    一.前言 前面已经学习了Netty中传输部分,现在接着学习Netty中的ByteBuf. 二.ByteBuf 2.1 ByteBuf API 在网络上传输的数据形式为Byte,Java NIO提供了B ...

  9. 从零自学Hadoop(23):Impala介绍及安装

    阅读目录 序 介绍 安装 系列索引 本文版权归mephisto和博客园共有,欢迎转载,但须保留此段声明,并给出原文链接,谢谢合作. 文章是哥(mephisto)写的,SourceLink 序 上一篇, ...

  10. 文字在div中居中

    话不多说,看代码 div class="div1"> <span class="span2">等级分类法拉盛说的分离卡萨丁</span& ...