1
00:00:03,180 --> 00:00:07,220
Now let's find out how to actually use this user command.

2
00:00:07,440 --> 00:00:12,300
Again since it's a file on the file system we know we can use the man subsystem to get some information

3
00:00:12,300 --> 00:00:14,430
and help on this particular command.

4
00:00:16,820 --> 00:00:22,500
Briefly the user Dell command deletes a user account and related files.

5
00:00:22,680 --> 00:00:26,430
We look forward here to the dash f option.

6
00:00:26,450 --> 00:00:32,060
It stands for force and it removes the account even if the user is logged in.

7
00:00:32,150 --> 00:00:34,420
And it also deletes the user's home directory.

8
00:00:34,460 --> 00:00:40,400
Even if that home directory is shared with another user normal user accounts don't share the same home

9
00:00:40,400 --> 00:00:42,390
directories usually or they shouldn't.

10
00:00:42,560 --> 00:00:47,690
But in some cases you might have multiple application accounts that share the same home directory.

11
00:00:47,690 --> 00:00:52,970
Here's a little note here that says to use caution when using this option.

12
00:00:53,230 --> 00:00:55,690
Now let's keep looking through the options here.

13
00:00:55,700 --> 00:01:01,640
The dash r option is the one that we're most interested in as it removes the user's home directory.

14
00:01:01,640 --> 00:01:03,830
So let's try out this user Dell command.

15
00:01:03,920 --> 00:01:10,640
First let's look at some users on our local system here will do tell at sea password and we can see

16
00:01:10,640 --> 00:01:17,570
we have Einstein Isaac t Edison J Locke et cetera and these are all accounts that were created through

17
00:01:17,570 --> 00:01:23,200
previous exercises and through some of my previous work I've been doing on this virtual machine.

18
00:01:23,270 --> 00:01:30,610
So if we do this let's delete the Einstein user pseudo user Del Einstein and hit enter.

19
00:01:30,980 --> 00:01:37,400
Now if we run ID against the Einstein user it will say hey there is no Einstein user available.

20
00:01:37,460 --> 00:01:40,390
So sure enough the user DEL command got rid of Einstein.

21
00:01:40,560 --> 00:01:42,860
And let's look in the home directory.

22
00:01:42,860 --> 00:01:48,110
So this really prove to us that running user Dell without any options removes the user but leaves their

23
00:01:48,110 --> 00:01:54,080
files because you can see here the Einstein directory is still listed in for home.

24
00:01:54,290 --> 00:01:59,960
This might come in handy if you want access to a user's files after they have been removed.

25
00:01:59,960 --> 00:02:01,430
Now there's something else to notice here.

26
00:02:01,430 --> 00:02:06,940
Notice that the user and group for the Einsteins home directory are actually numbers.

27
00:02:06,950 --> 00:02:13,320
This is because there is no account associated with UAD 1001 any longer because we deleted that account.

28
00:02:13,490 --> 00:02:17,540
They had the ID of 1001 which is the Einstein account.

29
00:02:17,540 --> 00:02:23,600
So if you ever run an ls command and see numbers where you would normally see a user then know that

30
00:02:23,600 --> 00:02:30,680
you're looking at a UI ID Orji ID and that there is no account associated with that particular ID or

31
00:02:30,920 --> 00:02:31,930
ID.

32
00:02:31,940 --> 00:02:36,200
So while we're talking about you IDs let's look at a couple of users.

33
00:02:36,230 --> 00:02:39,190
The root user always has the idea of zero.

34
00:02:39,190 --> 00:02:45,440
So if we do ideaspace DSU which returns a user id follow that with the root account we should always

35
00:02:45,440 --> 00:02:47,040
get back zero.

36
00:02:47,060 --> 00:02:52,010
Now there are some other accounts on the system that are considered to be system accounts or application

37
00:02:52,010 --> 00:02:52,850
accounts.

38
00:02:52,850 --> 00:02:55,010
Let's look at another one of those.

39
00:02:55,010 --> 00:02:58,210
Let's look at the as each account here.

40
00:02:58,340 --> 00:03:02,240
It has an ID or user id of 74.

41
00:03:02,240 --> 00:03:06,030
Now let's look at the ID for our current vagrant user.

42
00:03:06,290 --> 00:03:08,120
It has a new idea of 1000.

43
00:03:08,270 --> 00:03:11,600
As you saw earlier Einstein has a new idea of 1001.

44
00:03:11,690 --> 00:03:17,290
So I don't know if you notice a pattern here but really system accounts have lower you IDs.

45
00:03:17,300 --> 00:03:22,610
This is actually set in a file called log in daat deaths and that's located in SC.

46
00:03:22,610 --> 00:03:24,630
So let's just look at that really quickly.

47
00:03:28,970 --> 00:03:31,760
A page down here until we get here.

48
00:03:31,940 --> 00:03:34,520
Here we see you I.D. men you I.D. man.

49
00:03:34,530 --> 00:03:39,840
So these are the minimum and maximum values for automatic selection and user add.

50
00:03:39,900 --> 00:03:46,170
So when you create the very first user on a Linux system it's going to have a user id of 1000.

51
00:03:46,170 --> 00:03:50,610
And by the way that is the user id of our bigger user because that was the first account created on

52
00:03:50,610 --> 00:03:51,480
the system.

53
00:03:51,540 --> 00:03:55,230
Then the next time we enter an account the number will get incremented by 1.

54
00:03:55,230 --> 00:03:59,940
So Einstein was the next account that was created so it had a new idea of 1001 so on.

55
00:04:00,210 --> 00:04:05,260
By the way if you look below this you see sis you I.D. men and you ID Max.

56
00:04:05,280 --> 00:04:11,550
This means that the maximum user ID for a system account or what's considered a system account is nine

57
00:04:11,550 --> 00:04:16,810
hundred and ninety nine if you want to make sure that you're not deleting a very important account.

58
00:04:16,920 --> 00:04:23,940
Perhaps it's a good idea to check your ID first if it's less than 1000 then clearly be careful of what

59
00:04:23,940 --> 00:04:28,190
you're doing because it could operate a service that you may need on your server.

60
00:04:28,500 --> 00:04:34,830
Ok let's jump out of here and let's move on to our next user id dash you Isaac.

61
00:04:34,980 --> 00:04:41,300
This user has a new idea of 1002 let's delete this user but this time remove its home directory.

62
00:04:44,670 --> 00:04:45,100
All right.

63
00:04:45,100 --> 00:04:50,720
If we try to get the user id of the user again it says now it's deleted it's gone there is no such user.

64
00:04:50,950 --> 00:04:56,340
And if we look for a home directory for this user it doesn't exist.

65
00:04:56,350 --> 00:05:01,690
So again that proves the dash or option removes the home directory and all the files that were within

66
00:05:01,750 --> 00:05:03,280
that home directory as well.
