我只有一台机器,是因为要配置hadoop分布式环境用,需要配置ssh

两个用户:  zhangxs,  root

首先在切换到zhangxs用户下

执行【 ssh-keygen -t rsa】

[zhangxs@zhangxs Desktop]$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/zhangxs/.ssh/id_rsa):
Created directory '/home/zhangxs/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/zhangxs/.ssh/id_rsa.
Your public key has been saved in /home/zhangxs/.ssh/id_rsa.pub.
The key fingerprint is:
0f:4b:e9:0f:::a5::ea:2e:9b::3a:0e::4d zhangxs@zhangxs
The key's randomart image is:
+--[ RSA ]----+
| . . |
| o o |
| o o |
| + . |
| E S |
| o + = |
| + . o * . |
| o .. .B o |
| .oo+. . |
+-----------------+
默认会在当前用户的home/$用户名 目录下生成一个.ssh文件夹,这个是隐藏文件夹
 cd /home/zhangxs/  切换到文件夹下,输入 [ll -a]
[zhangxs@zhangxs ~]$ ll -a
total 36
drwx------. 22 zhangxs zhangxs 4096 3月  19 14:48 .
drwxr-xr-x.  3 root    root      21 3月  18 17:50 ..
drwx------.  3 zhangxs zhangxs   26 3月  18 23:06 .adobe
-rw-------.  1 zhangxs zhangxs  470 3月  19 14:50 .bash_history
-rw-r--r--.  1 zhangxs zhangxs   18 8月   3 2016 .bash_logout
-rw-r--r--.  1 zhangxs zhangxs  193 8月   3 2016 .bash_profile
-rw-r--r--.  1 zhangxs zhangxs  231 8月   3 2016 .bashrc
drwx------. 17 zhangxs zhangxs 4096 3月  18 20:59 .cache
drwxr-xr-x. 19 zhangxs zhangxs 4096 3月  18 20:08 .config
drwxr-xr-x.  4 root    root      48 3月  19 01:00 datainfo
drwxr-xr-x.  2 zhangxs zhangxs  220 3月  19 14:22 Desktop
drwxr-xr-x.  2 zhangxs zhangxs    6 3月  18 18:00 Documents
drwxr-xr-x.  2 zhangxs zhangxs   51 3月  19 00:00 Downloads
-rw-------.  1 zhangxs zhangxs   16 3月  18 18:00 .esd_auth
-rw-------.  1 zhangxs zhangxs 1554 3月  19 14:12 .ICEauthority
drwxrwxr-x.  3 zhangxs zhangxs   19 3月  18 18:24 .java
drwx------.  3 zhangxs zhangxs   19 3月  18 18:00 .local
drwx------.  3 zhangxs zhangxs   26 3月  18 23:06 .macromedia
drwxr-xr-x.  5 zhangxs zhangxs   54 3月  18 18:04 .mozilla
drwxr-xr-x.  2 zhangxs zhangxs    6 3月  18 18:00 Music
drwxr-xr-x.  4 zhangxs zhangxs   89 3月  18 23:21 Pictures
drwxrw----.  3 zhangxs zhangxs   19 3月  19 01:08 .pki
drwxr-xr-x.  2 zhangxs zhangxs    6 3月  18 18:00 Public
drwxr-xr-x.  3 zhangxs zhangxs   17 3月  18 18:00 .redhat
drwx------.  4 zhangxs zhangxs   48 3月  18 18:26 .speech-dispatcher
drwx------.  2 zhangxs zhangxs   80 3月  19 14:49 .ssh
drwxr-xr-x.  2 zhangxs zhangxs    6 3月  18 18:00 Templates
drwxr-xr-x.  2 zhangxs zhangxs    6 3月  18 18:00 Videos 【cd .ssh】 文件下,有两个文件
-rw-------.  zhangxs zhangxs  3月   : id_rsa
-rw-r--r--. zhangxs zhangxs 3月 : id_rsa.pub

【cp id_rsa.pub authorized_keys】  复制文件

【ssh localhost】 以ssh方式登陆localhost,执行完后会在当前目录下生成两个文件

[zhangxs@zhangxs .ssh]$ ssh localhost
The authenticity of host 'localhost (127.0.0.1)' can't be established.
ECDSA key fingerprint is ::8a::0b:f3:5d:7f:::1b:db::3e:b4:.
Are you sure you want to continue connecting (yes/no)? y
Please type 'yes' or 'no': yes
Warning: Permanently added 'localhost' (ECDSA) to the list of known hosts.
Last login: Sun Mar ::

--------------------------------------------------------------------------------------------

因为是要配置为分布式,所以要root用户到zhangxs用户,

首先要看在在hosts中是否配置好
[zhangxs@zhangxs .ssh]$ more /etc/hosts
127.0.0.1 localhost
192.168.177.120 hadoop-zhangxs.com zhangxs

网卡中是否配置好(如果网卡中没有配置,在ssh zhangxs 时会报错:([root@zhangxs .ssh]# ssh zhangxs
ssh: connect to host zhangxs port 22: Connection timed out)

[root@zhangxs sbin]# ifconfig
enp1s0f0: flags=<UP,BROADCAST,MULTICAST> mtu
inet 192.168.177.120 netmask 255.255.255.0 broadcast 192.168.177.255
ether f8:a9::::7e txqueuelen (Ethernet)
RX packets bytes (0.0 B)
RX errors dropped overruns frame
TX packets bytes (0.0 B)
TX errors dropped overruns carrier collisions
device interrupt
这两个都没问题就可以,切换到root用户    执行【 ssh-keygen -t rsa】
后面步骤都一样拉!!!!!!!!!

centos7 配置ssh 免密码登陆的更多相关文章

  1. 【linux】配置SSH免密码登陆

    1.输入ssh-keygen -t dsa -P '' -f ~/.ssh/id_dsa 其中''里的是登陆的密码,因为要设置免密码,所以''里是什么都没有的,空格也不行 2.输入 cat ~/.ss ...

  2. 密码配置配置SSH免密码登陆

    在本文中,我们主要介绍密码配置的内容,自我感觉有个不错的建议和大家分享下 我的用户名是master 1.安装ssh(若没安装的话) sudo apt-get install ssh 2.配置为可以免密 ...

  3. 阿里云3台机器组成集群配置ssh免密码登陆

    1 查询阿里云局网ip 注意:需要配置同一地区同一可用区的机器 才是一个局网 2 配置好hosts文件 3 hostname确认也是正确的 4 生成公钥私钥 三台机器同样操作 ssh-keygen - ...

  4. linux 配置ssh免密码登陆本机

    1.安装 sudo apt-get install ssh 2.配置无密码登录 ssh-keygen -t rsa 遇到停顿按回车即可 进入/home/zeze/.ssh目录(隐藏目录,在winSCP ...

  5. Linux配置SSH免密码登陆

    配置环境: 两台centos 6.4虚拟机,/etc/hosts配置如下 192.168.63.128 hadoop001 --master192.168.63.131 hadoop002 --sla ...

  6. fedora19配置 SSH 免密码登陆

    a.ssh-keygen -t rsa -P '' -f ~/.ssh/id_rsa b.cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys   ...

  7. 配置ssh免密码登陆

      以root账户为例 准备两台以上的Linux服务器,我这里用的是s204,s205两台机器,多台同样的 先使用ssh登录试一下,如果没有安装则需要先安装一下 ssh s205会提示你输入密码 原理 ...

  8. Centos下 自动化配置SSH免密码登陆

    hosts文件,存储要部署的节点IP地址,其中以#开头表示注释掉 192.168.101.52 192.168.101.53 192.168.101.54 192.168.101.55 192.168 ...

  9. ssh免密码登陆远程服务器

    ssh免密码登陆远程服务器 在使用windows下的cygwin或者在linux下使用Terminal进行远程服务器登陆测试的时候总是会要求输入账号密码,对于此我们可以使用ssh将公钥放在服务器上的方 ...

随机推荐

  1. Python的并发并行[0] -> 基本概念

    基本概念 / Basic Concept  快速跳转 进程 / Process 线程 / Thread 协程 / Coroutine 全局解释器锁 / Global Interpreter Lock ...

  2. 代码编辑器[0] -> Vim/gVim[1] -> Vim 的快捷键操作

    快捷键 / Shortcut Keys 1 基本操作 / Basic Operation Vim的基本操作主要可以参考以下几张图,参考链接, 命令行模式 i             从光标所在字符前插 ...

  3. Controlled Tournament(状态压缩DP)

    Controlled Tournament 题意 n 名选手进行淘汰赛,R[i][j] = 1 表示 i 能胜过 j.要求通过安排淘汰赛使得,m 选手获得最终胜利,问使得比赛数最少的方案数. 分析 设 ...

  4. 树的直径【bzoj3363】 [Usaco2004 Feb]Cow Marathon 奶牛马拉松

    Description 最近美国过度肥胖非常普遍,农夫约翰为了让他的奶牛多做运动,举办了奶牛马拉松.马拉松路线要尽量长,所以,告诉你农场的地图(该地图的描述与上题一致),请帮助约翰寻找两个最远农场间的 ...

  5. luogu P1332 血色先锋队

    题目描述 巫妖王的天灾军团终于卷土重来,血色十字军组织了一支先锋军前往诺森德大陆对抗天灾军团,以及一切沾有亡灵气息的生物.孤立于联盟和部落的血色先锋军很快就遭到了天灾军团的重重包围,现在他们将主力只好 ...

  6. POJ1741 Tree(树的点分治)

    题目给一棵边带权的树,统计路径长度<=k的点对数. 楼教主男人八题之一,分治算法在树上的应用. 一开始看论文看不懂,以为重心和距离那些是一遍预处理得来的..感觉上不敢想每棵子树都求一遍重心和距离 ...

  7. SqlServer发布订阅错误收集

    原文:SqlServer发布订阅错误收集 目录 1. SqlServer发布订阅错误收集 1.1. Message:脚本对于表"dbo.table"失败. 1.1.1. 错误消息 ...

  8. [Bug] 未找到导入的项目“C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\WebApplications\Microsoft.WebApplication.targets”

    This is very easy to do. Open your build definition and go to the "Process" page. Then und ...

  9. 2016summer 训练第二场

    1.http://acm.hdu.edu.cn/showproblem.php?pid=5112 #define _CRT_SECURE_NO_DEPRECATE #include<iostre ...

  10. sql cast函数

    一.语法: CAST (expression AS data_type) 参数说明: expression:任何有效的SQLServer表达式. AS:用于分隔两个参数,在AS之前的是要处理的数据,在 ...