1
00:00:06,559 --> 00:00:08,460
In this lesson, you'll learn
how to work with sudo.

2
00:00:09,220 --> 00:00:13,644
Why do we need sudo? It's
all about using administrative privileges on

3
00:00:13,644 --> 00:00:18,070
Linux. By default, you always have
a user with the name root.

4
00:00:19,010 --> 00:00:22,710
This user is really unrestricted.
Permissions don't apply for the user

5
00:00:22,710 --> 00:00:26,410
root, and for that reason
you should avoid working as root.

6
00:00:27,800 --> 00:00:33,060
Sudo allows authorized users to
run tasks with escalated privileges.

7
00:00:34,259 --> 00:00:40,200
And to use it, you use sudo followed by the
command that you want to use, like sudo LS root.

8
00:00:42,939 --> 00:00:47,024
Not everybody can use sudo to
allow sudo usage. Users must be

9
00:00:47,024 --> 00:00:51,109
a member of the sudo
group, and different sudo groups exist.

10
00:00:51,609 --> 00:00:56,219
On Red Hat, the name of that group is wheel,
and on Ubuntu, the name of that group is sudo.

11
00:00:57,289 --> 00:01:02,049
Sudo configurations can be created to
allow users to perform specific tasks only.

12
00:01:02,710 --> 00:01:08,819
That's something we won't cover here, but let me
show you how to use sudo as an administrative user.

13
00:01:09,540 --> 00:01:13,120
Okay, so I'm going to start
this demo by typing who am I?

14
00:01:13,640 --> 00:01:17,849
Who am I? Showing your current
username and my current username is student.

15
00:01:18,950 --> 00:01:24,594
I'm also typing the ID command because the ID
command is showing a list of groups that the

16
00:01:24,594 --> 00:01:30,239
user is a member of, and that reveals that
user student is a member of the group wheel.

17
00:01:30,980 --> 00:01:32,340
And that's all that
I needed to know.

18
00:01:32,879 --> 00:01:37,980
So let's do a quick test.
Let me use LS l root.

19
00:01:38,579 --> 00:01:43,170
This is trying to show a long
listing of else in the directory root.

20
00:01:43,810 --> 00:01:47,230
The directory root happens to
be the user root home directory.

21
00:01:47,969 --> 00:01:51,469
And as an ordinary user, you
don't get access to that directory.

22
00:01:52,579 --> 00:01:57,000
But if I'm repeating my
previous command and I'm putting

23
00:01:57,000 --> 00:02:01,420
sudo in front of the
command, look at what's happening.

24
00:02:02,680 --> 00:02:08,009
It is prompting for the password for user student.
I'm entering my password and there we can see all

25
00:02:08,009 --> 00:02:13,339
the files. Well, it's just one, but still all
the files in the home directory of user root.

26
00:02:14,150 --> 00:02:19,430
So when you put sudo in front of a
command, then you run it with super user privileges.

27
00:02:19,430 --> 00:02:24,710
But the important thing to realize is that this
only works if you are authorized to use sudo.
