Categories
Linux Tutorial Series

Linux Tutorial Series – 46 – The sudo command

To refresh your memory, let me remind you that in Linux there are two kinds of users – regular users and superusers.

What is the difference? The superuser is able to do more than the regular user, basically. If you attempt to do some things as a regular user, which you don’t have permissions for, you will not be allowed to do that. Permissions are a topic for a different post, but you can think of the difference between the regular user and the superuser as follows – both regular users and superusers are in a club. Superuser is in the VIP section and regular users are in the “normal” section. Superusers can walk from VIP to the “normal” section and reverse, but regular users can’t get to VIP, because bouncers would ask them for the “special bracelet” and they wouldn’t have it, so they would not be allowed in the VIP section.

The sudo command allows regular users to execute commands which require superuser permissions. More technically, the sudo command allows you to execute commands as some other user, but in most cases that user is the superuser. (Shotts, 2019)⁠ The syntax is as follows:

sudo someCommand

Basically, you prefix whatever you want to run with sudo. Then you will be prompted for your password and once you enter it, voila – you have executed the command as the superuser.

Why isn’t everyone the superuser? Fair question. There are two answers which make sense:

  • If multiple people are using the computer, then one person (the most responsible person) should be the superuser (the administrator) and others should just be regular users in order not to mess something up
  • Ever heard that Linux is pretty secure (as in, not a lot of viruses)? Well, that is because of the separation of superusers and regular users. Even if you download a certain malware (malware is a malicious program that tries to do harm to your computer), if you are a regular user, the malware won’t be able to execute all of the commands and access all files on your computer and therefore the damage will not be as devastating as if you were the superuser. Think of it like this – if a fight breaks out in our imaginary club (call it “The Penguin’s Hideout”), if it breaks out on the “normal” section there will be some damage, but not much. However, if there is a fight in the VIP section, oh boy! All of those expensive bottles of champagne and the crystal vases and the wonderful decoration are destroyed. Same as what happens in the computer.

Hope you found this useful!

References

Shotts, W. (2019). The Linux Command Line, Fifth Internet Edition. Retrieved from http://linuxcommand.org/tlcl.php. Pages 127-128

NewsletterUpdates on interesting things I am doing

Subscribe to my newsletter to keep abreast of the interesting things I'm doing. I will send you the newsletter only when there is something interesting. This means 0% spam, 100% interesting content.

Leave a Reply

Your email address will not be published.