centos7 配置ssh 免密码登陆
我只有一台机器,是因为要配置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 免密码登陆的更多相关文章
- 【linux】配置SSH免密码登陆
1.输入ssh-keygen -t dsa -P '' -f ~/.ssh/id_dsa 其中''里的是登陆的密码,因为要设置免密码,所以''里是什么都没有的,空格也不行 2.输入 cat ~/.ss ...
- 密码配置配置SSH免密码登陆
在本文中,我们主要介绍密码配置的内容,自我感觉有个不错的建议和大家分享下 我的用户名是master 1.安装ssh(若没安装的话) sudo apt-get install ssh 2.配置为可以免密 ...
- 阿里云3台机器组成集群配置ssh免密码登陆
1 查询阿里云局网ip 注意:需要配置同一地区同一可用区的机器 才是一个局网 2 配置好hosts文件 3 hostname确认也是正确的 4 生成公钥私钥 三台机器同样操作 ssh-keygen - ...
- linux 配置ssh免密码登陆本机
1.安装 sudo apt-get install ssh 2.配置无密码登录 ssh-keygen -t rsa 遇到停顿按回车即可 进入/home/zeze/.ssh目录(隐藏目录,在winSCP ...
- Linux配置SSH免密码登陆
配置环境: 两台centos 6.4虚拟机,/etc/hosts配置如下 192.168.63.128 hadoop001 --master192.168.63.131 hadoop002 --sla ...
- fedora19配置 SSH 免密码登陆
a.ssh-keygen -t rsa -P '' -f ~/.ssh/id_rsa b.cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys ...
- 配置ssh免密码登陆
以root账户为例 准备两台以上的Linux服务器,我这里用的是s204,s205两台机器,多台同样的 先使用ssh登录试一下,如果没有安装则需要先安装一下 ssh s205会提示你输入密码 原理 ...
- Centos下 自动化配置SSH免密码登陆
hosts文件,存储要部署的节点IP地址,其中以#开头表示注释掉 192.168.101.52 192.168.101.53 192.168.101.54 192.168.101.55 192.168 ...
- ssh免密码登陆远程服务器
ssh免密码登陆远程服务器 在使用windows下的cygwin或者在linux下使用Terminal进行远程服务器登陆测试的时候总是会要求输入账号密码,对于此我们可以使用ssh将公钥放在服务器上的方 ...
随机推荐
- StringBuffer 清空
几种方法: 方法1: 1 2 3 4 StringBuffer my_StringBuffer = new StringBuffer(); my_StringBuffer.append('hellow ...
- HTML表格基础详解
在现在 div 大行其道的时代,table 这个标签似乎很少被人提及,到处都是 div+css 布局的书以及博客文章,但其实 table 以及连带的其他表格标签依然在网页中占很重要的地位,特别是后台展 ...
- [BZOJ 1509] 逃学的小孩
Link: BZOJ 1509 传送门 Solution: 一开始受样例影响又犯了想当然的毛病……图中的C点不一定在直径上! 3次$dfs$求出树的直径及直径的两个端点$rt1,rt2$到每个点的距离 ...
- 【bzoj1598】【 [Usaco2008 Mar]牛跑步】启发式搜索思路+spfa
(上不了p站我要死了,侵权度娘背锅) 最近复习搜索,先从启发式搜索来吧. 感觉启发式搜索这玩意挺玄学的,先从其思想入手,做一道经典的K短路. Description BESSIE准备用从牛棚跑到池塘的 ...
- 十. 图形界面(GUI)设计4.面板
面板有两种,一种是普通面板(JPanel),另一种是滚动面板(JScrollPane). JPanel 面板是一种通用容器,JPanel的作用是实现界面的层次结构,在它上面放入一些组件,也可以在上面绘 ...
- sqlite db-journal文件产生原因及说明
今天在Android中将sqlite的数据库文件生成在SD卡上的过程中,发现生成的.db文件的旁边 生成了一个大小为0的与数据库文件同名的.db-journal文件,不明白此文件的用途,于是 goog ...
- CSS浮动设置与清除
float:设置浮动 浮动会使元素脱离普通文档流,使元素向左或向右移动,其周围的元素也会重新排布,在布局中非常有用. html: <p>以下是图片的浮动设置:</p> < ...
- iOS用户响应者链的那些事儿
这篇文章想跟大家分享的主旨是iOS捕获用户事件的各种情况,以及内部封装的一些特殊事件. 我们先从UIButton谈起,UIButton大家使用的太多了,他特殊的地方就在于其内置的普通Default/高 ...
- The beta-reports-active Entitlement
Q: How do I resolve the "beta-reports-active" code signing error? A: There are a number o ...
- What is Mocking?
Mocking is primarily used in unit testing. An object under test may have dependencies on other (comp ...