Sorry, user test1 is not allowed to execute "/usr/lbin/getprpw -m spwchg test1" as root on hostname (1051 Views)
Reply
Frequent Advisor
ladoo_1
Posts: 58
Registered: ‎03-11-2007
Message 1 of 12 (1,051 Views)

Sorry, user test1 is not allowed to execute "/usr/lbin/getprpw -m spwchg test1" as root on hostname

I have this line in the /etc/sudoers file ..
Host_Alias SER=server1,server2

ALL SER=/usr/lbin/getprpw ALL

Please let me know what else i need to do ??
thanks
Exalted Contributor
Steven E. Protter
Posts: 33,806
Registered: ‎08-15-2002
Message 2 of 12 (1,051 Views)

Re: Sorry, user test1 is not allowed to execute "/usr/lbin/getprpw -m spwchg test1" as root on hostname

Shalom,

I don't see the users defined in your sudoers file.

Example:

ycallen MAIN=NOPASSWD:SNMP

Cmnd_Alias SNMP=/usr/local/emanate/linux.bin/snmpdm,/etc/rc.d/init.d/snmpm,/etc/init.d/snmpm

This gives user ycallen (who no longer works here) the rights to run the progams listed in the command alias as root.

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
Frequent Advisor
ladoo_1
Posts: 58
Registered: ‎03-11-2007
Message 3 of 12 (1,051 Views)

Re: Sorry, user test1 is not allowed to execute "/usr/lbin/getprpw -m spwchg test1" as root on hostname

I want all the users on the Host_Alias SER=server1 , server2

to run that command ...

ALL SER=/usr/lbin/getprpw ALL


ALL = All users

SER = host list

command /usr/lbin/getprpw

I amy have the syntax incorect ??
Honored Contributor
Ivan Krastev
Posts: 2,156
Registered: ‎06-25-2006
Message 4 of 12 (1,051 Views)

Re: Sorry, user test1 is not allowed to execute "/usr/lbin/getprpw -m spwchg test1" as root on hostname

Try:

ALL SER=/usr/lbin/getprpw

regards,
ivan
Frequent Advisor
ladoo_1
Posts: 58
Registered: ‎03-11-2007
Message 5 of 12 (1,051 Views)

Re: Sorry, user test1 is not allowed to execute "/usr/lbin/getprpw -m spwchg test1" as root on hostname

I still get the error ...
Frequent Advisor
ladoo_1
Posts: 58
Registered: ‎03-11-2007
Message 6 of 12 (1,051 Views)

Re: Sorry, user test1 is not allowed to execute "/usr/lbin/getprpw -m spwchg test1" as root on hostname

any one ...
Honored Contributor
Kenan Erdey
Posts: 559
Registered: ‎02-13-2006
Message 7 of 12 (1,051 Views)

Re: Sorry, user test1 is not allowed to execute "/usr/lbin/getprpw -m spwchg test1" as root on hostname

Hi,

can you post sudo -l output when you are test1 ?
Computers have lots of memory but no imagination
Frequent Advisor
ladoo_1
Posts: 58
Registered: ‎03-11-2007
Message 8 of 12 (1,051 Views)

Re: Sorry, user test1 is not allowed to execute "/usr/lbin/getprpw -m spwchg test1" as root on hostname

ALL SER=/usr/lbin/getprpw ALL


if you look at the above line i have ALL in the first field that means every one on that server ...
Frequent Advisor
ladoo_1
Posts: 58
Registered: ‎03-11-2007
Message 9 of 12 (1,051 Views)

Re: Sorry, user test1 is not allowed to execute "/usr/lbin/getprpw -m spwchg test1" as root on hostname

SER= Host_Alias where the host list is ..

Host_Alias SER= server1, server2 ....
Frequent Advisor
ladoo_1
Posts: 58
Registered: ‎03-11-2007
Message 10 of 12 (1,051 Views)

Re: Sorry, user test1 is not allowed to execute "/usr/lbin/getprpw -m spwchg test1" as root on hostname

the problem is here But i don't know how to fix it ...as i don't no scripting ..

# If user is root, then sudo is not needed.
# Use getprpw to get the date the password was changed. Get the Month, day and year
# it was changed.

if [[ "${USER}" = "root" ]] ; then
/usr/lbin/getprpw -m spwchg ${USER} | awk '{print $2, $3, $5}' | read CHMONTH CHDAY CHYEAR
else
/usr/local/bin/sudo /usr/lbin/getprpw -m spwchg ${USER} | awk '{print $2, $3, $5}' | read CHMONTH CHDAY CHYEAR
fi
Acclaimed Contributor
Dennis Handly
Posts: 25,072
Registered: ‎03-06-2006
Message 11 of 12 (1,051 Views)

Re: Sorry, user test1 is not allowed to execute "/usr/lbin/getprpw -m spwchg test1" as root on hostname

>The problem is here. But i don't know how to fix it.

What seems to be wrong? The syntax seems to be fine.
Or are you getting your original "Sorry, user test1 is not allowed ..." error?
Frequent Advisor
Paul D. Simpson
Posts: 43
Registered: ‎04-01-2004
Message 12 of 12 (1,051 Views)

Re: Sorry, user test1 is not allowed to execute "/usr/lbin/getprpw -m spwchg test1" as root on hostname

How about something like:


%users SER=/usr/lbin/getprpw

in sudoers?

This will allow all members of the group "users" to run the command.
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.