zoukankan      html  css  js  c++  java
  • linux 免登陆设置

    免登陆 (进入到虚拟机,以root方式登陆)
    vi /etc/ssh/sshd_config

    (要确保这些字符前无注释符号“#”)

    RSAAuthentication yes

    PubkeyAuthentication yes

    AuthorizedKeysFile .ssh/authorized_keys

    PasswordAuthentication yes

    PeimitEmptyPasswords yes


    执行
    ssh-agent bash
    ssh-keygen -t rsa
    ssh-add /root/.ssh/id_rsa
    进入到 cd /root/.ssh/
    touch /root/.ssh/authorized
    cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
    service sshd restart
    实现了自己的免登陆(有时候得在真正的主机上执行这些命令,远程的不行)

    在node1中存在node3的秘钥,node3可以登陆node1.删除了node3的秘钥,就不能登陆了
    也就是node3中存在node1的密码,node1中不逊在node3的,则不能登陆(将node1的公钥加入到各个节点上)
    另外要注意请务必要将服务器上
    ~/.ssh权限设置为700
    ~/.ssh/authorized_keys的权限设置为600

    chmod 700 ~/.ssh
    chmod 600 ~/.ssh/authorized_keys

    这是linux的安全要求,如果权限不对,自动登录将不会生效
    ssh-keygen -t rsa
    cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
    ssh root@node1 cat ~/.ssh/id_rsa.pub>> authorized_keys
    service sshd restart

    scp id_rsa.pub root@192.168.1.153:/hhr
    cat id_rsa.pub >> ~/.ssh/authorized_keys

  • 相关阅读:
    C# 冒泡排序
    C# IO流 File.Exists,Directory.Exists, File.Create,Directory.CreateDirectory
    UGUI 哪些显示在前方的问题
    UGUI Image血条或者进度条效果
    Unity 切换场景的时候让某个游戏对象不消失
    C# string型的转换成float型的
    Json 解析Json
    logging模块

    模块和包
  • 原文地址:https://www.cnblogs.com/wonder2636/p/5612521.html
Copyright © 2011-2022 走看看