• SSH安全协议


    SSHD服务

    介绍:SSH 协议:安全外壳协议。为 Secure Shell 的缩写。SSH 为建立在应用层和传输层基础上的安全协议。

    默认端口22

    作用

    sshd服务使用SSH协议可以用来进行远程控制, 或在计算机之间传送文件 

    相比较之前用telnet方式来传输文件要安全很多,因为telnet使用明文传输,是加密传输。

    第一步、安装

    系统默认安装并且开机自启

    [root@localhost songqi]# yum install openssh openssh-clients openssh-server openssh-askpass

    SSH 配置文件

    SH 常用配置文件有两个/etc/ssh/ssh_config 和/etc/sshd_config。

    ssh_config 为客户端配置文件

    sshd_config 为服务器端配置文件

    从节点:接收秘钥的主机

    [root@ken-node2 ~]# ls .ssh/
    authorized_keys

    authorized_keys文件内容和主节点的 id_rsa.pub文件内容一致,即保存了公钥信息。

    使用ssh免密登陆远程主机

     第一步、生成秘钥

    [root@localhost /]# ssh-keygen
    Generating public/private rsa key pair.
    Enter file in which to save the key (/root/.ssh/id_rsa):
    /root/.ssh/id_rsa already exists.
    Overwrite (y/n)? y
    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:
    05:01:72:e7:b7:74:aa:62:ab:b1:6f:f6:dc:8a:1f:cb root@localhost.localdomain
    The key's randomart image is:
    +--[ RSA 2048]----+
    | . o.+. |
    | o o . |
    | . + . |
    | + + |
    | S o |
    | . |
    | . o o |
    | +o* + |
    | o=+oE.. |
    +-----------------+

    第二步、发送秘钥给目标主机

    [root@localhost /]# ssh-copy-id 192.168.7.2

    第一次需要密码(客户端密码)

    第三步、测试

    可以免密登陆目标主机或使用scp命令

  • 相关阅读:
    setTimeOut与循环闭包问题
    ES6----class用法
    JS------对象的继承方式
    JavaScript对象 -构建
    nodejs异步---Async
    mongdb位置索引
    mongodb 索引3
    mongod 索引2
    mongodb 索引1
    3 C++数据类型
  • 原文地址:https://www.cnblogs.com/tomsongqi/p/11122476.html
Copyright © 2020-2023  润新知