zoukankan      html  css  js  c++  java
  • 免认证的ssh登录设置

    Client Host: abc@192.168.1.100
    Server Host: abc@192.168.1.101

    1. 在client host 端生成一个rsa密钥

    代码:
    $ ssh-keygen -t rsa
    Generating public/private rsa key pair.
    Enter file in which to save the key (/home/abc/.ssh/id_rsa):   ------> 回车默认
    Enter passphrase (empty for no passphrase):   ------> 回车默认
    Enter same passphrase again:   ------> 回车默认
    Your identification has been saved in /home/abc/.ssh/id_rsa.
    Your public key has been saved in /home/abc/.ssh/id_rsa.pub.
    The key fingerprint is:
    71:89:9e:56:de:23:83:6a:9e:b8:96:15:f3:57:cb:b4 abc@i965
    The key's randomart image is:
    +--[ RSA 2048]----+
    |                 |
    |         . .     |
    |        o +      |
    |      o. B .o    |
    |       +S ++oo   |
    |      .o. .oE.   |
    |     oo  .       |
    |    o+ .         |
    |   .o.o          |
    +-----------------+

    注意:如果原来已经生成过,则可以直接使用,不需要再生成一次;而且也不推荐,否则以前设置的免认证host可能就得重新设置了.

    2. 将生成的id_rsa.pub通过scp上传到Server Host端:

    代码:
    ~$ scp .ssh/id_rsa.pub abc@192.168.1.101:/home/abc

    a) 如果Server Host端不存在 /home/abc/.ssh/authorized_keys文件,则直接将上传的文件重命名即可:

    代码:
    ~$ mv id_rsa.pub .ssh/authorized_keys

    b) 如果Server Host端已经存在 /home/abc/.ssh/authorized_keys文件,将上传文件的内容附加上即可:

    代码:
    ~$ cat id_rsa.pub >> .ssh/authorized_keys

    3. 退出Server Host,然后再在Client Host上ssh登录,就不在需要密码认证了。

  • 相关阅读:
    ubuntu: no module named _sqlite
    mysql慢查询分析工具 pt-query-digest
    vue中的时间修饰符stop,self
    面试题 —— Ajax的基本原理总结
    es6笔记 day6-Symbol & generator
    类(class)和继承
    es6笔记 day4---模块化
    es6笔记 day3---Promise
    es6笔记 day3---对象简介语法以及对象新增
    es6笔记 day3---数组新增东西
  • 原文地址:https://www.cnblogs.com/wzc0066/p/2950283.html
Copyright © 2011-2022 走看看