Linux/Unix双机建立信任教程
Linux/Unix双机建立信任教程
一 需要建立信任关系的2台主机都执行生成密钥
输入ssh-keygen -t rsa之后全部默认回车,这样就会在/root/.ssh下生成密钥文件
[root@platform_iks .ssh]# 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:
63:9f:6e:8b:98:49:e3:a2:bc:49:8a:a1:d5:1b:03:3a root@platform_iks.internal.lietou.com
The key's randomart image is:
+--[ RSA 2048]----+
| |
| |
| |
| |
| . S |
| . o . o . |
|E o + o o |
|oB ..* = o. |
|+ =o..= ..o. |
+-----------------+
二 查看~/.ssh生成密钥的文件
[root@platform_iks .ssh]# ll
总用量 12
-rw-------. 1 root root 1675 9月 14 10:46 id_rsa
-rw-r--r--. 1 root root 419 9月 14 10:46 id_rsa.pub
-rw-r--r--. 1 root root 2360 9月 10 15:53 known_hosts
三 建立信任关系
1 A对B建立信任关系
[root@platform_iks .ssh]# scp -r id_rsa.pub 10.10.10.17:/root/.ssh/authorized_keys
root@10.10.10.17's password:
id_rsa.pub 100% 419 0.4KB/s 00:00
[root@platform_iks .ssh]#
即:把A的公钥(id_rsa.pub)拷贝到B,并修改id_rsa.pub 为 authorized_keys
此时需要输入密码(之前未建立信任关系),建立了客户端到服务端的信任关系后,客户端就可以不用再输入密码,就可以从服务端拷贝数据
四 在B机器上执行同样的操作
[root@localhost .ssh]# ssh-keygen --help
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): ^C
[root@localhost .ssh]# 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:
b3:b4:62:1b:5a:fb:8c:70:50:6c:22:aa:11:2e:01:23 root@localhost.localdomain
The key's randomart image is:
+--[ RSA 2048]----+
|E |
|o. . |
|o . . + |
|.+ . + |
|+. . S |
|o. . . + |
|. . * o |
| * B |
| . +.o |
+-----------------+
[root@localhost .ssh]# ll
总用量 16
-rw-r--r--. 1 root root 419 9月 14 10:52 authorized_keys
-rw-------. 1 root root 1671 9月 14 10:54 id_rsa
-rw-r--r--. 1 root root 408 9月 14 10:54 id_rsa.pub
-rw-r--r--. 1 root root 2357 9月 12 14:35 known_hosts
[root@localhost .ssh]# scp -r id_rsa.pub 10.10.10.20:/root/.ssh/authorized_keys
root@10.10.10.20's password:
id_rsa.pub
四 测试
[root@localhost ~]# scp -r a 10.10.10.20:/root/
a 100% 0 0.0KB/s 00:00
[root@localhost ~]# ls
双机之间拷贝文件,不再需要输入密码了
双机信任关系已经建立!
Linux/Unix双机建立信任教程的更多相关文章
- Linux 配置双机SSH信任
一.实现原理 使用一种被称为"公私钥"认证的方式来进行ssh登录."公私钥"认证方式简单的解释是: 首先在客户端上创建一对公私钥(公钥文件:~/.ssh/id_ ...
- Linux/Unix 新手和专家教程
你正在找一些高质量的Linux 和 UNIX 的教程吗?如果是,这篇文章会告诉你到哪去找到这些教程.这里我们将给出超过30个相当的不错的 Linux 和 UNIX 在线的教程. 需要大家注意的是,他们 ...
- 两条命令在Linux主机之间建立信任关系
ssh-keygen -t rsa -P "" -f ~/.ssh/id_rsa //生成当前用户密钥 ssh-copy-id -i /root/.ssh/id_rsa.pub r ...
- Linux SSH , SCP 建立信任关系(免密传输)
最近有个需求,Jenkins需要将war传输到各个项目节点中,所以需要远程执行各个节点的shell脚本.但是中间有个输入密码的过程,在自动化部署中是行不通的,故需要增加免密登录.具体如下: 如果想在 ...
- linux如何配置双机SSH信任然后双向免密码登陆
linux如何配置双机SSH信任然后双向免密码登陆 www.111cn.net 更新:2015-01-14 编辑:edit02_lz 来源:转载 有时为了方便管理多台Linux主机,想实现双机之间信任 ...
- Linux/Unix
Linux/Unix 新手和专家教程 你正在找一些高质量的Linux 和 UNIX 的教程吗?如果是,这篇文章会告诉你到哪去找到这些教程.这里我们将给出超过30个相当的不错的 Linux 和 UNIX ...
- 两台linux之间建立信任关系,实现免密码ssh远程登录或scp数据上传
两台linux之间建立信任关系,实现免密码远程登录或数据上传 1.执行ssh-keygen命令,生成建立安全信任关系的证书: linux1上:执行命令 ssh-keygen -t rsa 在程序提 ...
- linux机器间建立信任关系
linux机器间建立信任关系 如何建立信任关系 在shell脚本中,需要使用scp命令将本地的文件复制到另一台机器中备份.但通常执行scp命令后都需要输入用户密码,这样在定时自动执行shell脚本中就 ...
- linux建立信任关系
(1).切换到需要建立信任关系的用户(2).执行命令:ssh-keygen -d,然后一直回车.该命令会在用户home目录下生成一个隐藏的.ssh目录.目录里面有两个文件:id_dsa.id_dsa ...
随机推荐
- 图论--最近公共祖先问题(LCA)模板
最近公共祖先问题(LCA)是求一颗树上的某两点距离他们最近的公共祖先节点,由于树的特性,树上两点之间路径是唯一的,所以对于很多处理关于树的路径问题的时候为了得知树两点的间的路径,LCA是几乎最有效的解 ...
- 【mysql】一维数据TopN的趋势图
创建数据表语句 数据表数据 对上述数据进行TopN排名 select severity,sum(count) as sum from widgt_23 where insertTstamp>=' ...
- LVS+Keepalived负载均衡配置
简介 lvs一般是和keepalived一起组合使用的,虽然也可以单独使用lvs,但配置比较繁琐,且可用性也没有前者高. lvs和keepalived组合使用后,配置lvs的VIP和负载均衡就都在ke ...
- 关于windows字体的一些笔记
windows如何管理字体 windows的字体管理在注册表的windows/font这部分(具体路径忘记了),这里会记录字体的名称和名称,如果有具体指出路径,windows启动的时候会从这个路径去加 ...
- shell 脚本定时创建月份表
#!/bin/shuser='root'pass='root'name='vfc_sport' # 数据表名定义timestamp=`date -d "next month" +% ...
- Eclipse编辑XML文件的代码提示
1.Eclipse无法解析的情形 Eclipse中编辑XML文件时,能够代码自动提示,是因为在XML头部引入了DTD文件(文档类型定义),Eclipse就是通过解析这个DTD文件,来达到代码提示的功能 ...
- loadView、viewDidLoad、initWithCoder、initWithNibName、awakeFromNib的用法
转载,原地址为:http://jianyu996.blog.163.com/blog/static/11211455520131226840879/ 请尊重原创: 1,无论XIB还是代码创建都会调用l ...
- [Tex学习笔记]写文章需要规范、需要引用到位. [LaTeX代码]
\documentclass{ctexart} \usepackage{CJK,amsmath,amssymb,amsthm} \begin{document} 写文章需要规范.需要引用到位. 方程: ...
- 新的android studio创建的fragment工程跟老师讲的结构有区别
工程自动创建了fragment类,并且activity_main中的标签是fragmnet,这就不需要在MainAcitivity中手动创建fragment了. 但是这样的程序运行之后会出现两个fra ...
- WPF绑定数据源
using System;using System.Collections.Generic;using System.Collections.ObjectModel;using System.Comp ...