Lucas Zuege's Blog

Stop including sudo in your Linux guides

I have been a Linux user for over 5 years now. Starting with the server side of things, with switching to the Linux desktop in 2021.

As someone who regularly surfs the web for Linux troubleshooting and software install guides, I have noticed a trend that I believe should be stopped.

That trend, is including "sudo" in copy-paste commands in guide articles.

Stop including sudo

Sudo allows you to run a command as superuser, giving the command the ability to access things only root users can access. With that in mind, sudo should only be used sparingly and only when required. It should also only be used if you understand the command that you are running.

The new Linux user, and some long time Linux users, will just copy and paste the command they find in an article. While most commands will likely be safe, not all of them will be.

If someone gets into this habit, they could easily end up copying and pasting malicious code into their terminal.

If we all start to create guides without sudo included in the full commands, this could help limit potentially running malicious code with root permissions.

Now, I know this will not prevent it completely, but adding that little extra step may cause some users to second check what they are running.

What should we do instead?

Instead of adding sudo into the command, we should include a little message at the beginning of the guide stating that sudo may be required for some or all of the commands.

You should then include a link that explains sudo for those who may be unsure what sudo actually is.

Something like...

This way, new users can learn about sudo, while also learning that sudo should only be used if absolutely required.

The message is brief, and it gives a quick explanation of the requirement of sudo, as well as a link to a location that explains what sudo is.

Closing remarks

As mentioned previously, this will not completely solve the malicious code example I mentioned. It could help prevent it, but users could just end up getting into the habit of including sudo in front of every command.

What I hope is that by utilizing the above methods, it teaches new Linux users the importance of sudo and how powerful it is, and hopefully get them to be more wary of what they are running in their terminal.

With that being said, none of my guides will have sudo in the commands. I will include a message similar to the above in all of those guides, and I will do my best to answer any questions in the comment section of those posts, if people mention that the direct copy and paste does not work.

#Linux