Why is root in sudoers file?
Sophia Terry
I couldn't help but notice the line in the sudoers file:
root ALL=(ALL:ALL) ALL
From what I understand root already has superuser privileges and doesn't really need to use sudo at all. Am I missing something? Why would root have default sudo privileges when, even when removed from this file, can still do everything it could before? Sorry if the answer is obvious I'm new to linux
21 Answer
The purpose of sudo is to impersonate another user. Root has plenty of reasons to impersonate other users, e.g. testing whether service accounts are set up correctly.
Also, you overlooked a key word in your own question [bold emphasis mine]:
From what I understand root already has superuser privileges and doesn't really need to use sudo at all.
Sure, root doesn't need to use sudo, but they still might accidentally type sudo, and it would be pretty annoying if the command then fails because root is not allowed to use sudo.
It would also make it awkward to write scripts which use sudo and may or may not run under the root account.