1827854 Members
1444 Online
109969 Solutions
New Discussion

problem in sudo

 
prasadb
Super Advisor

problem in sudo

hello experts,

i have a HP-UX machine, B.11.11. i want to give some users the sudo priviledges to root. But its not working..

here is the entry for the ready reference

# User alias specification

User_Alias SHIFT=shiftopr


# User privilege specification

SHIFT PROD=SHELL



But when i sudo sh by the user shiftopr, then it give this error :


$ sudo sh
Password:
shiftopr is not in the sudoers file. This incident will be reported.



why this error, when i have made the proper entry in /opt/sudo/etc/sudoers/sudoers file

kindly help
6 REPLIES 6
amipankaj
Frequent Advisor

Re: problem in sudo

hi prashad,

i think you should give no_passwd opsion in sudoers file for the user.

thanks,
roy
Rasheed Tamton
Honored Contributor

Re: problem in sudo

Hi,

Is /opt/sudo/etc/sudoers/sudoers the correct path for the sudoers. May be you have to link as /etc/sudoers.

ln -s /opt/sudo/etc/sudoers/sudoers /etc/sudoers
Did you use visudo, when you edit the file.

rgds.
Rasheed Tamton
Honored Contributor

Re: problem in sudo

There is no command alias in your sudoers file. Type sudo only at the prompt. Do you get anything.

what output sudo -l gives?
Change /etc/sudoers for testing to
User_Alias SHIFT=shifto
SHIFT ALL= /bin/su
then type at the cmd prompt
sudo su

or

User_Alias SHIFT=shifto
SHIFT ALL= /bin/sh
then type at the cmd prompt
sudo sh

rgds.
Ralph Grothe
Honored Contributor

Re: problem in sudo

From the sample definitions given it cannot be seen what SHELL for instance defines.
Logged in as user shiftopr you should be able to execute "sudo -l" and be given a list of commands the user is allowed to run through sudo.
Note, you should never edit the sudoers file directly but use the frontend command visudo exclusively.
Madness, thy name is system administration
prasadb
Super Advisor

Re: problem in sudo

what i found is that there are different locations of sudoers file...like

in most of my servers i found sudoers file at

/opt/sudo/etc/sudoers

whereas in some it was at /usr/local/sbin

and in some it resides at /etc/sudoers..

i don't know why it is so..but the best way to remove the confusion is, i guess is to fire

# whereis visudo
visudo: /opt/sudo/sbin/visudo /opt/sudo/man/man1m/visudo.1m

i got this path..and in some servers it is

/usr/local/sbin/visudo


the problem is resolved now..i will close this thread at the end of the day. meanwhile i would definitely like to listen from you all experts something more & interesting, if you have any to inform


Thanks all...
Kenan Erdey
Honored Contributor

Re: problem in sudo

don't care sudoers place. don't edit via vi.just type visudo.

please not that sudo sh keeps users' environment.
sudo su - changes environent to root.
Computers have lots of memory but no imagination