28

Do we need to reboot after adding an user to

/etc/sudoers
  • Have you tried running sudo before rebooting? – kos Aug 27 '15 at 10:05
  • @kos have you down voted according to your comment ? if yes then you got my question wrongly. – Ashish Karpe Jan 12 '17 at 11:46
31

No. It'll work with the next sudo command.

But if it does not work, you can avoid rebooting by running

sudo service sudo restart
| improve this answer | |
  • 3
    On my 14.04 system it did not work with the next sudo command. I needed to do sudo service sudo restart (Rebooting would have worked too, I guess. Bit overkill though.) – Nick Rice Jun 2 '18 at 6:32
9

I just did this and yes, I did in fact have to reboot. So, maybe the previous answer wasn't wrong, but it definitely isn't right 100% of the time. Writing this in case someone else is looking for the answer as I just was.

| improve this answer | |
  • 2
    I had to reboot as well. – Nadav B Feb 12 '18 at 10:12
  • 1
    Instead of rebooting you can do sudo service sudo restart – Nick Rice Jun 2 '18 at 6:32
  • @NickRice any idea on what to do in Arch Linux? – Necktwi Aug 5 '18 at 3:50
  • 11
    What if $sudo service sudo restart outputs 'Failed to restart sudo.service: Unit sudo.service is masked.' – user2066480 Aug 2 '19 at 12:31
2

In CentOS 7 you can also Logout from the system with "exit" and Login again and the Sudoers will be updated.

I've tested on minimal installation but I believe it works in other targets and possibly other distributions aswell.

| improve this answer | |
1

In fact the only thing you need is to get a (new) login prompt, so using the following command works:

anyuser$ su -l <user>
user$ sudo <thenewlysudoedcommand>
... works...

But if you are logged in as GUI, then you need to logout & login again.

But, as with MOST linux tools you DON'T need to reboot the computer (that's a Windows thing).

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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