What's wrong with using sudo?
In a comment here I've been told that unnecessarily using sudo
should be avoided. While it wasn't needed in that particular case, I don't see any harm in using it.
I think that when executing trivial programs like cat
as root using sudo
, the overall risk of hitting a bug that would somehow compromise system security is very low.
So can someone please point out the possible implications, besides typing 4 more characters and a space?
Solution 1:
The risk of a typo is more than the risk of a bug.
The risk of gaining a habit of "it doesn't work, stick sudo
on it!" is much higher than the risk of a bug.
As a sysadmin who's seen people execute all sorts of random commands with sudo
that didn't need them, I always caution against superfluous usage of sudo
.
While cat
isn't harmful, the habit that this encourages is.
Solution 2:
I think there is another issue not yet mentioned: sudo
status is cached for the shell with a default of 15 minutes. This means you don't have to provide your password in the next 15 minutes in order to execute a potentially dangerous command.
I think we all can think of more or less likely security issues that could result from that: Unknown software bugs that exploit this or forgetting to lock the screen with random people or co-workers around come to mind.
This is indeed my primary reason for not using sudo
when I don't have to and even if I have to, for frequently closing shells after I'm done with sudo
work.
Solution 3:
Using sudo
excessively is the Linux equivalent of the old Windows habit of running everything under the Administrator account. That one has been discussed and criticized to hell and back, so you can read everything that talks about why a person should not be running their Windows computer as an Administrator, and every single point will apply to habitual use of sudo
on Linux.
Solution 4:
well, it's just cause you might accidentally mess with sensitive parts of your file system, causing much much trouble to yourself Being careful is never enough, so better not to expose yourself to unnecessary dangers