https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux_OpenStack_Platform/2/html/Getting_Started_Guide/ch02s03.html

The sudo command offers a mechanism for providing trusted users with administrative access to a system without sharing the password of the root user. When users given access via this mechanism precede an administrative command with sudo they are prompted to enter their own password. Once authenticated, and assuming the command is permitted, the administrative command is executed as if run by the rootuser.
Follow this procedure to create a normal user account and give it sudo access. You will then be able to use the sudo command from this user account to execute administrative commands without logging in to the account of the root user.

Procedure 2.2. Configuring sudo Access

  1. Log in to the system as the root user.
  2. Create a normal user account using the useradd command. Replace USERNAME with the user name that you wish to create.
    # useradd USERNAME
  3. Set a password for the new user using the passwd command.
    # passwd USERNAME
    Changing password for user USERNAME.
    New password:
    Retype new password:
    passwd: all authentication tokens updated successfully.
  4. Run the visudo to edit the /etc/sudoers file. This file defines the policies applied by the sudocommand.
    # visudo
  5. Find the lines in the file that grant sudo access to users in the group wheel when enabled.
    ## Allows people in group wheel to run all commands
    # %wheel ALL=(ALL) ALL
  6. Remove the comment character (#) at the start of the second line. This enables the configuration option.
  7. Save your changes and exit the editor.
  8. Add the user you created to the wheel group using the usermod command.
    # usermod -aG wheel USERNAME
  9. Test that the updated configuration allows the user you created to run commands using sudo.
    1. Use the su to switch to the new user account that you created.
      # su USERNAME -
    2. Use the groups to verify that the user is in the wheel group.
      $ groups
      USERNAME wheel
    3. Use the sudo command to run the whoami command. As this is the first time you have run a command using sudo from this user account the banner message will be displayed. You will be also be prompted to enter the password for the user account.
      $ 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
      The last line of the output is the user name returned by the whoami command. If sudo is configured correctly this value will be root.
You have successfully configured a user with sudo access. You can now log in to this user account and use sudo to run commands as if you were logged in to the account of the root user.

2.3. Configuring sudo Access-RedHat的更多相关文章

  1. Back-off pulling image \"registry.access.redhat.com/rhel7/pod-infrastructure:latest

    Error syncing pod, skipping: failed to "StartContainer" for "POD" with ImagePull ...

  2. 解决: docker pull registry.access.redhat.com/rhel7/pod-infrastructure:latest

    直接获取 rpm文件 wget http://mirror.centos.org/centos/7/os/x86_64/Packages/python-rhsm-certificates-1.19.1 ...

  3. open /etc/docker/certs.d/registry.access.redhat.com/redhat-ca.crt: no such file or directory 解决方案

    方法一.  yum安装 yum install *rhsm* 方法二 (我是用这方法解决的) 执行命令: ①   wget http://mirror.centos.org/centos/7/os/x ...

  4. RedHat 和 Mirantis OpenStack 产品的版本和功能汇总和对比(持续更新)

    Mirantis 和 Red Hat 作为 OpenStack 商业化产品领域的两大领军企业,在行业内有重要的地位.因此,研究其产品版本发布周期和所支持的功能,对制定 OpenStack 产品的版本和 ...

  5. CVE-2014-4877 && wget: FTP Symlink Arbitrary Filesystem Access

    目录 . 漏洞基本描述 . 漏洞带来的影响 . 漏洞攻击场景重现 . 漏洞的利用场景 . 漏洞原理分析 . 漏洞修复方案 . 攻防思考 1. 漏洞基本描述 0x1: Wget简介 wget是一个从网络 ...

  6. Redhat 官方Performance_Tuning_Guide

    https://access.redhat.com/documentation/zh-CN/Red_Hat_Enterprise_Linux/6/html/Performance_Tuning_Gui ...

  7. SAP中的读访问日志Read Access Logging(RAL)

    定义 读取访问日志(以下简称RAL)用于监视并记录对敏感数据的读取访问.这里的数据是指会被法律,外部公司政策或公司内部政策归类为敏感信息的数据.以下典型问题可能会与使用读取访问日志的应用程序有关: 谁 ...

  8. redhat 7安装CentOS 7 yum源

    http://www.bubuko.com/infodetail-2004218.html http://www.bubuko.com/infodetail-2004218.html ******** ...

  9. 红帽旗下Linux的版本说明RedHat、CentOS、Fedora、OEL等

    简单总结一下RedHat.CentOS.Fedora Core区别关系: RedHat: 红帽已经被IBM 340亿刀收购了,但是红帽依旧发型自己的RedHat enterprise linux 版本 ...

随机推荐

  1. uoj#34

    模板 #include<bits/stdc++.h> #define pi acos(-1) using namespace std; ; int n, m, L, x; int r[N] ...

  2. IDEA Spark Streaming Flume数据源 --解决无法转化为实际输入数据,及中文乱码(Scala)

    需要三步: 1.shell:往 1234 端口写数据 nc localhost 1234 2.shell: 启动flume服务 cd /usr/local2/flume/bin ./flume-ng ...

  3. js mvc框架

    介绍 使用过 JavaScript框架(如 AngularJS, Backbone 或者Ember)的人都很熟悉在UI(用户界面,前端)中mvc的工作机理.这些框架实现了MVC,使得在一个单页面中实现 ...

  4. Vue项目中如何使用less(添加less依赖)

    今天在新工程里添加了一段样式代码代码突然报错了: <!-- Add "scoped" attribute to limit CSS to this component onl ...

  5. wxwidgets安装环境配置

    一:安装VS2012 wxWidgets-2.9.5( 2.95版本为最稳定版本) 二:打开wxWidgets-2.9.5的安装目录,找到build-msw-wx_vc10.sln打开(等待) 三:打 ...

  6. Android内存管理(13)常见产生内存泄漏的原因

    1.集合类泄漏 集合类如果仅仅有添加元素的方法,而没有相应的删除机制,导致内存被占用.如果这个集合类是全局性的变量 (比如类中的静态属性,全局性的 map 等即有静态引用或 final 一直指向它), ...

  7. 自定义View(9)使用Renderscript 渲染特效。

    1.渲染脚本官网 https://developer.android.com/guide/topics/renderscript/compute 2.高斯模糊 ScriptIntrinsicBlur ...

  8. JS——标记

    continue 语句(带有或不带标签引用)只能用在循环中.break 语句(不带标签引用),只能用在循环或 switch 中.通过标签引用,break 语句可用于跳出任何 JavaScript 代码 ...

  9. Java class对象说明 Java 静态变量声明和赋值说明

        先看下JDK中的说明: java.lang.Object java.lang.Class<T> Instances of the class Class represent cla ...

  10. CSS居中布局方案

    基本结构 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF- ...