zoukankan      html  css  js  c++  java
  • SSH免密登录配置

    SSH免密登录配置

    本地生成密钥文件:

    $ ssh-keygen

    输出:

    Generating public/private rsa key pair.

    Enter file in which to save the key (/root/.ssh/id_rsa): 直接enter

    Enter passphrase (empty for no passphrase): 继续直接按enter

    Enter same passphrase again: 继续直接按enter

    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:

    10:98:86:e7:78:c8:24:87:dc:3a:8a:30:ca:08:4e:8c root@min1

    The key's randomart image is:

    +--[ RSA 2048]----+

    |.... o.          |

    |o.+.=  .         |

    |o=.*  .          |

    |E=+ o  .         |

    |@...    S        |

    |=o               |

    |                 |

    |                 |

    |                 |

    +-----------------+

    出现上面情况表示key生成成功,放在了root/.ssh/id_rsa文件中,无密码。

    将key文件拷贝到目标机

    $ ssh-copy-id 192.168.71.10

    输出:

    The authenticity of host '192.168.71.10 (192.168.71.10)' can't be established.

    RSA key fingerprint is fa:a9:1b:a8:d3:f8:4b:39:23:c6:4b:e6:21:c1:df:99.

    Are you sure you want to continue connecting (yes/no)? yes

    Warning: Permanently added '192.168.71.10' (RSA) to the list of known hosts.

    root@192.168.71.10's password: 输入目标机192.168.71.10密码

    Now try logging into the machine, with "ssh '192.168.71.10'", and check in:

      .ssh/authorized_keys

    to make sure we haven't added extra keys that you weren't expecting.

    至此表示拷贝成功了,输出说可以尝试登陆了。

    登陆测试

    [root@min1 ~]$ ssh 192.168.71.10

    Last login: Wed Nov 22 00:58:34 2017 from 192.168.71.1

    [root@min2 ~]$ ^C

    这样就可以远程运行脚本及操作各种指令了。

  • 相关阅读:
    【大数据面试之对线面试官】MapReduce/HDFS/YARN面试题70连击
    2021年最新版大数据面试题全面总结-持续更新
    Hbase性能优化百科全书
    【大数据面试题】Flink第一弹60连发
    DockerFile
    Docker容器数据卷
    Docker入门
    八、Sentinel服务保护框架
    七、Gateway高可用集群与动态网关
    五、Nacos集群部署实现原理
  • 原文地址:https://www.cnblogs.com/UFO-blogs/p/8992128.html
Copyright © 2011-2022 走看看