Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

How can I add an user to sudoers list with all privileges, but that user should not be able to edit the sudoers file ?

share|improve this question
    
all previlege u say, and then talk of restricting?? hmm... /me scratches head –  Mahesh Jun 21 '12 at 4:57
    
I want to block him to edit sudoers. –  linuxspider Jun 26 '12 at 12:21
1  
If you wish to give root access, nothing can stop him/her from messing up with your system. All privileges means No restrictions. Give only the permissions he needs. What exactly is your situation? If you edit the question to add this information, we may be able to help better. –  Mahesh Jun 26 '12 at 15:53

1 Answer 1

Edit the sudoers with the visudo command

sudo visudo

Add the user like this

theusername ALL=ALL, !/usr/sbin/visudo

Which will explicit disallow the user from running the visudo command with sudo.

However, this does not prevent them from running

sudo -s

to drop to a root shell, from which they can run the visudo command.

share|improve this answer
    
yes that is my problem. I want to block him to edit sudoers. –  linuxspider Jun 26 '12 at 12:21
    
Or prevent him from editing /ect/sudoers with regular vim (or any other texteditor). I don't think there's any solution you would be happy with, because you're asking for contraditory things. –  con-f-use Jun 27 '12 at 9:08

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.