zoukankan      html  css  js  c++  java
  • rhel7 配置普通用户使用sudo

    rhel服务器版本安装之后,默认创建的用户不能使用sudo。使用sudo,会提示 user1 is not in the sudoers file. This incident will be reported.

    解决方法(比如创建的用户叫做user1, 密码user1pass):

    1、直接运行visudo命令,或者vim /etc/sudoers 。 打开并编辑/etc/sudoers文件:

    visudo
    或者
    vim /etc/sudoers

    2、找到下边代码的位置,并删除第二行的 ‘#’

    ## Allows people in group wheel to run all commands
    # %wheel        ALL=(ALL)       ALL

    3、用root身份运行:

    usermod -aG wheel user1

    4、切换到user1用户,并查看是否已经属于wheel组:

    su - user1
    groups

    如果显示为:

    user1 wheel

    即表示成功。

    5、测试:

    sudo whoami

    显示类似下边代码即表明可以正常使用sudo:

    $ sudo whoami
    We trust you have received the usual lecture from the local System
    Administrator. It usually boils down to these three things:
    
        #1) Respect the privacy of others.
        #2) Think before you type.
        #3) With great power comes great responsibility.
    
    [sudo] password for USERNAME:
    root

    完毕。

  • 相关阅读:
    bzoj3237 cdq分治+可撤销并查集
    bzoj2957 奥妙重重的线段树
    bzoj3718 树状数组
    bzoj3991 LCA + set
    codeforces794D dfs+图上hash
    [ZJOI2010]数字计数/烦人的数学作业
    [SCOI2009]windy数
    数位DP(学习笔记)
    UVA10559 方块消除 Blocks
    采蘑菇
  • 原文地址:https://www.cnblogs.com/asmer-stone/p/5268750.html
Copyright © 2011-2022 走看看