1

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

3
  • all previlege u say, and then talk of restricting?? hmm... /me scratches head
    – Mahesh
    Jun 21, 2012 at 4:57
  • I want to block him to edit sudoers. Jun 26, 2012 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, 2012 at 15:53

1 Answer 1

0

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.

2
  • yes that is my problem. I want to block him to edit sudoers. Jun 26, 2012 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, 2012 at 9:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .