1
00:00:00,000 --> 00:00:18,280
Hey guys and welcome back. So in the previous nugget I got ahead of myself and we're not

2
00:00:18,280 --> 00:00:22,640
exactly going to look at the boot scripts quite just yet. In fact what we're briefly

3
00:00:22,640 --> 00:00:28,519
going to look at is how we can manually change and set the run levels via the command line

4
00:00:28,519 --> 00:00:33,399
ourselves. So the command that we're going to be looking at or should I say the commands

5
00:00:33,399 --> 00:00:39,359
is going to be the init command as well as the tell init command. Now these commands

6
00:00:39,359 --> 00:00:45,640
like I say are based on sysv init therefore they are deprecated in modern systems. So

7
00:00:45,640 --> 00:00:51,960
these two commands whilst we can actually issue them on modern system d based systems

8
00:00:51,960 --> 00:00:57,480
like I say they are deprecated we are just exploring them for the purposes of the examination.

9
00:00:57,479 --> 00:01:03,199
So the first command here is the init command we know this is the init process and tell init

10
00:01:03,199 --> 00:01:08,120
is the other option. Now the first thing I will say is that both of these commands will

11
00:01:08,120 --> 00:01:14,039
work and both will ultimately do the same thing. However it is an accepted best practice

12
00:01:14,039 --> 00:01:20,159
to use the tell init command so whilst you can get away with actually typing init it

13
00:01:20,159 --> 00:01:26,120
is not the recommended way to handle this process. So the first thing I'm going to do

14
00:01:26,320 --> 00:01:32,439
is I'm going to show you one command which can identify to us the current run level we

15
00:01:32,439 --> 00:01:37,880
are using so what I will do here is I will just full screen this and the command that

16
00:01:37,880 --> 00:01:43,719
we can use to identify the current run level as well as the previous run level the system

17
00:01:43,719 --> 00:01:50,760
is using is quite simply the run level command if I just hit enter we can see the value n

18
00:01:50,760 --> 00:01:55,920
and then the value 5 now we are seeing the value n because previously the system was

19
00:01:55,920 --> 00:02:01,640
shut down and the value on the right here is the current run level so we see run level

20
00:02:01,640 --> 00:02:08,480
5 we talked about what run level 5 happens to be this is a multi user mode it has networking

21
00:02:08,480 --> 00:02:14,200
and of course as we can see here we have the graphical user interface so we can click about

22
00:02:14,199 --> 00:02:21,599
all the icons we can drag and drop so on so forth so if I want to modify this particular

23
00:02:21,599 --> 00:02:26,719
run level I've got two options like I say I can say init and then specify a run level

24
00:02:26,719 --> 00:02:33,359
such as run level 0 which we know is the value to shut down but like I say we want to be

25
00:02:33,359 --> 00:02:38,000
using the tell init command so what I could do here is I could say tell init and I could

26
00:02:38,000 --> 00:02:44,639
change it to maybe say run level 3 now you may recall if we do tell init 3 I'm going

27
00:02:44,639 --> 00:02:50,680
to have to type in my passwords and to enter oh looks like I typed in the wrong password

28
00:02:50,680 --> 00:02:56,039
try this again there we go now we're going to reload we will lose our graphical user

29
00:02:56,039 --> 00:03:01,920
interface and we will ultimately drop into multi user mode without the graphical user

30
00:03:01,920 --> 00:03:07,960
interface now because of virtual box what we're doing is experiencing a little bit of a problem

31
00:03:07,960 --> 00:03:14,120
if I press control alt and F1 we should actually see our login page so we can see here ipv0

32
00:03:14,120 --> 00:03:22,560
login type in my username and my password to enter and notice now I have my Linux terminal

33
00:03:22,560 --> 00:03:28,400
but I no longer have a graphical user interface this would be a very common setting for a

34
00:03:28,400 --> 00:03:35,400
server very low on resources no real demands and a much smaller attack surface however

35
00:03:35,400 --> 00:03:40,240
like I say if we actually run the run level command we can now see even though it's pretty

36
00:03:40,240 --> 00:03:45,280
small the current run level on the right is the value 3 and the one on the left was the

37
00:03:45,280 --> 00:03:50,280
one that was before the value 5 so if we want to restore the system to be the way it was

38
00:03:50,280 --> 00:03:56,040
before we can say tell init 5 if I hit enter and in this case we have to use support user

39
00:03:56,040 --> 00:04:02,240
privileges also tell init 5 with the sudo command have to type in the old password there we go

40
00:04:02,360 --> 00:04:07,760
and try again now we're going to reload and we are presented again with our graphical user

41
00:04:07,760 --> 00:04:13,280
interface and we can go back in login got to the top here I'll go into my terminal emulator

42
00:04:13,280 --> 00:04:20,120
I will say run level and now this is inverted once again the current level is 5 the previous

43
00:04:20,120 --> 00:04:27,040
one was 3 now like I say we can also use the init command even though it is not recommended

44
00:04:27,160 --> 00:04:33,720
if I said init 6 we know this would be the run level for a reboot if I just hit enter

45
00:04:33,720 --> 00:04:38,720
now we're going to reboot the system is beginning to reload just give it a little minute or

46
00:04:38,720 --> 00:04:45,120
two and the system has rebooted let me just log in type in my password there we go and

47
00:04:45,120 --> 00:04:51,759
now we are back if I click my icon up here go to my terminal emulator I say run level

48
00:04:51,759 --> 00:04:57,000
we can see we have the value n again because the system was rebooted and our current run

49
00:04:57,000 --> 00:05:02,879
level again is 5 and again if we wanted to shut down the system I could use the command

50
00:05:02,879 --> 00:05:09,040
tell init and what would be the run level to shut down the system or to halt the system

51
00:05:09,040 --> 00:05:14,839
as the terminology goes we can use run level 0 so if we hit enter it will shut down the

52
00:05:14,839 --> 00:05:20,199
system and it will fully close so we can use these commands the init command or the tell

53
00:05:20,199 --> 00:05:26,480
init command to ultimately perform these tasks by specifying a particular run level i.e.

54
00:05:26,960 --> 00:05:31,280
0 all the way through to 6 but the recommended way is to use the tell init command the way

55
00:05:31,280 --> 00:05:36,640
I like to remember this is by thinking that you are telling the init process what run

56
00:05:36,640 --> 00:05:41,680
level to actually use and if we want to verify our current run level and the previous run

57
00:05:41,680 --> 00:05:48,080
level we do also have that run level command ok doc so that is us for being able to manually

58
00:05:48,080 --> 00:05:52,840
change the run level of our system now let's begin to talk about these boot scripts and

59
00:05:52,879 --> 00:05:56,560
that's what we will be doing in the very next nuggets i hope this has been informative for

60
00:05:56,560 --> 00:05:58,519
you and i'd like to thank you for viewing

