zoukankan      html  css  js  c++  java
  • linux- ssh-keygen

    1.支持免密访问

    生成公钥

    ssh-keygen -t rsa -C "Qin Feng" 

    连续3个回车,最后得到了两个文件:id_rsaid_rsa.pub,在文件夹$ ~/.ssh文件夹下面


    公钥添加到authorized_keys中:cd /home/roaddb/.ssh  &&  cat id_rsa.pub >> authorized_keys
    注意权限:chmod 700 .ssh ,chmod 600 .ssh/authorized_keys

    【sudo权限免密】

    切换到root下修改:sudo su

    chmod u+w /etc/sudoers
    vi /etc/sudoers

      例:# User privilege specification
            root    ALL=(ALL:ALL) ALL

         # Members of the admin group may gain root privileges
         %admin ALL=(ALL) ALL

        # Allow members of group sudo to execute any command
        %sudo    ALL=(ALL:ALL) ALL
        user ALL=(ALL) NOPASSWD:ALL
        www-data ALL=(ALL) NOPASSWD:ALL

    chmod u-w /etc/sudoers

    公钥添加到authorized_keys到文件中之后仍无法免密登陆

    同样的,检查目录和文件权限,确保.ssh目录权限为700authorized_keys文件权限为600

    chmod 700 ~/.ssh
    chmod 600 ~/.ssh/authorized_keys
  • 相关阅读:
    git 常用命令
    重要知识点
    HTML 标记语言
    js类型转换
    伪数组变数组 js
    在 JavaScript 中为什么 typeof null 的结果是 object?
    HTML中href、src区别
    解决for循环插入同一元素无法重复插入问题
    HTML5-语义化
    mount 和 /etc/fstab关系。
  • 原文地址:https://www.cnblogs.com/ting152/p/12516789.html
Copyright © 2011-2022 走看看