WEBVTT 00:00.600 --> 00:05.340 Please go to EliTheComputerGuy.com in order to view schematics, code, 00:05.440 --> 00:08.480 and more for the projects that you are learning about. 00:09.780 --> 00:10.680 Welcome back. 00:10.740 --> 00:15.500 So in today's video I'm going to show you how to add users, how to delete users, 00:15.520 --> 00:18.340 and then how to modify user profiles. 00:18.480 --> 00:21.440 So doing things like changing passwords for users. 00:21.640 --> 00:25.840 Now the important thing to understand in the Linux world is that doing these types 00:25.840 --> 00:32.240 of tasks in the Linux world only seem complicated because it's so much simpler 00:32.240 --> 00:33.560 than the Windows world. 00:33.880 --> 00:37.820 So if you're used to dealing with Windows administration, especially in an Active 00:37.820 --> 00:42.940 Directory environment, there are so many amazing things that you can do with user 00:42.940 --> 00:44.740 accounts in the Windows world, right? 00:45.020 --> 00:47.700 And so when you go to Linux, you're expecting to be able to do all those 00:47.700 --> 00:51.860 amazing things in Linux, and then you think you just don't know how to do it, 00:51.860 --> 00:54.060 and then you get frustrated, and then you give up. 00:54.380 --> 00:59.620 The reality is that in the Linux world, basically how users work, how groups work, 00:59.660 --> 01:04.480 and how permissions work is a hell of a lot simpler than the Windows world. 01:04.800 --> 01:09.540 So if you overthink it, if you try to make it more complicated than it actually is, 01:09.840 --> 01:12.540 that is going to run you into problems. 01:12.880 --> 01:15.520 So I'm going to show you how to use the add user command. 01:15.640 --> 01:19.420 So basically using the add user command allows you to add users to the system. 01:19.600 --> 01:23.060 I'm going to show you how to change passwords, so how to change your own 01:23.060 --> 01:25.720 password, and how to change passwords for somebody else. 01:25.860 --> 01:31.380 I'm going to show you something called the password file or the password file in the 01:31.380 --> 01:32.440 ETC directory. 01:32.660 --> 01:36.900 This actually contains all of your user accounts, so you can go there and see what 01:36.900 --> 01:38.740 users are in your Linux system. 01:39.220 --> 01:42.100 So you can make sure if they're there or if they need to be removed. 01:42.840 --> 01:46.620 I can show you how to use something called a chfn command. 01:46.800 --> 01:50.040 So basically what this is going to do is it's going to allow you to change the 01:50.040 --> 01:52.640 profile of the user within Linux. 01:52.740 --> 01:54.580 I'm going to show you something called usermod. 01:54.660 --> 01:58.060 We're not actually going to use usermod today, but usermod is a nice little 01:58.060 --> 02:01.220 command that allows you to do things such as lock user accounts. 02:01.460 --> 02:02.740 So that might be useful for you. 02:03.280 --> 02:05.540 Then I'm going to show you how to delete a user. 02:05.940 --> 02:08.880 And then one of the important things, a cleanup task, is I'm going to show you 02:08.880 --> 02:14.180 then how to remove the user profile directory that is created when Linux 02:14.180 --> 02:16.240 creates a profile to begin with. 02:16.500 --> 02:19.920 This is one of those important things that again this can become one of those 02:19.920 --> 02:26.360 maintenance issues where when you create a user account in Linux, it creates a folder 02:26.360 --> 02:31.960 for the profile in the home directory with all the profile information. 02:32.440 --> 02:35.940 One of the weird things in the Linux world, kind of like not really sure why 02:35.940 --> 02:40.020 that happens, I suppose that there's a reason, is that when you delete the user 02:40.020 --> 02:43.880 account it doesn't even give you an option for deleting that profile directory. 02:44.480 --> 02:48.940 So you simply have to go and then actually remove the directory manually to make sure 02:48.940 --> 02:54.280 you don't get bogged up with a whole bunch of old user directories that aren't of any 02:54.280 --> 02:54.960 value anymore. 02:55.160 --> 02:57.760 So with that, let's go over to the computer and we'll show you how these 02:57.760 --> 02:59.260 commands work in the Linux world. 02:59.680 --> 03:04.500 And again, the important thing to remember here is that Linux when it comes to users 03:04.500 --> 03:08.980 is a lot easier, a lot more simple than the Windows world. 03:09.360 --> 03:12.400 So if you're running into problems, the issue most likely is you're 03:13.120 --> 03:13.920 overthinking things. 03:14.340 --> 03:17.780 And so just try to roll it back a bit, try to think about doing things a little 03:17.780 --> 03:21.420 bit more simply, and you'll most likely be able to figure out what you need to do. 03:21.540 --> 03:25.000 So with that, let's go over to the machine and I'll show you how this works. 03:25.840 --> 03:27.460 So here we are at my Ubuntu server. 03:27.540 --> 03:34.320 Again, we're using 18.04.3 for this demonstration, but add user has basically 03:34.320 --> 03:38.680 been the same for decades and will most likely be the same for another decade or 03:38.680 --> 03:38.880 two. 03:39.040 --> 03:43.020 So you really shouldn't run into any issues if you're using a different version 03:43.020 --> 03:45.180 of the Ubuntu server operating system. 03:45.460 --> 03:46.600 So with that, I'm going to log in. 03:46.680 --> 03:50.480 So my main account that I've been using is this account called Bob and the password 03:50.480 --> 03:54.920 is 1-2-3-4-5-6 because that's what makes my life better. 03:55.120 --> 03:57.160 We log in and we get the normal screen. 03:57.300 --> 04:01.000 So what I'm going to do is I'm going to do clear to clear the screen so that we get 04:01.000 --> 04:02.540 back to a blank screen. 04:03.180 --> 04:06.400 So the first thing that I want to do here is I'm going to do an add user. 04:06.620 --> 04:09.260 So all I need to do is sudo, super user do. 04:09.420 --> 04:13.740 So we need to escalate our privileges up to that root level ability to do things. 04:14.100 --> 04:15.540 And then we're going to add user. 04:16.000 --> 04:17.360 Nice, nice, simple command. 04:17.500 --> 04:19.020 Nice, simple Linux command. 04:19.380 --> 04:21.880 You're going to add a user and the command is add user. 04:22.040 --> 04:24.200 You can't make it any more easy than that. 04:24.440 --> 04:26.540 And we are going to add a user. 04:27.060 --> 04:28.120 Let's say Tim. 04:28.220 --> 04:30.960 We're going to add the user Tim and then we're going to hit enter. 04:31.740 --> 04:34.140 So it's going to ask us this right here. 04:34.240 --> 04:37.060 We're asking for the password for Bob. 04:37.220 --> 04:40.880 So it is important when you're doing this you're going to be asked for passwords in 04:40.880 --> 04:41.560 different places. 04:42.080 --> 04:46.660 And so you do have to keep in mind what password they're asking for something. 04:46.820 --> 04:49.080 So for this they're asking for my password. 04:49.300 --> 04:52.460 And so my password is 1-2-3-4-5-6. 04:53.010 --> 04:53.680 Hit enter. 04:53.940 --> 04:59.040 So adding Tim has created the directory for Tim. 04:59.420 --> 05:00.200 So on and so forth. 05:00.300 --> 05:01.940 So here it's creating home directory. 05:02.540 --> 05:05.600 So Tim's profile directory is going to be home Tim. 05:06.140 --> 05:09.220 Then it's asking now enter new Unix password. 05:09.400 --> 05:12.500 At this point it's now asking for the password for Tim. 05:12.640 --> 05:14.360 What is Tim's password going to be? 05:14.720 --> 05:17.760 Again we're going to make this simple 1-2-3-4-5-6. 05:17.760 --> 05:21.580 Going to ask to retype 1-2-3-4-5-6. 05:22.240 --> 05:23.260 And we're going to hit enter. 05:23.440 --> 05:26.500 So from this point it asks us for some profile information. 05:26.940 --> 05:30.340 Now it is important here, depending on what you're doing with your particular 05:30.340 --> 05:32.440 server, you can leave this all blank. 05:32.700 --> 05:34.120 None of the rest of this matters. 05:34.200 --> 05:38.540 The only thing that really matters is the the username and the password. 05:38.840 --> 05:40.920 That is what is actually useful for Linux. 05:41.240 --> 05:44.660 The rest of this is basically little housekeeping things. 05:44.820 --> 05:48.860 So you know if you're building the server and these user accounts are actual 05:48.860 --> 05:52.220 employees in your company, you may want to plug in information here. 05:52.780 --> 05:56.580 But honestly again if this is simply a web server and you simply need a couple of 05:56.580 --> 06:00.620 user accounts in order to do different type of maintenance tasks, I would argue 06:00.620 --> 06:02.180 more or less to leave this blank. 06:02.360 --> 06:08.920 But we can do go here we can simply say this is Tim McCoolio. 06:09.960 --> 06:10.860 Tim McCoolio. 06:11.020 --> 06:12.260 That is his full name. 06:12.680 --> 06:14.720 Then it's going to ask for his room number. 06:14.720 --> 06:16.920 I'm going to make his room number 2. 06:17.380 --> 06:22.780 It's going to ask for his phone number 111-222-3333. 06:23.940 --> 06:28.840 Home phone number 222-333-4444. 06:30.140 --> 06:31.040 And then our other... 06:32.960 --> 06:35.400 hey mom... you know whatever other information. 06:35.820 --> 06:39.820 Again this is one thing if you do create a user account for things like services, 06:40.060 --> 06:43.400 something like that, in this other here you might actually want to just put a 06:43.400 --> 06:47.740 comment of hey this user account was created for email services, something like 06:47.740 --> 06:49.820 that, because that can be useful. 06:49.920 --> 06:54.360 Again one thing you have to be remembering whenever you build a Linux system, 06:54.480 --> 06:57.840 whenever you build anything for infrastructure, it's not about you 06:57.840 --> 06:58.720 maintaining it. 06:58.820 --> 07:01.300 It's not about whether you can maintain it a year or two from now. 07:01.420 --> 07:05.900 It's about when you leave the company or organization and somebody else has to come 07:05.900 --> 07:08.160 in behind you and figure out what the hell is going on. 07:08.260 --> 07:09.880 Can they know what's going on? 07:10.000 --> 07:14.300 So if you put a comment in here, again for any kind of user account you're 07:14.300 --> 07:18.380 creating for services, that can make their life a hell of a lot easier. 07:18.680 --> 07:22.480 Not to mention, I'll just put this in there, not to mention that a lot of times 07:22.480 --> 07:25.000 you forget things that you don't think you're going to forget. 07:25.260 --> 07:30.280 So three years from now when you come back to maintain this system, having put your 07:30.280 --> 07:33.900 own notes there might actually make it a little more helpful for you too. 07:34.080 --> 07:36.260 So anyways, the other is just simply for a note thing. 07:36.780 --> 07:37.660 We hit enter. 07:37.780 --> 07:39.160 Is this information correct? 07:39.280 --> 07:40.180 We hit yes. 07:40.720 --> 07:43.440 And then we simply go back to the prompt. 07:43.680 --> 07:46.000 So that's really all there is there. 07:46.200 --> 07:46.960 So we do clear. 07:47.740 --> 07:50.680 One of the things we can look at now is we can look at something called the password 07:50.680 --> 07:51.160 file. 07:51.760 --> 07:53.420 So we can do vim. 07:53.720 --> 07:54.800 So we're simply going to use vim. 07:54.960 --> 07:59.360 So I'm not doing sudo vim because I do not plan to edit the password file. 07:59.440 --> 08:00.100 That's an important thing. 08:00.160 --> 08:03.400 Remember, sudo vim will allow you edit the password file. 08:03.860 --> 08:05.980 For a lot of these files, I just simply use vim. 08:06.080 --> 08:08.020 It will open it up as a read-only. 08:08.200 --> 08:11.260 And again, this is something that can be useful just to make sure you don't fat 08:11.260 --> 08:11.980 finger something. 08:12.320 --> 08:17.180 If you open something as read-only, then if nothing else, you know you can't 08:17.180 --> 08:18.160 screw it up, right? 08:18.280 --> 08:19.960 So I'm going to open it up as read-only. 08:20.940 --> 08:24.580 So forward slash is the root directory. 08:25.760 --> 08:27.660 Etc is the folder under root. 08:27.920 --> 08:35.760 And then there's a file called passwd because of course it is. 08:36.080 --> 08:37.920 They can't just make it a password file. 08:38.060 --> 08:39.060 Don't be ridiculous. 08:40.020 --> 08:41.320 And then we're going to hit tab. 08:41.560 --> 08:45.420 And so we open this up and yay, we get a whole bunch of information here 08:45.420 --> 08:47.640 that probably looks like gobbledygook to you. 08:47.720 --> 08:52.500 But these are in fact all of the user accounts that are currently on this Linux 08:52.500 --> 08:52.920 system. 08:53.460 --> 08:55.840 And it gives you some information about these accounts. 08:55.960 --> 08:59.700 And again, one of the things you'll notice is daemon, bin, sys, games, lp, 08:59.800 --> 09:00.840 news, right? 09:00.940 --> 09:05.780 All of these user accounts are used for specific services in the Linux operating 09:05.780 --> 09:06.160 system. 09:06.740 --> 09:09.440 And so again, it is a good practice to think about that. 09:09.660 --> 09:15.000 If you create a specific user account to do a specific task, it makes it harder for 09:15.000 --> 09:16.400 the system to be hacked, right? 09:16.460 --> 09:22.240 Again, you think about it with hacking and basically hackers will use all the 09:22.240 --> 09:24.020 permissions that are given to something, right? 09:24.100 --> 09:27.800 So if you give one user account a whole bunch of permissions, again, that whole 09:27.800 --> 09:31.820 thing, if you give one user account root permissions to a server, then if a hacker 09:31.820 --> 09:34.700 can compromise that one root account, they basically own the server. 09:35.260 --> 09:41.060 The same is true with giving user accounts lesser permissions, right? 09:41.100 --> 09:47.140 If you give one user account permission over FTP and permission over, I don't 09:47.140 --> 09:51.460 know, SMTP and permission over a number of different things, then if a hacker can 09:51.460 --> 09:55.360 compromise that one account, then not only do they get access to FTP, but they also 09:55.360 --> 10:00.180 get access to SMTP and they might get access to MySQL and they might get access 10:00.180 --> 10:04.580 to enough things that they can then hack around and get access to the whole system. 10:04.920 --> 10:10.120 So if you create specific accounts to do specific tasks, that is one way to try to 10:10.120 --> 10:11.780 make the system a little bit more secure. 10:11.780 --> 10:14.220 But if we go down here, again, we can take a look. 10:14.400 --> 10:17.400 And so in blue, there's a light blue on the left hand side. 10:17.500 --> 10:19.480 These are the user names. 10:19.540 --> 10:22.220 These are the user names for the accounts. 10:22.660 --> 10:25.020 And if we go all the way down, we can see Bob. 10:25.120 --> 10:26.660 So Bob is the account that I use. 10:26.920 --> 10:29.460 We can see the full name of Bob is simply Bob. 10:29.600 --> 10:31.580 His home directory is HomeBob. 10:31.940 --> 10:32.780 I've been bashed. 10:32.840 --> 10:33.680 Don't worry about that. 10:34.120 --> 10:36.640 Then I created an account Ralph. 10:36.880 --> 10:38.520 Just screwing around, create an account Ralph. 10:38.640 --> 10:42.060 Again, we go over here, see his full name is Ralph, HomeRalph. 10:42.440 --> 10:45.220 Then we come down here to Tim, that account that we just created. 10:45.440 --> 10:47.420 And we go over here, Tim McCoolio. 10:47.840 --> 10:49.200 He's in room number two. 10:49.340 --> 10:50.460 His phone number is 101. 10:51.260 --> 10:53.260 His home phone number is 222. 10:53.660 --> 10:55.180 And the comment is, hey mom. 10:55.280 --> 11:00.760 And again, so that's something to be thinking about with using that little 11:00.760 --> 11:01.500 comment there. 11:01.580 --> 11:06.480 Again, if you create a specific account in order to do something, somebody could come 11:06.480 --> 11:10.160 into the password file and go, oh, okay, so this account was created to 11:10.160 --> 11:12.120 do X, Y, or Z. 11:12.440 --> 11:15.000 And so that's really all there is to the password file. 11:15.120 --> 11:18.520 And this is an easy way to go in, see if an account has been created, 11:18.560 --> 11:21.980 and then go from there and take a look at the information. 11:22.200 --> 11:27.280 So with that, since this is VIM, all we're going to do is we're going to do 11:27.280 --> 11:28.400 colon Q. 11:28.620 --> 11:31.460 So colon Q will quit us out of VIM. 11:31.640 --> 11:34.960 Since we haven't done any modifications, we don't need to do a force quit. 11:35.020 --> 11:37.220 We don't need to do a save quit because we haven't modified anything. 11:37.340 --> 11:41.080 So we can simply do colon Q and we can get out of this. 11:42.080 --> 11:42.900 So there we go. 11:43.000 --> 11:45.000 So now we are back at the Bob screen. 11:45.080 --> 11:46.140 And so it's important to understand. 11:46.320 --> 11:50.540 So if we take a look at this, we are in the user account Bob at server. 11:50.800 --> 11:55.180 So this host name, the server name of this server is server. 11:55.360 --> 11:57.240 And we are at the Bob user account. 11:57.460 --> 12:02.000 So one thing just to take a look at is we can exit out of the Bob user account. 12:02.160 --> 12:03.120 And come back here. 12:03.280 --> 12:05.300 And so we created the Tim user account. 12:05.440 --> 12:06.780 So I can log in as Tim. 12:07.620 --> 12:08.700 You can ask for the password. 12:08.820 --> 12:10.620 1, 2, 3, 4, 5, 6. 12:11.040 --> 12:11.820 Hit enter. 12:12.200 --> 12:12.620 And yay! 12:13.180 --> 12:16.080 Now I am logged in as Tim. 12:16.140 --> 12:18.980 Now the important thing, again, something to be thinking about is when 12:18.980 --> 12:19.920 you're logged into a system. 12:20.000 --> 12:23.460 So if you sit down at a system and it's already been logged in, again, 12:23.540 --> 12:24.820 horrible security procedure. 12:25.080 --> 12:25.920 Don't do that. 12:26.020 --> 12:26.500 Don't do that. 12:26.560 --> 12:27.740 Always log out of the system. 12:27.900 --> 12:30.860 But just in case you sit down in the system, maybe you're doing maintenance 12:30.860 --> 12:33.400 tasks before, you forget who you're logged in as. 12:33.740 --> 12:37.180 If you come up here, this is your user account at the server name. 12:37.440 --> 12:41.260 So you can just verify that you're using the right user account. 12:41.660 --> 12:44.660 From here, if I want to do something such as change my password. 12:44.760 --> 12:45.920 So now I log in as Tim. 12:46.020 --> 12:47.800 So I give Tim the default password. 12:47.920 --> 12:50.820 Everybody has the password 1, 2, 3, 4, 5, 6. 12:50.980 --> 12:53.740 So Tim, when you log in, your password is 1, 2, 3, 4, 5, 6. 12:53.880 --> 12:56.700 But you need to change your password once you've logged in. 12:56.820 --> 13:04.460 So all Tim has to do is use the password command. 13:04.760 --> 13:09.060 So the password command is what allows you to change your password. 13:09.300 --> 13:10.160 So you hit enter. 13:10.500 --> 13:12.520 So it asks for the current Unix password. 13:13.080 --> 13:16.940 So I have 1, 2, 3, 4, 5, 6 is the current Unix password. 13:17.240 --> 13:18.160 I hit return. 13:18.320 --> 13:20.080 It asks for a new password. 13:20.520 --> 13:24.700 So let me do 1, 2, 3, 4, 5, 6, 7 is the new password. 13:25.000 --> 13:29.680 Retype 1, 2, 3, 4, 5, 6, 7 is the new Unix password. 13:30.600 --> 13:31.040 Bad. 13:31.220 --> 13:33.420 New and old passwords are too similar. 13:34.000 --> 13:34.840 Well, there you go. 13:34.980 --> 13:36.940 I actually wasn't expecting that. 13:37.360 --> 13:40.560 But hey, that just goes to show you there is a little bit of stuff there in Linux. 13:41.140 --> 13:42.960 So enter new Unix password. 13:43.060 --> 13:43.400 I don't know. 13:43.840 --> 13:46.000 We'll do 1, 6, 5 times. 13:46.440 --> 13:49.820 1, 2, 3, 4, 5, 6. 13:50.480 --> 13:53.060 1, 2, 3, 4, 5, 6. 13:54.360 --> 13:57.600 New password cannot be a palindrome. 13:59.200 --> 13:59.440 Okay. 13:59.820 --> 14:03.440 Well, this is getting a little more interesting here. 14:03.820 --> 14:07.680 Let me just P-A-S-S-W-O-R-D. 14:08.640 --> 14:11.840 P-A-S-S-W-O-R-D. 14:12.720 --> 14:14.220 Password updated successfully. 14:14.360 --> 14:15.120 Oh, there you go. 14:15.180 --> 14:17.080 So now I changed my password to password. 14:17.400 --> 14:20.920 So again, these are the little stupid things that you can run into the Linux 14:20.920 --> 14:21.260 world. 14:21.420 --> 14:25.760 That is a lesson for you that I wasn't expecting to give you. 14:25.860 --> 14:27.640 So just something that you may run into. 14:27.840 --> 14:33.240 So the command in order to change your own password is P-A-S-S-W-D. 14:33.680 --> 14:36.300 You put in your old password and then you put in your new password. 14:36.680 --> 14:37.660 Can't be too similar. 14:38.040 --> 14:39.640 Can't apparently be a palindrome. 14:40.220 --> 14:44.080 Like seriously, where the hell did can't be a palindrome come from? 14:44.080 --> 14:45.000 That's default. 14:45.200 --> 14:46.040 I didn't do that. 14:47.000 --> 14:50.260 But anyways, then you got to plug into something that Ubuntu gods like, 14:50.480 --> 14:51.920 and then your password is changed. 14:52.020 --> 14:55.620 So from here, let me show you how to change a password for a user. 14:56.220 --> 14:58.640 So we're going to exit out and we're going to log back in as Bob. 14:58.720 --> 15:01.440 So Bob is our root, is our administrator account. 15:01.560 --> 15:03.240 One, two, three, four, five, six. 15:03.780 --> 15:07.240 And so now let us change the password for Tim. 15:07.440 --> 15:11.100 So again, let's say we need to get into Tim's account or whatever else. 15:11.640 --> 15:15.300 And so if you're here in order to change the password for the user, we're going to 15:15.300 --> 15:17.860 do a sudo, super user do, escalate the privileges. 15:18.320 --> 15:22.820 Then we are going to do P-A-S-S-W-D for password. 15:22.920 --> 15:23.820 That is the command. 15:24.000 --> 15:27.760 And then we're going to do the user account that we are changing the password 15:27.760 --> 15:28.140 for. 15:28.380 --> 15:32.840 Then from there, we simply hit enter, enter a new Unix password. 15:33.400 --> 15:37.080 And so for this, all we're going to do is the new password for Tim. 15:37.140 --> 15:38.640 And so this is Tim's password. 15:39.100 --> 15:41.860 We're just going to put him back to one, two, three, four, five, six to make my 15:41.860 --> 15:42.300 life easier. 15:42.420 --> 15:44.360 One, two, three, four, five, six. 15:45.140 --> 15:47.880 Type, retype one, two, three, four, five, six. 15:48.180 --> 15:48.680 Hit enter. 15:49.300 --> 15:50.960 Password updated successfully. 15:51.180 --> 15:54.380 So if you want to change your own password, the simple command is 15:54.380 --> 15:55.720 P-A-S-S-W-D. 15:56.060 --> 15:59.740 If you are the root user, the administrative user, in order to change 15:59.740 --> 16:04.780 the password for somebody else is sudo password and then whatever the user 16:04.780 --> 16:06.660 account name that is for Tim. 16:07.080 --> 16:12.480 Now let us go and take a look at the change, basically being able to change the 16:12.480 --> 16:14.780 profile if we want to change things. 16:14.960 --> 16:16.700 So with that, let's clear the screen again. 16:18.500 --> 16:21.960 And for here, we're going to change Tim's profile. 16:22.140 --> 16:25.160 So we're going to do sudo C-H-F-N. 16:25.660 --> 16:28.080 And then we are going to do the user account name. 16:28.200 --> 16:29.120 So we're going to do Tim. 16:29.320 --> 16:32.340 And so when we do this, basically it comes up here. 16:32.440 --> 16:33.820 And so it gives us the full name. 16:33.900 --> 16:36.420 So it's Tim McCoolio. 16:36.420 --> 16:38.960 And we're going to leave Tim McCoolio as it is. 16:39.320 --> 16:40.900 And then it's going to ask for the room number. 16:41.040 --> 16:43.840 We're going to say, well, we're going to swap him over to room number seven. 16:44.240 --> 16:48.200 It's going to ask for the password or the phone number. 16:48.340 --> 16:52.680 So we're going to put it at 888-777-9999. 16:53.280 --> 16:55.380 We're going to go down the home phone number. 16:55.500 --> 16:56.900 Let's just say that's the same. 16:57.460 --> 17:00.640 Any other information, we're just going to leave that the same. 17:00.920 --> 17:02.040 And then there we go. 17:02.100 --> 17:04.340 If we go and we take a look at that password file. 17:04.460 --> 17:09.560 So we're going to take a look at VIM, E-T-C-P-A-S-S-W-D. 17:10.520 --> 17:12.260 We can now open this up. 17:12.560 --> 17:16.740 And as we can see, this user profile information has been changed for Tim 17:16.740 --> 17:17.260 McCoolio. 17:17.660 --> 17:19.420 He is now in room number seven. 17:19.580 --> 17:23.120 His phone number is now 888-777-9999. 17:23.780 --> 17:25.340 So on and so forth. 17:25.360 --> 17:27.320 So you can see that information. 17:27.980 --> 17:29.560 So with that, let us get out of here. 17:31.800 --> 17:33.120 Again, colon q. 17:33.400 --> 17:37.320 That is what will quit us out of VIM if we have not made any modifications. 17:37.860 --> 17:39.720 Let me do clear to clear the screen. 17:40.120 --> 17:43.520 And now I just want to show you a little bit of the user mod command. 17:44.060 --> 17:47.140 So with the user mod command, what we're going to do is we're going to do sudo. 17:47.720 --> 17:49.440 Then we're going to do user mod. 17:49.860 --> 17:51.940 And I'm not actually going to do anything here. 17:52.020 --> 17:54.320 I'm just going to do sudo user mod tim. 17:55.020 --> 17:58.080 And when you do this, you're actually going to get kind of like a man page. 17:58.200 --> 18:00.300 It's going to give you some information for the user mod. 18:00.920 --> 18:05.100 And from here, you can see the different options to be thinking about with user 18:05.100 --> 18:05.340 mod. 18:05.460 --> 18:10.240 And so when you take a look at it for usage, so you have user mod, then you put 18:10.240 --> 18:11.980 in options, then you put in login. 18:12.220 --> 18:18.820 So how this normally should be is sudo user mod and then hyphen c, hyphen d, 18:18.940 --> 18:19.540 hyphen e. 18:19.540 --> 18:23.340 Put all the options in there and then you put in login information. 18:23.720 --> 18:25.560 We're not going to worry about that right now. 18:25.800 --> 18:29.000 One of the things I did want to show you with the user mod command that I do think 18:29.000 --> 18:32.540 is interesting and something that you might want to look at is you can actually 18:32.540 --> 18:33.860 lock the user account. 18:34.060 --> 18:37.800 So again, one of the things to be thinking about is you create user accounts. 18:37.920 --> 18:42.580 Sometimes you no longer want the user account to be used, but you don't 18:42.580 --> 18:44.040 necessarily want it to be deleted. 18:44.160 --> 18:46.200 Maybe it's a user account for doing migrations. 18:46.460 --> 18:49.640 Maybe it's a user account for doing preventive maintenance, something like 18:49.640 --> 18:49.940 that. 18:50.320 --> 18:53.720 And so one of the things you can do is you can come in here and you can actually lock 18:53.720 --> 18:58.020 the user account and then later you can come back and unlock the user account. 18:58.400 --> 19:03.660 And so these are just some of the options that are available to you with the user 19:03.660 --> 19:06.020 profiles that you may not have seen before. 19:06.180 --> 19:09.960 And just again, one of those random things to think about whether or not you use them 19:09.960 --> 19:10.640 very often. 19:11.080 --> 19:16.500 So with that, let us clear the screen again and I will show you how to actually 19:16.500 --> 19:18.540 go about deleting users. 19:19.220 --> 19:23.420 And so from here, all we have to do is we're going to delete the TEM user. 19:23.820 --> 19:27.840 And so we look at, take a look at this, and we're currently logged in as Bob at 19:27.840 --> 19:28.180 server. 19:28.460 --> 19:33.020 And so what we're going to do is we're going to delete the TEM user account. 19:33.160 --> 19:37.940 All we do is DEL user and then whoever it is. 19:38.060 --> 19:39.980 TEM, sudo del user TEM. 19:40.320 --> 19:44.780 Then we're going to hit enter, removing TEM, warning group 10, 19:44.960 --> 19:46.840 TEM has no more members, done. 19:47.080 --> 19:51.500 So basically now the TEM user account has been deleted. 19:51.700 --> 19:53.360 But I want to show you something here. 19:53.440 --> 19:56.360 So let me do the pwd command to show us where we're at. 19:56.660 --> 19:57.700 I'm going to change directory. 19:58.000 --> 20:04.160 I'm going to go up to the home directory and then I'll do lsl and list the 20:04.160 --> 20:07.840 directories that are still up in the home directory. 20:07.960 --> 20:10.620 And what we'll notice is we still have Bob, which is us. 20:10.740 --> 20:13.400 We still have Ralph, a user account we haven't dealt with today. 20:13.680 --> 20:16.560 But the TEM folder is still there. 20:16.660 --> 20:19.240 You still have that TEM profile folder there. 20:19.740 --> 20:24.800 And so we are going to want to delete that TEM profile folder. 20:25.240 --> 20:31.920 So what we can do then is we can use the sudo rm-rf command. 20:32.100 --> 20:38.980 So basically with the sudo and remove, this is the command to remove a directory. 20:39.500 --> 20:41.320 And then we do hyphen rf. 20:41.420 --> 20:46.880 And so why we're going to do hyphen rf is because the directory actually has stuff 20:46.880 --> 20:47.260 in it. 20:47.420 --> 20:52.200 So when Linux creates a profile directory it will then populate that profile 20:52.200 --> 20:54.860 directory with different files that are required for a profile. 20:55.220 --> 21:00.800 So if you simply do the rm command without the extra arguments it'll fail out because 21:00.800 --> 21:02.740 it's not an empty folder. 21:03.000 --> 21:08.340 So we use hyphen rf and this will go through and it will remove the folder and 21:08.340 --> 21:09.200 everything in it. 21:09.620 --> 21:12.480 And then from here what we're going to do is the path. 21:12.980 --> 21:15.940 So it's going to be home and then it's going to be TEM. 21:16.060 --> 21:18.560 So again it's important to be thinking about, especially whenever you do 21:18.560 --> 21:24.780 something like a remove command, is make sure you put in the exact path 21:24.780 --> 21:25.640 that you're going for. 21:26.020 --> 21:27.440 Not time actually, not time. 21:28.200 --> 21:33.940 So here again so from the root directory the home folder in the root directory and 21:33.940 --> 21:36.960 then we want to delete the TEM folder in the home folder. 21:37.240 --> 21:39.020 So wherever you're at you can do that. 21:39.420 --> 21:41.800 And then if you press enter it's now done. 21:42.180 --> 21:43.840 We do ls hyphen l. 21:44.080 --> 21:48.040 We can see that we now have the Bob folder and we have the Ralph folder. 21:48.500 --> 21:50.740 So TEM is now entirely gone. 21:51.200 --> 21:55.220 And that's the basic idea about how to add users, how to change passwords, 21:55.480 --> 21:59.740 how to change users profiles, understanding the password, the 21:59.740 --> 22:04.700 p-a-s-s-w-d file a little bit, how to delete a user, and then how to 22:04.700 --> 22:09.020 delete the profile folder for the user once they've been removed. 22:09.140 --> 22:11.300 So again overall relatively simple. 22:11.660 --> 22:15.540 The main thing that you're going to run into is in the Windows world you can do a 22:15.540 --> 22:16.640 whole bunch more. 22:17.120 --> 22:21.120 And so one of the big problems people run into is they think about Linux as if 22:21.120 --> 22:24.820 they're dealing with Windows and then they basically try to make things more 22:24.820 --> 22:26.580 complicated than they actually are. 22:26.960 --> 22:31.420 And so that's really all there is to the basic user administration in Linux. 22:32.120 --> 22:33.380 So there you go. 22:33.880 --> 22:36.240 Now to be clear, it is Linux. 22:36.420 --> 22:37.000 It is Linux. 22:37.420 --> 22:40.480 So there's 20,000 more things you can do. 22:41.060 --> 22:42.160 So many arguments. 22:42.460 --> 22:43.540 So many options. 22:43.840 --> 22:49.480 So much to be polite idiocy that you can do if you really want to get into it. 22:49.820 --> 22:53.420 So if you're interested about the different things that you can do with user 22:53.420 --> 22:55.860 accounts, you can go and you can take a look. 22:56.080 --> 23:00.340 One of the things that I would warn you about, again in the real world of Linux, 23:00.560 --> 23:04.980 is really ask yourself if you want to be creating Linux accounts from the command 23:04.980 --> 23:10.380 line or do you want to use some other type of software in order to create user 23:10.380 --> 23:10.760 accounts. 23:10.780 --> 23:12.060 Again there's something called Samba. 23:12.260 --> 23:18.280 Samba is basically Linux's version of an Active Directory server. 23:18.700 --> 23:21.500 And so one of the things that you may be thinking about is like, oh cool, 23:21.580 --> 23:22.960 I'm going to create all these user accounts. 23:23.060 --> 23:26.080 But remember, you're creating these directly in the Linux operating system. 23:26.500 --> 23:29.960 And one of the questions to really ask yourself is, is that really what you want 23:29.960 --> 23:30.300 to do? 23:30.480 --> 23:35.280 Or do you want to add an additional piece of software, pieces of software, 23:35.400 --> 23:40.500 something like Samba or some kind of other user account software, and actually run 23:40.500 --> 23:43.420 your user accounts through that additional software? 23:43.780 --> 23:47.220 I would argue that's probably what you're going to do at the end of the day. 23:47.560 --> 23:53.200 The idea being is those additional layers of software, when you add a user account 23:53.200 --> 23:59.060 there, they may add user account to the password file in Linux, but they'll also 23:59.060 --> 24:01.740 do 20 other different tasks. 24:01.960 --> 24:07.040 You create a user account in Samba or something else, and not only does it 24:07.040 --> 24:09.380 create a user account, but it also creates an email account. 24:09.520 --> 24:12.180 It also does this, it does this, it does this, it does this, it does this, 24:12.220 --> 24:16.500 it does this, and so that is a more effective way of dealing with user 24:16.500 --> 24:21.600 accounts in a Linux infrastructure than simply adding users at the command line. 24:21.740 --> 24:26.940 But this can be very useful, again, from a security standpoint, creating user 24:26.940 --> 24:30.760 accounts that can only do specific things within the Linux operating system. 24:30.880 --> 24:31.640 That can be valuable. 24:32.080 --> 24:36.140 Or if you're playing around and doing other things, possibly if you create an 24:36.140 --> 24:37.100 FTP server. 24:37.440 --> 24:43.660 So let's say you want users to be able to upload to your Linux server for whatever 24:43.660 --> 24:46.020 reason, so that you create an FTP server. 24:46.420 --> 24:50.960 In that situation, you may create users at the command line for all of your different 24:50.960 --> 24:51.960 FTP users. 24:52.340 --> 24:57.240 Basically, when they log in, they will then get dumped to wherever the profile 24:57.240 --> 24:58.460 tells them to get dumped. 24:58.740 --> 25:02.300 That's something that you might do with the command line, creating users, 25:02.400 --> 25:03.180 deleting users. 25:03.800 --> 25:10.260 But generally, I would not be creating a lot of user accounts, again, from that 25:10.260 --> 25:13.960 infrastructure type standpoint, just from the command line. 25:14.040 --> 25:15.740 So that's just something to keep in mind. 25:16.100 --> 25:17.740 But really, that's all there is to it. 25:17.780 --> 25:22.840 Again, you've got add user, you've got the password, passwd command. 25:22.940 --> 25:24.960 So with that command, you can change your own password. 25:25.180 --> 25:28.820 Or again, if you're logged in as the root, you could passwords for other users. 25:29.140 --> 25:36.180 The etc slash password, p-a-s-s-w-d file, that contains the information for all your 25:36.180 --> 25:36.860 user accounts. 25:36.940 --> 25:40.340 So you can go there, see all the user accounts that are on the system. 25:40.460 --> 25:42.340 You can see all of that additional information. 25:42.800 --> 25:48.860 Again, I would say, really think about writing notes for, or comments for why 25:48.860 --> 25:50.600 you're creating specific user accounts. 25:50.740 --> 25:53.940 That can be useful when you go back to try to clean up a system. 25:54.060 --> 25:58.340 Again, imagine a Linux system, for whatever reason, you're creating users 25:58.340 --> 25:59.500 at the command line. 25:59.800 --> 26:02.860 When you create five or six users, it's no big deal. 26:02.940 --> 26:04.340 It's very easy to keep track of. 26:04.680 --> 26:07.000 But you should think about what happens when you create 50 users? 26:07.060 --> 26:08.620 What happens when you create 200 users? 26:08.780 --> 26:12.340 What happens when it's three or four years from now, and you're going back and you're 26:12.340 --> 26:17.620 looking to do maintenance and just get rid of old user accounts by simply having 26:17.620 --> 26:20.960 little notes to say why the hell a user account existed. 26:21.220 --> 26:23.400 That can be a very useful thing. 26:23.600 --> 26:28.520 Again, I show you the chfn command that allows you to change the profile 26:28.520 --> 26:31.320 information if that's something that you want to do. 26:31.540 --> 26:33.260 I showed you that usermod command. 26:33.340 --> 26:35.760 We didn't actually use the usermod command, but that's where you can do 26:35.760 --> 26:38.240 things like you can lock a user account if you want to. 26:38.580 --> 26:40.100 Again, that might be very valuable. 26:40.540 --> 26:41.720 Show you how to delete a user. 26:42.060 --> 26:46.060 And then again, remember, just because you delete the user account doesn't mean the 26:46.060 --> 26:47.620 profile folder has been deleted. 26:48.020 --> 26:53.780 And again, from a preventive maintenance standpoint, I would highly argue to delete 26:53.780 --> 26:58.420 those profile folders or you can just get a whole big old mess of profile folders 26:58.420 --> 26:59.860 and you can run into some issues. 27:00.180 --> 27:04.340 So those are some things to think about when adding and deleting users and being 27:04.340 --> 27:06.540 able to manage users on a Linux system. 27:06.820 --> 27:09.900 As always, I enjoyed doing this video and look forward to seeing you in the next one.