1. 用ssh-keygen创建公钥,一直回车即可

root@kali:~# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
/root/.ssh/id_rsa already exists.
Overwrite (y/n)?

2.  ssh本机,提示输入密码。。。

root@kali:~/.ssh# /etc/init.d/ssh start
[ ok ] Starting OpenBSD Secure Shell server: sshd.
root@kali:~/.ssh# ssh localhost
root@localhost's password:

3. 将公钥拷为authorized_keys, 再实验ssh localhost,即可免密码登录

root@kali:~/.ssh# cp id_rsa.pub  authorized_keys
root@kali:~/.ssh# ls
authorized_keys id_rsa id_rsa.pub known_hosts
root@kali:~/.ssh# ssh localhost
Linux kali 3.7-trunk--pae # SMP Debian 3.7.-+kali8 i686 The programs included with the Kali GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright. Kali GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Thu Dec 19 22:41:22 2013 from localhost

4. 将公钥拷至被管理机上,再试试。喔??报错啦!

root@kali:~# ssh 192.168.0.102
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
:4e:4f:2b:b4:::7c:d2:::be::8d:bb:5f.
Please contact your system administrator.
Add correct host key in /root/.ssh/known_hosts to get rid of this message.
Offending RSA key in /root/.ssh/known_hosts:
RSA host key for 192.168.0.102 has changed and you have requested strict checking.
Host key verification failed.

这种情况是因为要ssh的机器上的ssh重新安装或者系统重装了,导致RSA host key 失效,解决方法:cd ~/.ssh  然后 rm -f known_hosts 即可重新登录

root@kali:~/.ssh# scp id_rsa.pub root@192.168.0.102:~/.ssh/authorized_keys
id_rsa.pub % .4KB/s :
root@kali:~# more /etc/hosts
127.0.0.1 localhost
192.168.0.101 node1
192.168.0.102 node2
# The following lines are desirable for IPv6 capable hosts
:: localhost ip6-localhost ip6-loopback
ff02:: ip6-allnodes
ff02:: ip6-allrouters
root@kali:~# ssh node2
The authenticity of host 'node2 (192.168.0.102)' can't be established.
RSA key fingerprint is :4e:4f:2b:b4:::7c:d2:::be::8d:bb:5f.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'node2' (RSA) to the list of known hosts.
Linux bt 3.2. # SMP Fri Feb :: EST i686 GNU/Linux System information as of Mon Mar :: CST System load: 0.0 Processes:
Usage of /: 41.9% of .15GB Users logged in:
Memory usage: % IP address for eth1: 192.168.0.102
Swap usage: % Graph this data and manage this system at https://landscape.canonical.com/
Last login: Mon Mar ::
root@bt:~# 这里已经登入了。。。

在此,已经完成了管理节点到被管理节点的免密码登录。

5. 将两机的authorized_keys文件合并。拷贝至两台机器上, 即可实现双机互相面密码登录

root@bt:~/.ssh# cat id_rsa.pub >>authorized_keys 
root@kali:~/.ssh# scp root@node2:~/.ssh/authorized_keys .
authorized_keys % .8KB/s :
root@bt:~/.ssh# ssh node1
The authenticity of host 'node1 (192.168.0.101)' can't be established.
RSA key fingerprint is ::d5:b1:ae::0f:1d:3d:3d:::9f:6f:e1:7c.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'node1,192.168.0.101' (RSA) to the list of known hosts.
Linux kali 3.7-trunk--pae # SMP Debian 3.7.-+kali8 i686 The programs included with the Kali GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright. Kali GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Mon Mar 3 21:19:04 2014 from localhost
root@kali:~# 这里实现了node2 登录node1

ssh面密码登录配置-hadoop安装准备的更多相关文章

  1. Centos6.5之ssh免密码登录配置

    Centos6.5之ssh免密码登录配置 centos ssh 免密码登录 0.说明 这里为了方便说明问题,假设有A和B两台安装了centos6.5的主机.目标是实现A.B两台主机分别能够通过ssh免 ...

  2. ssh免密码登录配置方法

    每次输密码很麻烦,免密登录设置方法按照<ssh免密码登录配置方法>即可,简单来说: 1.终端上执行ssh-keygen -t rsa,生成密钥对(存放在/home/usera/.ssh). ...

  3. SSH免密码登录配置

    ssh免密码登录Permission denied (publickey,gssapi-keyex,gssapi-with-mic) 的解决方案 1.在hadoop目录 新建.ssh目录 使用:ssh ...

  4. SSH免密码登录配置方法详解

    1.测试主机配置信息: 192.168.100.236 db06.chavin.king db06 192.168.100.237 db07.chavin.king db07 2.创建测试用户: gr ...

  5. ssh免密码登录配置方法,(图示加命令)

    首先,说明一下我们要做的是,serverA 服务器的 usera 用户免密码登录 serverB 服务器的 userb用户. 我们先使用usera 登录 serverA 服务器 [root@serve ...

  6. Linux多台服务器间SSH免密码登录配置

    SSH实现各个服务器间的文件相互备份,如运行scp命令,可以实现免密码登录,从而可以使用SHELL脚本实现一些自动化的处理. 假如A机要免密码登录B机,具体方法如下: 1.在A机运行:"ss ...

  7. ssh 免密码登录配置,及其原理

    1.废话不多说,先上图   2. 典型的RSA非对称加密 RSA加密算法是一种典型的非对称加密算法,它基于大数的因式分解数学难题,它也是应用最广泛的非对称加密算法,于1978年由美国麻省理工学院(MI ...

  8. CentOS 6.5配置SSH免密码登录

    centos 系统对权限的设置非常微妙,如果权限设置大了则ssh 拒绝,如果权限小了,则ssh 更是被拒绝(我曾经配置好久没有打通,就是因为权限过大的原因) 参考链接:http://www.linux ...

  9. Xshell配置ssh免密码登录-密钥公钥(Public key)与私钥(Private Key)登录【已成功实例】

    本文转自https://blog.csdn.net/qjc_501165091/article/details/51278696 ssh登录提供两种认证方式:口令(密码)认证方式和密钥认证方式.其中口 ...

随机推荐

  1. 关于Unity中3D声音的使用

    3D声音 3D立体声和2D声不同的地方是它是会随着距离衰减的,距离越近声音越大,距离越远声音越小. 1: 声音: 背景音乐和音效; 2: 声音文件支持的格式: ogg, mp3, wave, AIFF ...

  2. tensorflow的升级与版本管理

    1 查看cuda与cudnn的版本 cuda一般安装在 /usr/local/cuda/ 路径下,该路径下有一个version.txt文档,里面记录了cuda的版本信息 cat  /usr/local ...

  3. 【转】【Centos】centos 安装libtorrent/rtorrent

    1.下载编译时需要的软件 yum install gcc gcc-c++ m4 make automake libtool pkgconfig perl openssl-devel ncurses-d ...

  4. wifi 通过omnipeek 查看 pmf是否生效

    给android的wifi设备添加PMF支持时,抓取omnipeek分析. 从assoc req 中发现相关标志位没有使能,说明STA 没有使能PMF RSN Capabilities: %00000 ...

  5. Linux网络的设置

    一.介绍 目的:使Linux可以正常上网,前提是物理机可以上网 软件环境: 虚拟机版本: VMware Workstation 12, Linux系统版本:CentOS 7.3 二.设置网络 1,在登 ...

  6. asp.net mvc中配置路由默认值(Area中)

    public class RouteConfig { ] { "Best.Site.Areas.BestPalace" }; public static void Register ...

  7. mysql 中 时间和日期函数

    From: http://www.cnblogs.com/redfox241/archive/2009/07/23/1529092.html 一.MySQL 获得当前日期时间 函数 1.1 获得当前日 ...

  8. .net 图片上传

      /// <summary>      /// asp.net上传图片并生成缩略图      /// </summary>      /// <param name=& ...

  9. 【发包工具】http多线程发包工具

    [发包工具]http多线程发包工具 使用方法:输入地址,发送的内容,线程数,等待时间,每个线程发送的次数,GET/POST请求. 源代码 package com.xmxkkk.httptest; im ...

  10. ★Wireshark基本介绍和学习TCP三次握手

    之前写过一篇博客:用 Fiddler 来调试HTTP,HTTPS. 这篇文章介绍另一个好用的抓包工具wireshark, 用来获取网络数据封包,包括http,TCP,UDP,等网络协议包. 记得大学的 ...