5

From "Do we need to reboot after adding an user to sudoers?", it is apparent that restarting Sudo Service is necessary, or reboot. However the recommended way, which works for Ubuntu 14.04, is no longer working for Ubuntu 18+:

$ sudo service sudo restart
Failed to restart sudo.service: Unit sudo.service is masked.

Solution?

xpt
  • 1,197

2 Answers2

8

masked services are when the systemd unit files are linked to /dev/null/ You can see the sudo.service

$ systemctl status sudo.service
● sudo.service
   Loaded: masked (/dev/null; bad)
   Active: inactive (dead)

$ ls -l /lib/systemd/system/sudo.service
lrwxrwxrwx 1 root root 9 Jan 18  2018 /lib/systemd/system/sudo.service -> /dev/null

Some services are used within systemd, and not actual daemons with processes that run in the background. For example, you cannot start/stop halt.service. But if you place your scripts in /usr/lib/systemd/system-shutdown/, they will be run before the system is halted or rebooted.

Sudo Usage

You don't need to reboot to use sudo. Simply add users and your settings to the Sudoers file.

hanxue
  • 700
0

I know it's late but I wanted to give my two cents to newbs like me. I also thought the change wasn't working, it was just silly of me that I thought you didn't need to type sudo anymore after the first one for however long timeout in sudoers is set for (default 15 min). In other words you have to keep typing sudo before any relevant command, it just doesn't ask you for password anymore.

Eliah Kagan
  • 119,640