zoukankan      html  css  js  c++  java
  • 新服务器sudo与权限分配<NIOT>

    0,生成RSA公钥秘钥

    a,源主机:#ssh-keygen -t rsa

    1,拷贝公钥到authorized_keys文件里面

    a,源主机:#ssh-copy-id -i /root/.ssh/id_rsa.pub root@123.57.1.1

    b,目的主机:#vim /root/.ssh/authorized_keys

    c,目的主机:#cat id_rsa.pub > /root/.ssh/authorized_keys

    d,目的主机:#chmod 600 .ssh/authorized_keys

    2,测试rsa

    a,源主机:#ssh root@123.57.1.1

    3,添加普通用户,附加到wheel组(默认带sudo权限)

    a,目的主机:#useradd -G wheel username

    b,目的主机:#passwd username

    c,目的主机:#id username

    4,编辑sudoers,禁止wheel组修改其他人密码
    a,目的主机:#visudo

    修改%wheel ALL=(ALL) ALL 为 %wheel ALL=(ALL) NOPASSWD: ALL,!/usr/bin/passwd [A-Za-z]*

    5、编辑ssd_config,禁止root通过ssh密码登陆

    a,目标主机:#vim /etc/ssh/sshd_config (第48行)

    修改#PermitRootLogin yes 为 PermitRootLogin without-password

    b,重启sshd服务,目标主机:#service sshd restart,或者#systemctl restart sshd.service

    或者#service ssh restart(ubuntu)

    <完>

  • 相关阅读:
    测试用例原理以及设计方法
    软件测试方法大汇总(转)
    黑盒测试用例大集
    博客第一篇章
    什么是Shell脚本
    部署 Django
    Django 国际化和本地化
    Django与CSRF 、AJAX
    认证系统 Authentication
    Django与缓存
  • 原文地址:https://www.cnblogs.com/fatt/p/4995027.html
Copyright © 2011-2022 走看看