• centos添加和删除用户及 xxx is not in the sudoers file.This incident will be reported.的解决方法


     修改主机名:vim /etc/sysconfig/network

    1、添加用户,首先用adduser命令添加一个普通用户,命令如下:

    #adduser tommy

    //添加一个名为tommy的用户

    #passwd tommy   //修改密码

    Changing password for user tommy.

    New UNIX password:     //在这里输入新密码

    Retype new UNIX password:  //再次输入新密码

    passwd: all authentication tokens updated successfully.

    2.删除用户test:

    userdel test

    删除用户以及用户目录:

    userdel -f test


      xxx is not in the sudoers file.This incident will be reported.的解决方法

    1.切换到root用户下,怎么切换就不用说了吧,不会的自己百度去.

    2.添加sudo文件的写权限,命令是:
    chmod u+w /etc/sudoers

    3.编辑sudoers文件
    vi /etc/sudoers
    找到这行 root ALL=(ALL) ALL,在他下面添加xxx ALL=(ALL) ALL (这里的xxx是你的用户名)

    ps:这里说下你可以sudoers添加下面四行中任意一条
    youuser            ALL=(ALL)                ALL
    %youuser           ALL=(ALL)                ALL
    youuser            ALL=(ALL)                NOPASSWD: ALL
    %youuser           ALL=(ALL)                NOPASSWD: ALL

    第一行:允许用户youuser执行sudo命令(需要输入密码).
    第二行:允许用户组youuser里面的用户执行sudo命令(需要输入密码).
    第三行:允许用户youuser执行sudo命令,并且在执行的时候不输入密码.
    第四行:允许用户组youuser里面的用户执行sudo命令,并且在执行的时候不输入密码.

    4.撤销sudoers文件写权限,命令:
    chmod u-w /etc/sudoers

    这样普通用户就可以使用sudo了.
  • 相关阅读:
    利用python求非线性方程
    迪士尼穷游攻略
    爬虫八之爬取京东商品信息
    爬虫七之分析Ajax请求并爬取今日头条
    爬虫五之Selenium
    爬虫4之pyquery
    前端传入 SQL 语句 到后端执行
    手写分页处理
    集合(Map,List)分组:多属性进行分组
    java 枚举类非常好的运用实例
  • 原文地址:https://www.cnblogs.com/felixzh/p/5062082.html
Copyright © 2020-2023  润新知