zoukankan      html  css  js  c++  java
  • ssh服务设置

    建议配置前关闭selinux,setenforce=0

    一、ssh开启root远程登录


    PermitRootLogin yes         #默认开启,允许root认证登录
    

    二、ssh登录速度优化


    StrictHostKeyChecking no #默认开启,关闭后,对于未连接过的主机,不用输入yes进行确认
    GSSAPIAuthentication no #默认开启,登陆的时候客户端需要对服务器端的IP地址进行反解析,如果服务器的IP地址没有配置PTR记录,那么就容易在这里卡住了
    UseDNS no #默认开启,建议内网默认关闭
    

    三、ssh远程主机执行命令


    sshpass -p "$password" ssh -p $port -o StrictHostKeyChecking=no -o ConnectTimeout=$timeout $username@$host "command"
    ###sshpass命令
    

    四、登录方式配置


    秘钥认证登录
    RSAAuthentication yes       #第1代ssh通讯协议的密钥验证选项,未配置的情况下默认为开启,可通过设置no关闭秘钥登录
    PubkeyAuthentication yes    #第2代ssh通讯协议的密钥验证选项,未配置的情况下默认为开启,可通过设置no关闭秘钥登录
    #在同时支持ssh1和ssh2的系统中,可通过protocol设置ssh的版本
    密码认证登录
    PasswordAuthentication yes  #默认开启,允许密码认证登录
    

    五、配置密码登录


    1. 生成秘钥对
    ssh-keygen
    2. 发送公钥到目标主机
    ssh-copy-id user@hostname
    
    有趣的事,有趣的人,有趣的灵魂!
  • 相关阅读:
    shell进行mysql统计
    java I/O总结
    Hbase源码分析:Hbase UI中Requests Per Second的具体含义
    ASP.NET Session State Overview
    What is an ISAPI Extension?
    innerxml and outerxml
    postman
    FileZilla文件下载的目录
    how to use webpart container in kentico
    Consider using EXISTS instead of IN
  • 原文地址:https://www.cnblogs.com/alusss/p/12720600.html
Copyright © 2011-2022 走看看