Closed Captioning Closed captioning available on our YouTube channel

How to use the sudo command: 2-Minute Linux Tips

Network World | Sep 13, 2019

Learn how to use the sudo command. It’s a very important command for Linux security because it provides a way for individual users to run specific commands with the authority of root.

Similar
Hi, this is Sandra Henry-Stocker, author of the “Unix as a Second Language” blog on NetworkWorld.
In this Linux tip, we’re going to look at the sudo command (which you might hear people say as su-due or su-dough). It’s a very important command for Linux security because it provides a way for individual users to run specific commands with the authority of root.
You must have privileges configured in the /etc/sudoers file to use sudo or be included in a group such as the admin group that on many systems is given sudo privileges by default.
Here’s a simple example:
If you see this output, you will know that you’re allowed to run commands as root using sudo. This output says that, when we run the whoami command using sudo, we are root. Let’s try something else:
This output shows that we can’t look at the /etc/sudoers file. Try it with sudo and we can:
The !! represents the previous command, so we’re running the head command that just failed using sudo and seeing the top of the sudoers file.
The reasons that sudo is important are that 1) it provides a way to limit the commands that users can run using root privileges and 2) it encourages sysadmins to use root authority only when they need it rather than simply logging into the root account and doing all of their work that way. In these ways, sudo reduces the chances of system abuse and the impact of mistyped commands.
That’s your Linux tip for sudo. If you have questions or would like to suggest a topic, please add a comment below. And don’t forget to subscribe to the IDG Tech(talk) channel on YouTube.
If you liked this video, please hit the like and share buttons. For more Linux tips, be sure to follow us on Facebook, YouTube and NetworkWorld.com.
Popular
Featured videos from IDG.tv