1
1

00:00:00,620  -->  00:00:02,480
<v Jose>Hi guys, and welcome back.</v>
2

2

00:00:02,480  -->  00:00:04,580
Now that we've logged into our server
3

3

00:00:04,580  -->  00:00:06,760
and changed your root password,
4

4

00:00:06,760  -->  00:00:08,250
you will be greeted with something
5

5

00:00:08,250  -->  00:00:10,010
that looks more or less like this.
6

6

00:00:10,010  -->  00:00:12,170
What we've got here is our user
7

7

00:00:12,170  -->  00:00:14,530
which is called root at the moment,
8

8

00:00:14,530  -->  00:00:17,270
and root user is, traditionally in Linux,
9

9

00:00:17,270  -->  00:00:20,870
the main user or the administrator user,
10

10

00:00:20,870  -->  00:00:23,410
and then, you've got your Droplet name,
11

11

00:00:23,410  -->  00:00:25,290
and this says that you are the root user
12

12

00:00:25,290  -->  00:00:27,620
at your Droplet name.
13

13

00:00:27,620  -->  00:00:30,080
Then you've got your colon which separates all of that
14

14

00:00:30,080  -->  00:00:34,423
from where you currently are located inside the server.
15

15

00:00:35,330  -->  00:00:37,970
As you know, computers have folders,
16

16

00:00:37,970  -->  00:00:42,840
and when you're in a terminal, you can be inside a folder.
17

17

00:00:42,840  -->  00:00:45,020
Indeed, you have to be inside a folder,
18

18

00:00:45,020  -->  00:00:46,720
and at the moment, we are inside a folder
19

19

00:00:46,720  -->  00:00:48,260
called squiggly line,
20

20

00:00:48,260  -->  00:00:52,180
and this folder is the user's home folder.
21

21

00:00:52,180  -->  00:00:56,090
Think of it as where your documents will be and so on.
22

22

00:00:56,090  -->  00:00:58,290
So if you do pwd,
23

23

00:00:58,290  -->  00:01:02,440
you will see that the root user's home folder
24

24

00:01:02,440  -->  00:01:05,790
is located at /root.
25

25

00:01:05,790  -->  00:01:09,500
The pwd tells you the working directory,
26

26

00:01:09,500  -->  00:01:11,310
and that is where we currently are.
27

27

00:01:11,310  -->  00:01:12,770
Finally, the hash symbol at the end
28

28

00:01:12,770  -->  00:01:14,910
tells you that you have reached the end
29

29

00:01:14,910  -->  00:01:16,440
of the identifying information,
30

30

00:01:16,440  -->  00:01:18,490
and now you can start typing if you like.
31

31

00:01:19,360  -->  00:01:22,020
So that's why we type here at the end.
32

32

00:01:22,020  -->  00:01:24,223
So we are in /root.
33

33

00:01:25,290  -->  00:01:27,920
You can type ls, and that will tell you
34

34

00:01:27,920  -->  00:01:31,310
the things that are inside your folder at the moment.
35

35

00:01:31,310  -->  00:01:34,730
You can do cd, and that means change directory,
36

36

00:01:34,730  -->  00:01:37,170
and you can type two dots to go to the folder
37

37

00:01:37,170  -->  00:01:39,280
that contains this folder.
38

38

00:01:39,280  -->  00:01:41,260
So you can type cd dot dot,
39

39

00:01:41,260  -->  00:01:43,220
and that goes to the parent folder,
40

40

00:01:43,220  -->  00:01:44,800
and now, if you type ls,
41

41

00:01:44,800  -->  00:01:48,160
you'll see that root is one of the folders
42

42

00:01:48,160  -->  00:01:50,670
that was contained inside the parent,
43

43

00:01:50,670  -->  00:01:52,850
of course, as it should be.
44

44

00:01:52,850  -->  00:01:55,530
Now, also notice that this path here
45

45

00:01:55,530  -->  00:01:59,150
has changed from squiggly line, which means the home folder,
46

46

00:01:59,150  -->  00:02:03,100
to slash, which means the root folder of the server
47

47

00:02:03,100  -->  00:02:05,403
or the top level folder.
48

48

00:02:06,860  -->  00:02:09,380
Now, you can change it to any other folder and so on,
49

49

00:02:09,380  -->  00:02:13,810
but to be honest, navigating the server as the root user
50

50

00:02:13,810  -->  00:02:15,800
is quite a dangerous thing to be doing,
51

51

00:02:15,800  -->  00:02:17,670
and you should not do that.
52

52

00:02:17,670  -->  00:02:19,780
The reason for it is because if you're the root user,
53

53

00:02:19,780  -->  00:02:21,760
you have access to do whatever you want,
54

54

00:02:21,760  -->  00:02:25,560
and that can include accidentally deleting important things
55

55

00:02:25,560  -->  00:02:29,090
or moving things around that you don't wanna be moving.
56

56

00:02:29,090  -->  00:02:32,120
So you should almost never be the root user
57

57

00:02:32,120  -->  00:02:34,520
when you are working in a UNIX machine.
58

58

00:02:34,520  -->  00:02:36,670
You should almost always be a user
59

59

00:02:36,670  -->  00:02:37,930
that you want it to have access
60

60

00:02:37,930  -->  00:02:41,150
to a certain number of things but not others,
61

61

00:02:41,150  -->  00:02:44,900
and that is just for security through separation.
62

62

00:02:44,900  -->  00:02:47,260
So for the purposes of this section,
63

63

00:02:47,260  -->  00:02:50,570
we're gonna create a user inside our machine
64

64

00:02:50,570  -->  00:02:51,970
that is not root
65

65

00:02:51,970  -->  00:02:54,853
and that will be dealing with deployments only.
66

66

00:02:55,690  -->  00:02:58,770
I'm gonna call this user jose,
67

67

00:02:58,770  -->  00:03:00,690
but you can call it whatever you want.
68

68

00:03:00,690  -->  00:03:01,890
In order to create a user,
69

69

00:03:01,890  -->  00:03:05,240
we're gonna do adduser and then jose.
70

70

00:03:05,240  -->  00:03:06,660
That creates a new user.
71

71

00:03:06,660  -->  00:03:08,550
It creates a new group for them.
72

72

00:03:08,550  -->  00:03:10,760
Groups in UNIX are just for permissions.
73

73

00:03:10,760  -->  00:03:12,690
You don't have to worry too much about them just yet,
74

74

00:03:12,690  -->  00:03:15,290
and then, it asks us to enter a password.
75

75

00:03:15,290  -->  00:03:17,470
So I've created a password for this user,
76

76

00:03:17,470  -->  00:03:20,250
and I've put it up in my password manager,
77

77

00:03:20,250  -->  00:03:22,020
so I'm just gonna put it in here,
78

78

00:03:22,020  -->  00:03:23,300
and there you have it.
79

79

00:03:23,300  -->  00:03:26,010
Then, you can also change the user information if you like,
80

80

00:03:26,010  -->  00:03:27,303
which I am going to do,
81

81

00:03:29,870  -->  00:03:30,770
and there we have it.
82

82

00:03:30,770  -->  00:03:32,570
I'm leaving some of these empty,
83

83

00:03:32,570  -->  00:03:34,780
and at the end, you'll see that it asks you
84

84

00:03:34,780  -->  00:03:35,857
whether the information is correct,
85

85

00:03:35,857  -->  00:03:39,030
and you can enter n if it's not correct,
86

86

00:03:39,030  -->  00:03:40,370
or you can enter nothing,
87

87

00:03:40,370  -->  00:03:42,290
and then it will be yes by default,
88

88

00:03:42,290  -->  00:03:44,220
and that is the convention in UNIX systems.
89

89

00:03:44,220  -->  00:03:45,350
You'll see it quite often.
90

90

00:03:45,350  -->  00:03:48,070
The uppercase letter is the default,
91

91

00:03:48,070  -->  00:03:50,670
and the lowercase letter is the one you have to type.
92

92

00:03:50,670  -->  00:03:51,700
So if you enter nothing,
93

93

00:03:51,700  -->  00:03:53,550
it will be the uppercase letter by default,
94

94

00:03:53,550  -->  00:03:55,840
which at this point is yes.
95

95

00:03:55,840  -->  00:03:58,760
Now that we've got our new account,
96

96

00:03:58,760  -->  00:04:01,390
we can go and log in as it,
97

97

00:04:01,390  -->  00:04:04,610
but first, we have to do a little bit more explaining.
98

98

00:04:04,610  -->  00:04:08,520
First of all, what is adduser and where does it come from?
99

99

00:04:08,520  -->  00:04:11,760
Well, adduser is actually some programme
100

100

00:04:11,760  -->  00:04:14,260
that is stored inside our server.
101

101

00:04:14,260  -->  00:04:16,884
As you can see, we typed adduser,
102

102

00:04:16,884  -->  00:04:19,370
and our server was able to find the programme
103

103

00:04:19,370  -->  00:04:20,803
that adds a user.
104

104

00:04:23,400  -->  00:04:26,690
You can find out where the programme is exactly
105

105

00:04:26,690  -->  00:04:29,660
by typing which and then the name of the programme.
106

106

00:04:29,660  -->  00:04:31,600
So I'm gonna type which adduser,
107

107

00:04:31,600  -->  00:04:34,440
and you'll see that adduser is actually inside
108

108

00:04:34,440  -->  00:04:38,690
this usr/sbin folder.
109

109

00:04:38,690  -->  00:04:41,160
So the complete path to the adduser programme
110

110

00:04:41,160  -->  00:04:44,373
is /usr/sbin/adduser.
111

111

00:04:45,560  -->  00:04:48,440
So how did our server find it there?
112

112

00:04:48,440  -->  00:04:51,650
Does it know about /usr/sbin?
113

113

00:04:51,650  -->  00:04:53,570
And the answer is yes.
114

114

00:04:53,570  -->  00:04:55,090
We're going to type echo,
115

115

00:04:55,090  -->  00:04:57,330
which is used to print something out to the console,
116

116

00:04:57,330  -->  00:04:59,133
and then, $PATH,
117

117

00:05:00,180  -->  00:05:03,730
and what you see here is all the different folders
118

118

00:05:03,730  -->  00:05:06,690
that our system is going to be looking into
119

119

00:05:06,690  -->  00:05:09,140
in order to find programmes when it doesn't know
120

120

00:05:09,140  -->  00:05:10,330
what the programme is.
121

121

00:05:10,330  -->  00:05:14,190
So adduser, when you type it into your terminal
122

122

00:05:14,190  -->  00:05:15,640
like we've up here,
123

123

00:05:15,640  -->  00:05:17,290
the system doesn't know what it is,
124

124

00:05:17,290  -->  00:05:20,210
so it will begin looking into all of these folders.
125

125

00:05:20,210  -->  00:05:25,210
It will begin by looking into usr/local/sbin.
126

126

00:05:25,650  -->  00:05:28,260
Then it will look into usr/local/bin.
127

127

00:05:28,260  -->  00:05:30,070
Then usr/sbin and so on,
128

128

00:05:30,070  -->  00:05:32,730
and you can see all these paths are separated by colons.
129

129

00:05:32,730  -->  00:05:37,210
So the PATH variable is a list of paths
130

130

00:05:37,210  -->  00:05:39,770
where the system will look for programmes
131

131

00:05:39,770  -->  00:05:42,120
when it's not sure which one to use,
132

132

00:05:42,120  -->  00:05:44,790
and it will use the one that it finds first.
133

133

00:05:44,790  -->  00:05:48,530
So if adduser was inside usr/local/sbin,
134

134

00:05:48,530  -->  00:05:51,120
it would use that adduser.
135

135

00:05:51,120  -->  00:05:53,370
However, in this case, it was in usr/sbin,
136

136

00:05:53,370  -->  00:05:57,090
so it went all the way down to here before finding it.
137

137

00:05:57,090  -->  00:06:00,060
Now that we've got our new user and we have a password,
138

138

00:06:00,060  -->  00:06:02,430
we can go ahead and change some configuration settings
139

139

00:06:02,430  -->  00:06:04,410
in order to allow it to log in.
140

140

00:06:04,410  -->  00:06:06,010
Let's do that in the next video.
