zoukankan      html  css  js  c++  java
  • Linux服务器之间免密登录设置

    说明:

    A为linux服务器a

    B为linux服务器b

    每台linux都有ssh的服务端和客户端,linux下的ssh命令就是一个客户端

    我们常用ssh协议来进行登陆或者是文件的拷贝,都需要密码

    A要免密登陆B:

    1,需要在a中执行ssh-keygen生成自己的公钥和私钥,生成的文件在.ssh文件中。

    2,需要吧a中的公钥copy到b中的中,b进行授权(把公钥中的信息拷贝到“authorized_keys”文件中)  这里只需要一个命令ssh-copy-id 命令

    实际设置:

    [root@mobancentos70 .ssh]# ssh-keygen   
    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:
    b2:21:f8:98:32:a3:e0:de:2e:a8:24:49:91:10:80:2b root@mobancentos70
    The key's randomart image is:
    +--[ RSA 2048]----+
    |*.               |
    |o .              |
    | +               |
    |E ..             |
    |... . o S        |
    |.. + . +         |
    |O.o . .          |
    |B=.              |
    |=ooo             |
    +-----------------+
    [root@mobancentos70 .ssh]# ssh-copy-id 172.20.13.230
    /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@172.20.13.230's password: 
    
    Number of key(s) added: 1
    
    Now try logging into the machine, with:   "ssh '172.20.13.230'"
    and check to make sure that only the key(s) you wanted were added.
    
    [root@mobancentos70 .ssh]# ssh 172.20.13.230
    Last login: Sat Mar 17 15:33:32 2018 from 10.6.196.196
  • 相关阅读:
    一步步学习MDL[3]
    一步步学习MDL[0]
    .net下ckeditor+ckfinder+SyntaxHighlighter三集成demo
    页面跳转如何进入一个嵌套在Iframe中的页面中
    解决iframe,div在移动设备上实现局部刷新的方法
    SQL三种东西永远不要放到数据库里
    悟透JavaScript
    Js 常用日期汇总
    js_兼容IE和FF
    SQL中字符串类型转换为时间类型
  • 原文地址:https://www.cnblogs.com/owenma/p/8590450.html
Copyright © 2011-2022 走看看