1830203 Members
9817 Online
109999 Solutions
New Discussion

Sudo - Cmnd_Alias errors

 
CRollins
Advisor

Sudo - Cmnd_Alias errors

I'm setting up the sudoers file for USR1 to run the PROCESSLOADS commands as USR2. I'm getting syntax errors on Cmnd_Alias. Is there something wrong with this syntax? It looks right. This is driving me nuts. Please help. I would also like to add the NOPASSWD option to the user speicification but I want to get these piece working first.

@line 13 ->

Cmnd_Alias PROCESSLOADS=cp,ls


@line 32 ->

USR1 ALL=(USR2) PROCESSLOADS


>>> sudoers file: syntax error, line 13 <<<
Warning: undeclared Cmnd_Alias `PROCESSLOADS' referenced near line 32


Also there isnt an /etc/sudoers file default upon installation. The default path when using visudo is /usr/local/etc/sudoers.tmp. Do I need to create /etc/sudoers?

Thanks!!
7 REPLIES 7
Jeff_Traigle
Honored Contributor

Re: Sudo - Cmnd_Alias errors

You must include full path for the commands in the alias.

Cmnd_Alias PROCESSLOADS = /usr/bin/cp, /usr/bin/ls
--
Jeff Traigle
Steven E. Protter
Exalted Contributor

Re: Sudo - Cmnd_Alias errors

Shalom,

I'm guessing you are using sudo from Internet Express. It keeps the sudoers file in the /opt filesystem.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
AwadheshPandey
Honored Contributor

Re: Sudo - Cmnd_Alias errors

use visudo command, it will open sudoers file for you. Use full path of cammand.
# sudoers file.
#
# This file MUST be edited with the 'visudo' command as root.
#
# See the man page for the details on how to write a sudoers file.
#

# Host alias specification

# User alias specification
User_Alias
# Cmnd alias specification
Cmnd_Alias
# User privilege specification
It's kind of fun to do the impossible
Aussan
Respected Contributor

Re: Sudo - Cmnd_Alias errors

you need the full path for cp and ls

Cmnd_Alias PROCESSLOADS = /usr/bin/cp,/usr/bin/ls

USR1 ALL = (USR2) PROCESSLOADS

also my sudoers didn't like it when i did not have spaces between the = the user ..etc

i don't know why but you might want to try that also


The tongue weighs practically nothing, but so few people can hold it
Aussan
Respected Contributor

Re: Sudo - Cmnd_Alias errors

you need the full path for cp and ls

Cmnd_Alias PROCESSLOADS = /usr/bin/cp,/usr/bin/ls

USR1 ALL = (USR2) PROCESSLOADS

for the /etc/sudoers, it should be created once you save the file, if not just create a link to the original file

The tongue weighs practically nothing, but so few people can hold it
CRollins
Advisor

Re: Sudo - Cmnd_Alias errors

I added the full path and im getting the same error. I used ls and cp as the example but its actually an executatble for the application. I'm giving the application person access to run their processes. The file has execute permission on the file, yet Cmnd_Alias is still giving undeclared alias errors.
CRollins
Advisor

Re: Sudo - Cmnd_Alias errors

ok - i fixed that but its ignoring the NOPASSWD switch.

user

USERNAMEGROUP ALL=(user2) NOPASSWD: COMMANDVAR