• linux系统 ssh免密码登录服务器主机


    以centos7系统为例,两台服务器之间(多台配置一样)进行服务器免密码登录配置:

    test1主机免密码登录reserve5主机配置如下:

    1. 制作密钥文件:

    [root@test1 ~]# cd .ssh/
    [root@test1 .ssh]# ls
    authorized_keys known_hosts
    [root@test1 .ssh]# 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:
    SHA256:FaJD4yiMN4S1KxcVjEe+AGgnezpyTYpgEfmdawWHFUg root@test1
    The key's randomart image is:
    +---[RSA 2048]----+
    |o+=+=E*oo . |
    |oX.=oB + . . |
    |o #.+ B . |
    |.+ O.+ o . |
    |+.=+. o S |
    |o=o .o |
    |... . |
    | |
    | |
    +----[SHA256]-----+

    2.把制作好的密钥文件拷贝到需要免密登录的服务器主机:
    [root@test1 .ssh]# ssh-copy-id root@主机ip地址
    /usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
    /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@主机ip地址's password:

    Number of key(s) added: 1

    Now try logging into the machine, with: "ssh 'root@reserve5主机ip地址'"
    and check to make sure that only the key(s) you wanted were added.

    3.验证是否可以免密码登录reserve5服务器主机

    [root@test1 ~]# ssh 主机ip地址
    Last failed login: Thu Mar 11 09:08:34 CST 2021 from xx.xxx.xx.xxx on ssh:notty
    There were 31 failed login attempts since the last successful login.
    Last login: Thu Mar 11 08:52:36 2021 from test主机IP地址
    Welcome to JDCLOUD Elastic Compute Service
    [root@reserve5 ~]# ifconfig
    。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。

    上述可知:免密码登录成功!

  • 相关阅读:
    最常见VC++编译错误信息集合
    网站运营最全总结
    KdPrint/DbgPrint and UNICODE_STRING/ANSI_STRING
    poj 2155 matrix
    【hdu2955】 Robberies 01背包
    【hdu4570】Multi-bit Trie 区间DP
    2014 SCAU_ACM 暑期集训
    qpython 读入数据问题: EOF error with input / raw_input
    【转】Python version 2.7 required, which was not found in the registry
    华农正方系统 登录地址
  • 原文地址:https://www.cnblogs.com/renyongbin/p/14515779.html
Copyright © 2020-2023  润新知