ITPub博客

首页 > Linux操作系统 > Linux操作系统 > Configuring sudo to Enable Commands for Non-Root Users (文档 ID 1555703.1)

Configuring sudo to Enable Commands for Non-Root Users (文档 ID 1555703.1)

Linux操作系统 作者:yesu898 时间:2017-07-28 11:01:50 0 删除 编辑
Configuring sudo to Enable Commands for Non-Root Users (文档 ID 1555703.1) 转到底部转到底部

In this Document

Goal
Solution


APPLIES TO:

Linux OS - Version Oracle Linux 5.0 to Oracle Linux 7.2 with Unbreakable Enterprise Kerne [4.1.12] [Release OL5 to OL7U2]
Generic Linux

GOAL

This document describes how to give sudo permission to non-root users to enable or disable execution of commands.
 

SOLUTION

"sudo" tool is used to allow non-root users to run commands that require root privileges. It allows users to run commands as superuser or another user. Login as root user and open "/etc/sudoers" file in edit mode using visudo command:

# visudo

 
.
.
## Allow root to run any commands anywhere
root ALL=(ALL) ALL

# Allow kam user to execute iptables & tcpdump commands
# Syntax: Username Hostname= command1,command2

kam server1= /sbin/iptables, /usr/sbin/tcpdump

## Allows members of the 'sys' group to run networking, software,
.
.


Note: Here ‘server1’ is the host name of the server.

Save and exit visudo.

 

To enable or disable any command execution for non root user, please edit the same file /etc/sudoers and add or remove commands which you would like to disable for any specific user.

 

Sudoer file can be used to give root privileges to specific command for specific file.

This can be done as
<user> ALL=(ALL) <command_absolute_path> <file_list_seperated_via_comma>

Example:
Oracle ALL=(ALL) /bin/ls /opt/oracle.ExaWatcher/archive

The spcial symbol "*" can be used for whole subtree

Example:
Oracle ALL=(ALL) /bin/ls /opt/oracle.ExaWatcher/archive/*

This provide ability to do "ls" with sudo on whole sub-treee (sub directory)

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/24052272/viewspace-2142704/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2015-08-15

  • 博文量
    25
  • 访问量
    47647