zoukankan      html  css  js  c++  java
  • 3步实现ssh面密码登录

    1、上次本机的公钥和私钥

    [root@vicweb ~]#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:
    24:ef:78:23:bf:51:2f:40:8b:b8:c8:f6:87:34:69:a4 root@vicweb.localdomain
    The key's randomart image is:
    +--[ RSA 2048]----+
    |                 |
    |                 |
    |      . o        |
    |    .. * .       |
    |   o... S .      |
    | .E.=. o o .     |
    |  +o.oo = . .    |
    | . .. .+ o .     |
    |    ..  o.       |
    +-----------------+

    2、查看生产的文件(非必要操作,只是确认一下)

    3、把公钥传输到指定机器,需要免密码ssh登录的机器,使用ssh-copy-id命令

    [root@vicweb ~]#ssh-copy-id -i ~/.ssh/id_rsa.pub root@10.10.90.102
    The authenticity of host '10.10.90.102 (10.10.90.102)' can't be established.
    RSA key fingerprint is 05:90:7f:36:f2:c4:55:15:16:2d:27:54:30:67:c7:74.
    Are you sure you want to continue connecting (yes/no)? yes
    Warning: Permanently added '10.10.90.102' (RSA) to the list of known hosts.
    root@10.10.90.102's password: 
    Now try logging into the machine, with "ssh 'root@10.10.90.102'", and check in:
    
      .ssh/authorized_keys
    
    to make sure we haven't added extra keys that you weren't expecting.

    check in到了对方的 authorized_keys文件,对方机器默认是没有这个文件的,会自动生产一个这个文件,并把自己的公钥写到这个文件

    4、测试登录即可

    [root@vicweb ~/.ssh]#ssh root@10.10.90.102
    Last login: Thu Nov  9 09:24:35 2017 from 10.10.90.1

    已实现自动登录,不需要在输入对方root的密码。

  • 相关阅读:
    FiddlerCoreAPI 使用简介
    fiddler script建议教程
    PDF文本内容批量提取到Excel
    pymc_实现贝叶斯统计模型和马尔科夫链蒙塔卡洛
    贝叶斯
    Logistic Ordinal Regression
    逻辑回归原理_挑战者飞船事故和乳腺癌案例_Python和R_信用评分卡(AAA推荐)
    逻辑回归实战--美国挑战者号飞船事故_同盾分数与多头借贷Python建模
    python操作mysql数据库
    多元回归比一元回归优越性
  • 原文地址:https://www.cnblogs.com/netsa/p/7807890.html
Copyright © 2011-2022 走看看