配置ssh免密码登录

登录后我们就开始搭建我们的hadoop伪分布式系统

修改主机名与IP地址的对应关系
[root@VM_11_203_centos ~]# hostname
查看主机名
[root@VM_11_203_centos ~]# vim /etc/hosts
修改文件为一下内容

然后输入reboot重启机器
配置ssh免密码登录

[root@VM_11_203_centos ~]# ssh 211.159.153.214
The authenticity of host '211.159.153.214 (211.159.153.214)' can't be established.
ECDSA key fingerprint is 22:49:b2:5c:7c:8f:73:56:89:29:8a:bd:56:49:74:66.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '211.159.153.214' (ECDSA) to the list of known hosts.
root@211.159.153.214's password:

这里我们要输入密码特别的不方便,所以要取消。

输入ssh-keygen -t rsa然后四个回车

[root@VM_11_203_centos ~]# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
e4:7d:24:39:20:e1:27:07:3b:4c:8d:b0:3d:f6:4f:13 root@VM_11_203_centos
The key's randomart image is:
+--[ RSA 2048]----+
|    ..=+.        |
|     *.+.. .     |
|    . X + E .    |
|     . X . =     |
|        S + .    |
|         o o     |
|          .      |
|                 |
|                 |
+-----------------+

然后复制密钥到本机

[root@VM_11_203_centos ~]# ssh-copy-id 211.159.153.214
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@211.159.153.214's password:
[root@VM_11_203_centos ~]# ssh 211.159.153.214
Last login: Thu Mar 16 17:26:00 2017 from 218.21.34.74
  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值