1748274 Members
4088 Online
108760 Solutions
New Discussion юеВ

Re: sudo error

 
Wamaitha
Frequent Advisor

sudo error

hello,
i have a 2 for 1, i have added a user to the sudoers file. when the user tries to perform sudo -s, the get the message that user is not on the user is not in sudoers file.
in addition if i am logged in as root, the screen gets the following message:
Feb 21 14:08:12 wally sudo: username : user NOT in sudoers ; TTY=ttyp3 ; PWD=/home/username ; USER=root ; COMMAND=/usr/bin/sh
thanks in advance.
9 REPLIES 9
Ivan Ferreira
Honored Contributor

Re: sudo error

Have you used visudo to modify the file?

Did you save the changes and exit? Otherwise the changes are on the temp file.

Ensure that there is no an unfinished line, missing backslash or comma.
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
Kent Ostby
Honored Contributor

Re: sudo error

Check your permissions on the sudoers file and make sure that you are all the way out of the file as advised above.

"Well, actually, she is a rocket scientist" -- Steve Martin in "Roxanne"

Re: sudo error

Hi,

Did you save the file before exiting? Use #sudo -l and verify the user is properly authenticated in suoders file what commands he can execute

Regards,
Sunil
Your imagination is the preview of your life's coming attractions
Rick Garland
Honored Contributor

Re: sudo error

Looks like the visudo command was not used.

Use visudo to make modifications to the sudoers file.
Mustafa Gulercan
Respected Contributor

Re: sudo error

hi Wamaitha;

you must use visudo rather than vi.
and don't forget to save your sudoers file.
be sure that add your user to the User_Alias

# User alias specification
User_Alias EXAMPLE = user1, user2

regards,
mustafa
Kenan Erdey
Honored Contributor

Re: sudo error

hi Wamaitha;

sudo's configuration file, i mean sudoers can be in different paths according to O.S or version. you probably changed another sudoers file. if you use visudo instead of directly editing the file, no problem occurs. because visudo command edits the exact configuration file.

Kenan.
Computers have lots of memory but no imagination
Wamaitha
Frequent Advisor

Re: sudo error

Hello all, i did use visudo to make the necessary changes to the sudoer file. would the owner of the file be the issue??? i am able to login using sudo but a co-worker is not able to.
thanks in advance.
Kenan Erdey
Honored Contributor

Re: sudo error

sudo -s opens the shell ( defined in etc/passwd or defined as shell variable) as the user spesified in sudoers ( default root). if you didn't give priviliges in sudoers to the user, he/she can't opens the shell. you can give it like this:

user ALL = (ALL) /sbin/sh

first "ALL" may be replaced by hostname
second by the user you want to run as.

on the other hand, if you let someone open a root shell, sudo loose its importancy. because you can't log the user anymore.
Computers have lots of memory but no imagination
Wamaitha
Frequent Advisor

Re: sudo error

thanks to all your answers, what i did was delete the file and create it again. i had made a copy of the original sudoers file.
made the necessary changes and wala, it worked,
thanks as always.