zoukankan      html  css  js  c++  java
  • linux 下的ssh免密登陆设置

    一,原理

    说明:

    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 命令

    eg:

    [eddy@eddy01 .ssh]$ ssh-keygen                                                     
    Generating public/private rsa key pair.
    Enter file in which to save the key (/home/eddy/.ssh/id_rsa): 
    Enter passphrase (empty for no passphrase):           //直接回车
    Enter same passphrase again:               //直接回车
    Your identification has been saved in /home/eddy/.ssh/id_rsa.
    Your public key has been saved in /home/eddy/.ssh/id_rsa.pub.
    The key fingerprint is:
    58:e5:f9:58:27:b5:4e:dc:32:ce:6c:eb:56:ac:89:9b eddy@eddy01
    The key's randomart image is:
    +--[ RSA 2048]----+
    |          .   .  |
    |         o . o o |
    |        . o o B .|
    |       o   + O o |
    |      . S . . *. |
    |             . .o|
    |             ..+ |
    |            .o+  |
    |            Eo.  |
    +-----------------+
    [eddy@eddy01 .ssh]$ ssh-copy-id eddy02                                             
    eddy@eddy02's password: 
    Now try logging into the machine, with "ssh 'eddy02'", and check in:
    
      .ssh/authorized_keys
    
    to make sure we haven't added extra keys that you weren't expecting.
    
    [eddy@eddy01 .ssh]$ ssh eddy02
    Last login: Tue Mar  7 12:25:23 2017 from 192.168.145.1
    [eddy@eddy02 ~]$ 
  • 相关阅读:
    (转) Android的Window类
    android 打开文件
    Android线程优先级
    Hierarchy viewer problems
    android:windowSoftInputMode
    (转) Android 安全机制
    Mobl试用之helloword
    写给自己对软件测试经历的总结
    Mobl试用二
    黑马程序员面向对象基础:属性和方法
  • 原文地址:https://www.cnblogs.com/Eddyer/p/6514164.html
Copyright © 2011-2022 走看看