A服务器上操作
ssh-keygen -t rsa/dsa 后面所带参数rsa/dsa为加密方式,默认为dsa
[root@localhost ~]# ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Created directory '/root/.ssh'.
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:
dc:15:f9:6d:f3:d5:a7:3f:64:9d:dd:7e:f4:38:52:e3 root@localhost.localdomain
The key's randomart image is:
+--[ RSA 2048]----+
| .. |
| .. |
| .. ..|
| . . . ..*|
| S . oX|
| ++*|
| oo*.|
| . E.=|
| . .o|
+-----------------+ [root@localhost .ssh]# ll
total 8
-rw-------. 1 root root 1766 Aug 28 04:37 id_rsa
-rw-r--r--. 1 root root 408 Aug 28 04:37 id_rsa.pub
B服务器上操作 将id_rsa.pub复制到B 目录位置在 /root/.ssh中,如果B中没有这个.ssh目录,需要创建,并且保证权限不能大于711
在/root/.ssh中创建文件 authorized_keys, 执行命令cat /root/.ssh/id_rsa.pub > authorized_keys 然后在A上执行 ssh B服务器地址 或者 ssh -i ./id_rsa root@B服务器地址 即可使用密钥登陆B

SSH通过密钥登陆的更多相关文章

  1. 配置SSH无密钥登陆(三)

    配置SSH无密钥登陆 (1).关闭防火墙 对每个虚拟机进行如下操作:   su    chkconfig  iptables  off 执行之后重启虚拟机:reboot (2).关闭之后,在maste ...

  2. ssh免密钥登陆的两种方式

    ssh 免密钥登陆的两种方式第一种:直接使用命令复制过去ssh-copy-id root@192.168.3.113批量复制for i in {113..140}; do ssh-copy-id ro ...

  3. Linux SSH 使用密钥登陆

    Linux SSH 使用密钥登陆 通常我们登录 Linux 服务器,我们需要使用密码进行登录,但是密码存在被暴力破解的可能. 可以将默认服务端口 22 改成其他不常用的端口. 可以设置非常复杂的密码. ...

  4. Linux 配置SSH 无密钥登陆

    根据SSH 协议,每次登陆必须输入密码,比较麻烦,SSH还提供了公钥登陆,可以省去输入密码的步骤. 公钥登陆:用户将自己的公钥存储在远程主机上,登陆的时候,远程主机会向用户发送一串随机字符串,用户用自 ...

  5. Linux中ssh介绍与ssh+key密钥登陆部署

    环境内核信息: [root@zabbix- ~]# uname -a Linux zabbix- -.el6.x86_64 # SMP Tue Mar :: UTC x86_64 x86_64 x86 ...

  6. SSH免密钥登陆

    local ipaddress:10.47.39.7:remote ipaddress:10.47.39.8 1.生成公钥和私钥 [root@local ~]# ssh-keygen -t rsa  ...

  7. ssh的配置,ssh打开密钥登陆,关闭密码登陆。

    刚装玩fedora,那么我们就以fedora为例来说一下怎么配置: 1.先确认是否已安装ssh服务: [root@localhost ~]# rpm -qa | grep openssh-server ...

  8. centos7.5下生成公钥,实现ssh免密钥登陆

    配置SSH无密码登录需要4步准备工作生成公钥和私钥导入公钥到认证文件,更改权限测试1. 准备工作确认本机sshd的配置文件(需要root权限) # vi /etc/ssh/sshd_config 1找 ...

  9. ssh无密钥登陆的简单配置

    主要目的是把本地的公钥放到远端被登陆的host上. 本地操作: # ssh-keygen # ssh-copy-id user@host 远端sshd_config配置: RSAAuthenticat ...

随机推荐

  1. AlphaGo的前世今生(三)AlphaGo Zero: AI Revolution and Beyond

    这是本专题的第三节,在这一节我们将以David Silver等人的Natrue论文Mastering the game of Go without human knowledge为基础讲讲AlphaG ...

  2. letecode242有效字母的异位词

    bool isAnagram(char* s, char* t) { ] = {}; ] = {}; int lenS = strlen(s); int lenT = strlen(t); ;i< ...

  3. ActiveMQ安装使用与spring整合配置教程

    https://blog.csdn.net/qq_22075041/article/details/77602996

  4. windows yii2 配置redis

    1 安装redis https://blog.csdn.net/gaotanpan3666/article/details/83047081 安装redis 2  yii安装redis扩展 compo ...

  5. List和符号分隔的字符串互相转换

    一.将逗号分隔的字符串转换成List: 1. 使用JDK的Arrays类: import java.util.Arrays; import java.util.List; public class T ...

  6. Mybatis常用代码

    以下使用的数据库是Mysql. Mybatis动态Sql: Mapper.xml如下: <select id="selectOrderList" resultMap=&quo ...

  7. layui数据表格监听按钮问题

    layui官网文档源码 原始容器 <table id="demo" lay-filter="test"></table> 工具栏模板: ...

  8. vue-computed计算属性用法

    siytem函数可以当做变量在html中展现,列:{{siytem}}  v-for(item in siytem)遍历也可以. 这个函数是从获取到的数据中,得到值后再次提取里面的数据,通过下标 me ...

  9. Codeforces Round #553 (Div. 2) C题

    题目网址:http://codeforces.com/contest/1151/problem/C 题目大意:给定奇数集和偶数集,现构造一个数组,先取奇数集中一个元素1,再取偶数集二个元素2,4,再取 ...

  10. Ruby http/net 中连接超时问题

    下面在调用币安的接口时,经常会卡住,设置连接超时也不会抛出异常,代码如下(默认连接超时为nil, 参考:https://github.com/ruby/ruby/pull/269): require ...