nixCraft Linux Forum

nixCraft

Linux Tech Support Forum

/etc/sudoers file

This is a discussion on /etc/sudoers file within the Linux software forums, part of the Linux Getting Started category; User_Alias USERS=sarkar,redhat Cmnd_Alias USERS=/sbin/fdisk,/sbin/ifconfig USERS ALL=USERS I gave the following commands in /etc/sudoers. When I tried to save the sudoers ...


Go Back   nixCraft Linux Forum > Linux Getting Started > Linux software

Register FAQ Members List Calendar Forgotten your password? Mark Forums Read
  #1 (permalink)  
Old 08-27-2008, 06:25 PM
Junior Member
User
 
Join Date: Jul 2007
Location: Hyderabad
My distro: Redhat RHEL, Solaris
Posts: 29
Rep Power: 0
vaibhav.kanchan is on a distinguished road
Default /etc/sudoers file

User_Alias USERS=sarkar,redhat
Cmnd_Alias USERS=/sbin/fdisk,/sbin/ifconfig
USERS ALL=USERS

I gave the following commands in /etc/sudoers. When I tried to save the sudoers file..

its telling that Host_Alias USERS not found.
User_Alias not correct..

Please let me knw if any mistake is there in the below /etc/sudoers file.. They are given in bold format..

## Sudoers allows particular users to run various commands as
## the root user, without needing the root password.

##
## Examples are provided at the bottom of the file for collections
## of related commands, which can then be delegated out to particular
## users or groups.

##
## This file must be edited with the 'visudo' command.


## Host Aliases
## Groups of machines. You may prefer to use hostnames (perhap using

## wildcards for entire domain or IP addresses instead.

# Host_Alias FILESERVERS = fs1, fs2
# Host_Alias MAILSERVERS = smtp, smtp2
## User Aliases
## These aren't often necessary, as you can use regular groups

## (ie, from files, LDAP, NIS, etc) in this file - just use %groupname
## rather than
USERALIAS
# User_Alias ADMINS = jsmith, mikem

User_Alias USERS=sarkar,ram,redhat

## Command Aliases
## These are groups of related commands...

## Networking
Cmnd_Alias NETWORKING = /sbin/route, /sbin/ifconfig, /bin/ping, /sbin/dhclient, /usr/bin/net, /sbin/iptables, /usr/bin/rfcomm, /usr/bin/wvdial, /sbin/iwconfig, /sbin/mii-tool

## Installation and management of software
Cmnd_Alias SOFTWARE = /bin/rpm, /usr/bin/up2date, /usr/bin/yum
Cmnd_Alias USERS=/sbin/fdisk,/usr/sbin/updatedb,/sbin/chkconfig

## Services
Cmnd_Alias SERVICES = /sbin/service, /sbin/chkconfig
## Updating the locate database
Cmnd_Alias LOCATE = /usr/sbin/updatedb

## Storage
Cmnd_Alias STORAGE = /sbin/fdisk, /sbin/sfdisk, /sbin/parted, /sbin/partprobe, /bin/mount, /bin/umount

## Delegating permissions
Cmnd_Alias DELEGATING = /usr/sbin/visudo, /bin/chown, /bin/chmod, /bin/chgrp
## Processes
Cmnd_Alias PROCESSES = /bin/nice, /bin/kill, /usr/bin/kill, /usr/bin/killall

## Drivers
Cmnd_Alias DRIVERS = /sbin/modprobe
# Defaults specification
#
# Disable "ssh hostname sudo <cmd>", because it will show the password in clear.

# You have to run "ssh -t hostname sudo <cmd>".
#
Defaults requiretty
Defaults env_reset
Defaults env_keep = "COLORS DISPLAY HOSTNAME HISTSIZE INPUTRC KDEDIR \
LS_COLORS MAIL PS1 PS2 QTDIR USERNAME \
LANG LC_ADDRESS LC_CTYPE LC_COLLATE LC_IDENTIFICATION \
LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC \
LC_PAPER LC_TELEPHONE LC_TIME LC_ALL LANGUAGE LINGUAS \
_XKB_CHARSET XAUTHORITY"
## Next comes the main part: which users can run what software on

## which machines (the sudoers file can be shared between multiple
## system.

## Syntax:
##

## user MACHINE=COMMANDS
##

## The COMMANDS section may have other options added to it.
##

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

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

## service management apps and more.

%sys ALL = NETWORKING, SOFTWARE, SERVICES, STORAGE, DELEGATING, PROCESSES, LOCATE, DRIVERS
## Allows people in group wheel to run all commands

# %wheel ALL=(ALL) ALL
## Same thing without a password

# %wheel ALL=(ALL) NOPASSWD: ALL

## Allows members of the users group to mount and unmount the
## cdrom as root

# %users ALL=/sbin/mount /mnt/cdrom, /sbin/umount /mnt/cdrom

## Allows members of the users group to shutdown this system

# %users localhost=/sbin/shutdown -h now
USERS ALL=USERS
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 08-28-2008, 01:12 PM
Junior Member
User
 
Join Date: Sep 2007
Location: Mumbai
My distro: Redhat/Solaris
Posts: 26
Rep Power: 0
amsreeku is on a distinguished road
Default Sudoers

User_Alias SARKAR = sarkar
User_Alias REDHAT =redhat

Cmnd_Alias FDISK = /sbin/fdisk
Cmnd_Alias IFCONFIG = /sbin/ifconfig

SARKAR ALL =FDISK,IFCONFIG
REDHAT ALL =FDISK,IFCONFIG

Please try this i have this and has been suceeded.

Shrikumar
__________________
Shrikumar
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

Thread Thread Starter Forum Replies Last Post
Shell Script To Outputs File Permissions of Most Recently Modified File glen_4455 Shell scripting 1 08-25-2008 03:39 PM
Find Unix Linux File / Directory by date And Then Copy / Move File asim.mcp CentOS / RHEL / Fedora 1 08-10-2008 04:30 AM
shell script to search specific file from txt file inside zip file and extract it aasif.shaikh Shell scripting 2 05-31-2008 07:44 PM
Read arguments from a file and pass them to binary file AHJ Shell scripting 1 10-31-2007 07:04 PM


All times are GMT +5.5. The time now is 09:56 PM.


Powered by vBulletin® Version 3.7.4 - Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36