zoukankan      html  css  js  c++  java
  • linux 禁用密码登陆 启用ssh key登陆 配置

    1.在服务器上执行

    #ssh-keygen -t rsa -C 793413226@qq.com

    输入文件名(如xxxx)和私钥密码,并二次确认

    会生成2个文件:xxxx,xxxx.pub

    将公钥写入/root/.ssh/authorized_keys文件,将私钥xxxx下载到本地留作登陆使用

    #cat xxxx.pub >> /root/.ssh/authorized_keys

    修改配置 其实centos7.4及之后的版本只要关闭密码登录就好了,因为秘钥文件登录是默认打开的

    #vim /etc/ssh/sshd_config

    #禁用密码验证
    PasswordAuthentication no
    #启用密钥验证
    RSAAuthentication yes #centos 7.4及之后的版本不用加这个
    PubkeyAuthentication yes #centos 7.4及之后是默认开启的

     保存并重启sshd

    #service sshd restart #centos系统

    /**************************************************

    ssh-keygen -t rsa -C 793413226@qq.com

    [root@wzj home]# ssh-keygen -t rsa -C 793413226@qq.com
    Generating public/private rsa key pair.
    Enter file in which to save the key (/root/.ssh/id_rsa): wzjroot
    Enter passphrase (empty for no passphrase):
    Enter same passphrase again:
    Your identification has been saved in wzjroot.
    Your public key has been saved in wzjroot.pub.
    The key fingerprint is:
    SHA256:P0PVjNZ5yw523CXeD+0nFwstCXeuLyr+d2f8rNknLrw 793413226@qq.com
    The key's randomart image is:
    +---[RSA 2048]----+
    | |
    | = . |
    | .+.*.o|
    | oo.B=+|
    | S . *oO+|
    | o . Bo+|
    | +. ..+=|
    | . ooooB*|
    | ..ooE+*=B|
    +----[SHA256]-----+

    **************************************************/

  • 相关阅读:
    Redis主从同步分析(转)
    Jedis使用总结【pipeline】【分布式的id生成器】【分布式锁【watch】【multi】】【redis分布式】(转)
    PHP之PDO_MYSQL扩展安装步骤(转)
    MongoDB 那些坑(转)
    CF 222 (DIV 1)
    TC SRM601
    TC SRM600 DIV2
    Github入门教程
    2013长春区域赛总结
    退役了~~~~~~~~~~~~
  • 原文地址:https://www.cnblogs.com/virtulreal/p/9864497.html
Copyright © 2011-2022 走看看