1 00:00:00,000 --> 00:00:03,522 Hi. In this lesson we are going to cover 2 00:00:03,596 --> 00:00:06,802 FTP, which stands for File Transfer Protocol. 3 00:00:06,946 --> 00:00:09,714 The FTP is a standard network protocol used 4 00:00:09,752 --> 00:00:12,042 for the transfer of computer files, between a 5 00:00:12,056 --> 00:00:14,550 client and a server on a computer network. 6 00:00:14,870 --> 00:00:16,978 FTP is built on a client-server 7 00:00:17,014 --> 00:00:19,890 model architecture using separate control and data 8 00:00:19,940 --> 00:00:22,222 connections between the client and the server. 9 00:00:22,366 --> 00:00:26,214 This is the definition that I have actually got 10 00:00:26,252 --> 00:00:30,174 it from exactly from Wikipedia. In very simple words, 11 00:00:30,332 --> 00:00:34,134 an FTP is a protocol that is used to 12 00:00:34,172 --> 00:00:38,300 transfer a file from server A to server B. 13 00:00:38,810 --> 00:00:42,618 Now, the protocol is actually a set 14 00:00:42,644 --> 00:00:45,130 of rules used by computers to communicate. 15 00:00:45,190 --> 00:00:48,114 So that protocol that tells the computer, hey, 16 00:00:48,152 --> 00:00:50,218 this is how it should be transferred. 17 00:00:50,314 --> 00:00:52,230 This is the port that you should use. 18 00:00:52,280 --> 00:00:54,740 This is an encryption that you should use. 19 00:00:55,370 --> 00:00:58,806 These are all defined rules that are already 20 00:00:58,928 --> 00:01:02,300 built in within a computer and operating system. 21 00:01:02,930 --> 00:01:07,025 For the FTP, the default FTP port is 21. 22 00:01:07,148 --> 00:01:11,142 Just like for SSH, we have 22, for DNS, we have 53, 23 00:01:11,336 --> 00:01:13,566 and for many other services that we run 24 00:01:13,628 --> 00:01:17,550 in Linux, for FTP, we use port 21 25 00:01:17,600 --> 00:01:19,880 to communicate from one server to another. 26 00:01:20,570 --> 00:01:23,910 Now, for this lecture, we need two Linux machines. 27 00:01:24,590 --> 00:01:27,990 If you do not have two Linux machine, I will 28 00:01:28,040 --> 00:01:31,530 recommend you that you should go ahead and build another 29 00:01:31,640 --> 00:01:35,874 Linux machine running CentOS, which could be exactly 30 00:01:35,972 --> 00:01:38,770 the same one as you had previously. 31 00:01:38,890 --> 00:01:41,418 So my first machine that I've been 32 00:01:41,444 --> 00:01:43,546 using is MyFirstLinuxVM. 33 00:01:43,678 --> 00:01:46,294 This is a hostname and the second machine 34 00:01:46,342 --> 00:01:49,446 that I created, and I'm referring it to 35 00:01:49,508 --> 00:01:53,900 as the host name as LinuxCentOS7. 36 00:01:54,950 --> 00:01:56,698 It's just a name that I picked. 37 00:01:56,794 --> 00:02:00,750 So anyway, I'm sure you already have MyFirstLinuxVM, 38 00:02:00,750 --> 00:02:02,316 CentOS VM, 39 00:02:02,910 --> 00:02:07,382 and what you need to do is to install another Linux VM. 40 00:02:07,466 --> 00:02:11,782 So if I give you a quick information on the 41 00:02:11,856 --> 00:02:14,714 Oracle VirtualBox, you see this is the first VM 42 00:02:14,762 --> 00:02:17,074 that I was running and this is the information. 43 00:02:17,172 --> 00:02:22,678 It has one gig machine, 10 gig disk space. 44 00:02:22,678 --> 00:02:25,270 The second machine that I'm using as a server 45 00:02:25,590 --> 00:02:28,550 also has the same specification, ten gig, 46 00:02:28,610 --> 00:02:31,162 one gig, everything exactly the same. 47 00:02:31,356 --> 00:02:34,680 Even I'm using the same version of CentOS as well. 48 00:02:35,310 --> 00:02:38,098 But I built a second one so 49 00:02:38,124 --> 00:02:42,960 we could go through this lesson. Sorry. 50 00:02:43,350 --> 00:02:45,082 All right, so to put in a 51 00:02:45,096 --> 00:02:47,818 graphical way, let's go into detail. 52 00:02:47,964 --> 00:02:50,878 So we have a client, a server that 53 00:02:50,904 --> 00:02:53,078 needs to send a file to another server. 54 00:02:53,114 --> 00:02:54,382 It's called Server A, 55 00:02:54,456 --> 00:02:55,378 and Server B. 56 00:02:55,464 --> 00:02:57,718 And whenever you have one server trying to 57 00:02:57,744 --> 00:03:00,658 connect to another server, that recipient becomes a 58 00:03:00,684 --> 00:03:02,834 server and the sender becomes a client. 59 00:03:02,942 --> 00:03:06,338 So it wants to send a file over FTP protocol. 60 00:03:06,434 --> 00:03:10,378 Now, if this recipient server, if it's not running 61 00:03:10,464 --> 00:03:13,910 any kind of listening service to receive that protocol, 62 00:03:14,030 --> 00:03:18,166 then it's going to reject that transfer. 63 00:03:18,288 --> 00:03:21,398 So we need to make sure that it is running FTP, 64 00:03:21,494 --> 00:03:25,634 the daemon or the service or the application on that server. 65 00:03:25,742 --> 00:03:27,898 And by default whenever we run it, it 66 00:03:27,924 --> 00:03:30,540 will start up that service on port 21. 67 00:03:31,110 --> 00:03:33,550 All right, now what is the process to 68 00:03:33,600 --> 00:03:36,206 actually configure that on client and server? 69 00:03:36,278 --> 00:03:38,266 So let's look at the server side first. 70 00:03:38,388 --> 00:03:41,518 So here are the quick steps that we'll cover to 71 00:03:41,544 --> 00:03:45,790 do the installation configuration of FTP under remote server. 72 00:03:46,650 --> 00:03:48,382 After becoming a root, we'll check if 73 00:03:48,396 --> 00:03:50,674 it has FTP server installed, we'll check 74 00:03:50,712 --> 00:03:52,430 if you have Internet connectivity. 75 00:03:52,550 --> 00:03:57,250 We'll install the vsftpd package on the server 76 00:03:57,810 --> 00:04:02,042 and then we'll modify the vsftpd configuration file. 77 00:04:02,186 --> 00:04:03,698 And in that file we'll 78 00:04:03,734 --> 00:04:05,770 make certain configuration changes. 79 00:04:05,940 --> 00:04:10,414 And these changes are here listed, we'll go over them 80 00:04:10,452 --> 00:04:12,682 one by one and then we'll start the service. 81 00:04:12,756 --> 00:04:15,540 We'll enable the service, it could start at boot time. 82 00:04:15,870 --> 00:04:18,934 We'll stop the firewalld so the communication can 83 00:04:18,971 --> 00:04:21,586 take place between server A and server B. 84 00:04:21,708 --> 00:04:24,658 If you wanted to leave your firewalld up and 85 00:04:24,684 --> 00:04:27,334 running, then you have to add a rule for it 86 00:04:27,372 --> 00:04:31,006 to allow to accept port or traffic 21, 87 00:04:31,188 --> 00:04:34,414 so traffic on port 21. You can find that online, 88 00:04:34,512 --> 00:04:40,390 how to add FTP hoard on the firewalld. 89 00:04:40,560 --> 00:04:43,042 And then you could disable that firewalld 90 00:04:43,116 --> 00:04:44,866 if you're not using it, just disable it 91 00:04:44,868 --> 00:04:46,354 so it won't start back online. 92 00:04:46,452 --> 00:04:48,214 And the last step is of course, make sure 93 00:04:48,252 --> 00:04:51,338 you create a user account on that FTP server 94 00:04:51,374 --> 00:04:53,386 if you do not already have it. 95 00:04:53,448 --> 00:04:55,378 Because that's the account we will use to 96 00:04:55,404 --> 00:04:57,720 transfer file from server A to server B. 97 00:04:58,290 --> 00:05:00,358 And the last part would be we we'll 98 00:05:00,384 --> 00:05:04,714 install FTP client on the client server, we'll 99 00:05:04,752 --> 00:05:08,366 become root, yum install ftp, become a regular user, 100 00:05:08,438 --> 00:05:12,194 and then we will create a file called kruger. 101 00:05:12,302 --> 00:05:14,350 Now this is just a regular file, you could 102 00:05:14,400 --> 00:05:18,070 actually use any file name you like, you could 103 00:05:18,120 --> 00:05:20,434 pick pizza, pasta, whatever the file name. 104 00:05:20,472 --> 00:05:22,262 But if you want to be consistent staying 105 00:05:22,286 --> 00:05:24,830 with me, just make a file called kruger. 106 00:05:24,950 --> 00:05:27,890 Once the file is created, then we'll FTP 107 00:05:27,950 --> 00:05:31,958 to the server, we'll enter our credentials, we'll 108 00:05:31,994 --> 00:05:35,254 put in a bi for binary, and then 109 00:05:35,352 --> 00:05:37,922 # for hash tagging it so you could see the progress. 110 00:05:38,066 --> 00:05:40,034 And we'll use the command put kruger. 111 00:05:40,142 --> 00:05:43,318 Once it's transferred, then we simply type it 112 00:05:43,344 --> 00:05:46,726 bye to get out of that FTP process. 113 00:05:46,848 --> 00:05:49,330 All right, so now let me go back to 114 00:05:49,500 --> 00:05:55,286 the installation process of FTP on the server. 115 00:05:55,478 --> 00:06:00,250 All right, as I said, for that I have a client, 116 00:06:00,250 --> 00:06:03,553 which is my first and, 117 00:06:04,690 --> 00:06:07,998 which is the very first Linux VM that I created, 118 00:06:08,034 --> 00:06:10,446 and I called it MyFirstLinuxVM. 119 00:06:10,638 --> 00:06:13,538 And then I have another machine that 120 00:06:13,564 --> 00:06:16,374 I'm using for this lecture purpose 121 00:06:16,422 --> 00:06:17,958 and then that machine 122 00:06:17,994 --> 00:06:20,350 I'm calling LinuxCentOS7. 123 00:06:20,350 --> 00:06:22,634 Now in this machine, once you have it built 124 00:06:22,672 --> 00:06:26,210 and configured, I want you to become root. 125 00:06:26,210 --> 00:06:28,970 [No audio] 126 00:06:28,970 --> 00:06:31,098 By the way, I was logged in as myself. 127 00:06:31,184 --> 00:06:33,018 So if I exit and I do, whoami, 128 00:06:33,044 --> 00:06:34,798 you're going to see that on this server 129 00:06:34,834 --> 00:06:37,354 I have already created an account iafzal. 130 00:06:37,462 --> 00:06:38,538 So if you do not have 131 00:06:38,564 --> 00:06:40,938 an account, during the installation you didn't create it, 132 00:06:40,964 --> 00:06:43,050 go ahead and create it. If you have it, good. 133 00:06:43,100 --> 00:06:48,222 Now become root. After becoming root, of 134 00:06:48,236 --> 00:06:49,278 course you could do whoami, 135 00:06:49,304 --> 00:06:53,154 just to confirm which users you are logged in as. 136 00:06:53,312 --> 00:06:57,198 Now you need to install the FTP daemon or the 137 00:06:57,224 --> 00:07:02,190 FTP service on your machine before you install it. 138 00:07:02,300 --> 00:07:04,618 Check if it has already been installed. 139 00:07:04,654 --> 00:07:12,390 So I would recommend you type rpm -qa, and grep for vsftpd. 140 00:07:13,010 --> 00:07:14,274 This is the name of the 141 00:07:14,312 --> 00:07:16,530 package that needs to be downloaded. 142 00:07:17,630 --> 00:07:21,238 Okay. It is not downloaded and it has not been installed. 143 00:07:21,274 --> 00:07:23,478 So I would run the command. Before I 144 00:07:23,504 --> 00:07:25,746 run the command, or before I go out 145 00:07:25,808 --> 00:07:28,494 on the CentOS repository to install it, 146 00:07:28,592 --> 00:07:31,098 I wanted to make sure this machine that 147 00:07:31,124 --> 00:07:34,746 I'm logged in right now has Internet access. 148 00:07:34,928 --> 00:07:39,954 So what I'll do is simply ping www.google.com, and 149 00:07:39,992 --> 00:07:43,026 you see I'm getting a response back. Perfect. 150 00:07:43,088 --> 00:07:46,390 So it means I have Internet connectivity. 151 00:07:46,570 --> 00:07:51,870 Now I will go ahead and do yum install vsftpd. 152 00:07:51,911 --> 00:07:54,990 [No audio] 153 00:07:54,990 --> 00:07:57,214 Now this command is going to the 154 00:07:57,252 --> 00:08:00,458 all the repositories and it is checking, 155 00:08:00,494 --> 00:08:04,318 Hey, do you have vsftpd package that 156 00:08:04,344 --> 00:08:07,800 I need to download and then install? 157 00:08:09,390 --> 00:08:10,354 It did go there. 158 00:08:10,392 --> 00:08:12,742 It checked and it says, yes, I do have it. 159 00:08:12,816 --> 00:08:15,046 And this is for architecture 64 bit. 160 00:08:15,108 --> 00:08:19,438 And the version that I have, the latest one is 3.0.2. 161 00:08:19,584 --> 00:08:20,810 Do you want to download? 162 00:08:20,870 --> 00:08:23,290 And the size is 171K. 163 00:08:23,400 --> 00:08:24,794 Yes, I do want to download. 164 00:08:24,842 --> 00:08:27,540 So simply type Y and hit enter. 165 00:08:28,350 --> 00:08:29,954 It's saying downloading package. 166 00:08:30,002 --> 00:08:31,102 And then it says it has a 167 00:08:31,116 --> 00:08:34,020 fingerprint, some information, some security information. 168 00:08:34,590 --> 00:08:35,686 Is this okay? 169 00:08:35,808 --> 00:08:37,690 That comes with a package. That is fine. 170 00:08:37,740 --> 00:08:39,360 Go ahead and click yes. 171 00:08:39,360 --> 00:08:41,770 [No audio] 172 00:08:41,770 --> 00:08:43,394 Running transaction check. 173 00:08:43,491 --> 00:08:45,400 Running transaction test. 174 00:08:45,730 --> 00:08:48,385 It will go through the process of 175 00:08:48,448 --> 00:08:54,558 fetching that package, downloading the package, installing 176 00:08:54,594 --> 00:08:57,906 the package, and then verifying the installation. 177 00:08:58,038 --> 00:09:02,594 And at the it will say it is completed, and verify it of course. 178 00:09:02,752 --> 00:09:06,354 Now, if you run that same command, rpm -qa 179 00:09:06,402 --> 00:09:10,514 and grep for vsftpd, you will see it will 180 00:09:10,612 --> 00:09:14,234 show up the package that is installed. There you go. 181 00:09:14,392 --> 00:09:16,062 This is the package that is installed. 182 00:09:16,086 --> 00:09:17,750 So we confirmed that it has been 183 00:09:17,860 --> 00:09:20,022 downloaded, and of course, it is installed. 184 00:09:20,166 --> 00:09:22,214 Now we need to configure it. 185 00:09:22,252 --> 00:09:25,034 So every time you hear the word configure, it means 186 00:09:25,072 --> 00:09:28,458 we have to configure it on the configuration file. 187 00:09:28,614 --> 00:09:31,350 The configuration file for FTP server 188 00:09:31,410 --> 00:09:38,574 is /etc/vsftpd/vsftpd.conf file. 189 00:09:38,682 --> 00:09:41,918 Before I modify it, I always recommend that 190 00:09:41,944 --> 00:09:43,720 you make a copy of it. 191 00:09:44,290 --> 00:09:51,013 So let's go to cd vsftpd, do ls -ltr, 192 00:09:51,013 --> 00:09:54,770 and you will see this is the file. 193 00:09:55,870 --> 00:09:58,634 Now I want you to go ahead and make a copy of that. 194 00:09:58,672 --> 00:10:07,398 So cp vsftpd.conf vsftpd.conf.orig. 195 00:10:07,554 --> 00:10:10,770 This is the name I usually pick to make a copy. 196 00:10:10,830 --> 00:10:13,742 As it reads, it will tell me 197 00:10:13,756 --> 00:10:16,070 that this is the actual original file. 198 00:10:16,070 --> 00:10:18,710 [No audio] 199 00:10:18,710 --> 00:10:22,246 All right, the copy of the backup has been created. 200 00:10:22,318 --> 00:10:27,890 Now I need to modify that file vsftpd.conf file, 201 00:10:27,890 --> 00:10:29,874 and now I have to go 202 00:10:29,912 --> 00:10:31,918 through these parameters that I have listed 203 00:10:31,954 --> 00:10:34,710 on my slide to modify these parameters. 204 00:10:35,090 --> 00:10:37,042 The first thing is find the following lines 205 00:10:37,066 --> 00:10:38,898 and make the changes as shown below. 206 00:10:39,044 --> 00:10:41,206 Disable anonymous login. 207 00:10:41,398 --> 00:10:50,430 So I will search for slash a-n-o-n-y-m-o-u-s, anonymous. 208 00:10:50,930 --> 00:10:52,902 It took me to the first word 209 00:10:52,976 --> 00:10:55,014 because I'm doing a search within vi. 210 00:10:55,172 --> 00:10:56,778 It took me the first word, but this 211 00:10:56,804 --> 00:10:58,638 is not the line that I'm looking for. 212 00:10:58,664 --> 00:11:01,890 So I'm going to hit N to go to the next one, and there it is. 213 00:11:01,940 --> 00:11:05,370 It says anonymous_enable and it is YES. 214 00:11:05,420 --> 00:11:08,874 So go ahead and remove that and put 215 00:11:08,912 --> 00:11:11,238 NO, because you don't want anyone else to 216 00:11:11,264 --> 00:11:14,718 come into your FTP server as anonymous. Good. 217 00:11:14,864 --> 00:11:19,650 Next parameters is ascii, 218 00:11:19,650 --> 00:11:22,710 it's scsi, asc, 219 00:11:22,710 --> 00:11:26,470 and now you have to uncomment these two lines. 220 00:11:28,230 --> 00:11:29,618 upload_enable, 221 00:11:29,714 --> 00:11:30,782 download_enable, 222 00:11:30,806 --> 00:11:32,170 that's perfectly fine. 223 00:11:32,340 --> 00:11:37,454 Now come down to where it says ftpd, 224 00:11:37,622 --> 00:11:38,940 search for that. 225 00:11:40,290 --> 00:11:42,626 It says ftpd_banner= 226 00:11:42,758 --> 00:11:45,622 Welcome to blah FTP service. That is fine. 227 00:11:45,696 --> 00:11:50,306 You could remove that, uncomment it. 228 00:11:50,438 --> 00:11:51,670 Now if you want to change 229 00:11:51,720 --> 00:11:53,714 to Welcome to blah FTP server, 230 00:11:53,762 --> 00:11:57,214 to Welcome to my beautiful FTP server. That is fine. 231 00:11:57,252 --> 00:11:58,150 You could do that. 232 00:11:58,260 --> 00:12:01,982 Now the last thing it says add at the end of this file. 233 00:12:02,066 --> 00:12:04,702 If you want to go to the end of this file, you have 234 00:12:04,716 --> 00:12:07,680 to press Shift G and it will take you to the end. 235 00:12:08,130 --> 00:12:10,210 And here I'm just going to put first 236 00:12:10,260 --> 00:12:17,980 I'm going to put comment, as Local Time, 237 00:12:18,490 --> 00:12:21,126 and I'm going to put in that parameters. 238 00:12:21,198 --> 00:12:27,760 It says, use_localtime=YES, perfect. 239 00:12:29,230 --> 00:12:30,690 These are the only configuration 240 00:12:30,750 --> 00:12:32,174 changes you have to make. 241 00:12:32,332 --> 00:12:34,370 I'll go ahead and save the file. 242 00:12:35,770 --> 00:12:37,626 Perfect. File is saved. 243 00:12:37,758 --> 00:12:42,122 Now it's time to start the vsftpd service. 244 00:12:42,256 --> 00:12:43,874 And for that, we have to 245 00:12:43,912 --> 00:12:48,470 use the command systemctl start vsftpd. 246 00:12:48,470 --> 00:12:50,350 [No audio] 247 00:12:50,350 --> 00:12:52,898 It is started. Let's check the status if it 248 00:12:52,924 --> 00:12:54,902 is actually started or not. 249 00:12:55,096 --> 00:12:58,600 Yes, it says Started, see active here. Beautiful. 250 00:12:58,990 --> 00:13:01,478 Now I want to enable that. 251 00:13:01,624 --> 00:13:04,982 So every time my system reboots, I don't have 252 00:13:04,996 --> 00:13:08,046 to go back in and start that service manually 253 00:13:08,118 --> 00:13:10,094 again, I want that service to 254 00:13:10,132 --> 00:13:12,810 start every time the system reboots. 255 00:13:12,930 --> 00:13:14,282 And for that I have to use the 256 00:13:14,296 --> 00:13:19,180 command systemctl enable vsftpd, hit Enter. 257 00:13:19,630 --> 00:13:23,920 And it has been enabled now. Perfect. 258 00:13:24,790 --> 00:13:28,866 Now I want to disable the firewall on this server. 259 00:13:28,998 --> 00:13:31,910 To disable it, I'll use the command, before 260 00:13:31,960 --> 00:13:33,842 I disable, I need to stop it. 261 00:13:33,976 --> 00:13:35,798 So stop firewalld. 262 00:13:35,884 --> 00:13:38,234 Now, as I said earlier, if you do not want 263 00:13:38,272 --> 00:13:41,418 to disable Firewall D, which I don't recommend you, I'm 264 00:13:41,454 --> 00:13:44,454 disabling it because this is my lab environment. 265 00:13:44,502 --> 00:13:46,254 So I'm okay, so if you're in the production 266 00:13:46,302 --> 00:13:49,838 environment and you have Firewall D running, then you 267 00:13:49,864 --> 00:13:53,740 need to add the rule to allow port 21 268 00:13:54,670 --> 00:13:57,650 as an incoming traffic for that firewall. 269 00:13:58,330 --> 00:14:01,274 Anyway, going back, let's stop the Firewall D 270 00:14:01,312 --> 00:14:03,374 because I'm using my lab and I really 271 00:14:03,412 --> 00:14:06,906 don't need that, it is stopped. 272 00:14:07,038 --> 00:14:08,750 Now, let's check the status. 273 00:14:08,750 --> 00:14:11,210 [No audio] 274 00:14:11,210 --> 00:14:15,786 See right here, it says inactive, dead. Perfect. 275 00:14:15,908 --> 00:14:18,200 Now, I want you to disable it. 276 00:14:18,530 --> 00:14:21,778 Meaning, every time my computer reboots, I don't 277 00:14:21,814 --> 00:14:24,080 want this service to start back again. 278 00:14:24,080 --> 00:14:25,970 [No audio] 279 00:14:25,970 --> 00:14:28,926 It is disabled. Perfect. Beautiful. 280 00:14:29,048 --> 00:14:31,482 We did our work on the server side. 281 00:14:31,556 --> 00:14:32,826 And the last line you're going to 282 00:14:32,828 --> 00:14:34,810 see, it says user@iafzal, 283 00:14:34,930 --> 00:14:39,238 if the user does not exist already. When I do exit 284 00:14:39,334 --> 00:14:42,450 out of the root, and I do, whoami, 285 00:14:42,560 --> 00:14:45,102 you see, I already have an account, my account. 286 00:14:45,176 --> 00:14:46,534 iafzal on this machine. 287 00:14:46,582 --> 00:14:48,514 So I don't need to recreate. 288 00:14:48,682 --> 00:14:51,258 If you do not have the account, or if 289 00:14:51,284 --> 00:14:52,878 you do not have an account that you will 290 00:14:52,904 --> 00:14:56,358 be using for the FTP purpose, than I want 291 00:14:56,384 --> 00:14:59,370 you to go ahead and create an account. Anyway, 292 00:14:59,420 --> 00:15:01,194 so, this is the configuration we 293 00:15:01,200 --> 00:15:06,370 followed on the FTP server. 294 00:15:06,490 --> 00:15:09,870 Now we have to do a few things on the FTP client. 295 00:15:10,250 --> 00:15:16,770 So the client needs to install FTP the package. 296 00:15:17,330 --> 00:15:21,990 And to do that, let's go in to our client. 297 00:15:22,730 --> 00:15:24,800 And my client is right here. 298 00:15:26,510 --> 00:15:28,590 This is MyFirstLinuxVM. Perfect. 299 00:15:28,700 --> 00:15:32,730 Now, here, if I become root, 300 00:15:32,730 --> 00:15:37,170 [No audio] 301 00:15:37,170 --> 00:15:40,279 by the way, I was logged in as iafzal. 302 00:15:40,279 --> 00:15:43,054 So now, if I run FTP command, you 303 00:15:43,092 --> 00:15:46,200 see it says bash : ftp: command now found.... 304 00:15:46,530 --> 00:15:49,474 The reason it is not found, because I 305 00:15:49,512 --> 00:15:52,430 do not have the FTP client installed. 306 00:15:52,610 --> 00:15:54,338 So I need to install the client. 307 00:15:54,374 --> 00:15:56,506 Now, of course, as I said, always check 308 00:15:56,568 --> 00:16:01,030 to make sure you have Internet connectivity. 309 00:16:01,530 --> 00:16:05,446 And for that, ping, any website that you like online. 310 00:16:05,628 --> 00:16:09,720 And it says, I am getting the response back. Perfect. 311 00:16:10,170 --> 00:16:15,046 Now, I could go ahead and do yum install ftp. Now, 312 00:16:15,108 --> 00:16:17,642 this is not the vsftpd. 313 00:16:17,786 --> 00:16:18,890 This is FTP. 314 00:16:18,950 --> 00:16:21,422 So, we are installing the client 315 00:16:21,506 --> 00:16:24,310 part here, not the server package. 316 00:16:25,650 --> 00:16:29,650 All right. So, once you do yum install ftp, it 317 00:16:29,700 --> 00:16:32,650 will go online, check for the package. 318 00:16:33,330 --> 00:16:36,110 And it says Running transaction check. Package 319 00:16:36,170 --> 00:16:37,570 this will be installed. Perfect. 320 00:16:37,620 --> 00:16:38,710 This is what I want. 321 00:16:38,820 --> 00:16:40,642 The version number so and so. 322 00:16:40,716 --> 00:16:46,020 And the size has been 61 k. That's perfect. Go ahead. y. 323 00:16:46,020 --> 00:16:52,930 [No audio] 324 00:16:52,930 --> 00:16:55,530 Okay. Transaction test succeeded. 325 00:16:55,590 --> 00:16:58,274 Verifying it, installing it, verifying it, 326 00:16:58,312 --> 00:17:00,098 and completed. Beautiful. 327 00:17:00,184 --> 00:17:02,894 So now, if you type ftp, and just simply hit Enter. 328 00:17:02,992 --> 00:17:05,714 You see, it actually took that command and 329 00:17:05,752 --> 00:17:09,642 it brought you into the FTP interactive session. 330 00:17:09,786 --> 00:17:11,366 You don't want to use that right now. 331 00:17:11,428 --> 00:17:13,069 Just click bye so you could get 332 00:17:13,117 --> 00:17:15,182 out and get your prompt back. 333 00:17:15,376 --> 00:17:19,814 Now, I want you to become iafzal again. 334 00:17:19,972 --> 00:17:22,490 You could do su - iafzal, 335 00:17:22,540 --> 00:17:24,579 or of course, in this case, it's yourself, 336 00:17:25,390 --> 00:17:27,540 or you could just simply do exit and it 337 00:17:27,556 --> 00:17:30,640 will bring you back to your own user account. 338 00:17:32,109 --> 00:17:37,758 All right. So if I do ls -ltr, these are the directories 339 00:17:37,914 --> 00:17:44,358 and files I have right now in my home directory. 340 00:17:44,454 --> 00:17:46,538 So this is home directory. Okay. 341 00:17:46,684 --> 00:17:51,349 Now, I want to create a file called touch kruger. 342 00:17:52,690 --> 00:17:53,910 It is created. 343 00:17:54,030 --> 00:17:57,170 If you do ls -ltr you see it has zero bytes. 344 00:17:57,850 --> 00:17:59,990 Right here it says zero bytes. 345 00:18:01,510 --> 00:18:03,314 If you want to add something to it, 346 00:18:03,352 --> 00:18:07,670 let's say, I will do ls-ltr, 347 00:18:08,470 --> 00:18:10,850 I'll output that to Kruger. 348 00:18:12,250 --> 00:18:19,230 Perfect. Now when you do ls -ltr now, it has total of 517 bytes. 349 00:18:19,350 --> 00:18:21,698 If you do cat on kruger, you're going to 350 00:18:21,724 --> 00:18:25,626 see basically the output of exactly ls -ltr. 351 00:18:25,758 --> 00:18:29,630 Anyway, why did I do that? No reason. 352 00:18:29,800 --> 00:18:33,282 I just wanted to have some information in that file. 353 00:18:33,426 --> 00:18:36,050 You could have done vi and typed in something else 354 00:18:36,100 --> 00:18:44,099 like vi kruger, like, This is my file blah blah. 355 00:18:44,590 --> 00:18:47,618 Anyway, I just wanted to populate the file with 356 00:18:47,644 --> 00:18:50,574 some information so it won't be zero bytes. 357 00:18:50,682 --> 00:18:55,454 Now, right now it has 545 bytes. All right, beautiful. 358 00:18:55,552 --> 00:18:58,302 We're moving along. Now, we have the file. 359 00:18:58,386 --> 00:19:00,266 Now the question is, I want to 360 00:19:00,328 --> 00:19:04,250 transfer that kruger file to the server. 361 00:19:05,350 --> 00:19:06,698 Then the server is the one 362 00:19:06,724 --> 00:19:11,286 where we installed that FTP package. 363 00:19:11,418 --> 00:19:15,318 So in order to transfer the file over to the server, 364 00:19:15,354 --> 00:19:18,270 we need to know the IP address of the server. 365 00:19:18,390 --> 00:19:20,154 So I'll go back into my server, 366 00:19:20,202 --> 00:19:21,410 this is my server. 367 00:19:22,330 --> 00:19:25,250 For the IP address, I'll type ifconfig, 368 00:19:26,230 --> 00:19:28,922 and if I move up, you're going to 369 00:19:28,936 --> 00:19:32,330 see the IP address for enp0s3. 370 00:19:32,380 --> 00:19:36,206 The assigned one is 192.168.1.58. Perfect. 371 00:19:36,268 --> 00:19:37,430 We got the IP address. 372 00:19:37,540 --> 00:19:43,060 Now I'm going to do ftp 192.168.1.58. 373 00:19:44,290 --> 00:19:45,280 Hit Enter. 374 00:19:46,690 --> 00:19:47,882 Beautiful. There you go. 375 00:19:47,896 --> 00:19:50,394 It says, Welcome to blah FTP server. 376 00:19:50,442 --> 00:19:51,566 See that blah thing? 377 00:19:51,628 --> 00:19:53,102 I told you if you wanted to put 378 00:19:53,116 --> 00:19:55,670 it beautiful here, it would show beautiful there. 379 00:19:55,780 --> 00:19:58,274 Okay, so anyway, it says name and 380 00:19:58,372 --> 00:20:01,098 IP address and the username is iafzal. 381 00:20:01,134 --> 00:20:04,298 So by default, it picked the username that 382 00:20:04,324 --> 00:20:06,482 I've been trying to FTP it over. 383 00:20:06,616 --> 00:20:08,018 If you wanted to use a different 384 00:20:08,104 --> 00:20:10,586 username, then you will specify here. 385 00:20:10,648 --> 00:20:13,190 Let's say you want to use john or whatever, 386 00:20:13,300 --> 00:20:15,206 but I wanted to use my own name, 387 00:20:15,328 --> 00:20:16,550 so I'm not going to enter anything. 388 00:20:16,600 --> 00:20:18,578 I'm going to leave it as default, and 389 00:20:18,604 --> 00:20:20,440 I'm going to go ahead and hit Enter. 390 00:20:21,130 --> 00:20:22,470 Please specify the password. 391 00:20:22,530 --> 00:20:25,490 This is the password of your iafzal account 392 00:20:25,660 --> 00:20:29,450 to that server or to that remote machine. 393 00:20:29,450 --> 00:20:32,390 [No audio] 394 00:20:32,390 --> 00:20:35,122 It says, 230 Login successful. 395 00:20:35,206 --> 00:20:40,534 Remote system type is Unix. Using binary mode to transfer files. 396 00:20:40,702 --> 00:20:43,710 Perfect. Now, what I need to do, I want you to type 397 00:20:43,760 --> 00:20:48,690 bi or bin as switching to binary mode because you want 398 00:20:48,740 --> 00:20:52,294 to transfer the file always using FTP through the binary mode. 399 00:20:52,402 --> 00:20:53,492 That is fine. 400 00:20:53,492 --> 00:20:57,642 Then I want you to type hash, hash, meaning when you 401 00:20:57,716 --> 00:21:02,922 do the transfer, show me the hashtags, which will tell me 402 00:21:02,996 --> 00:21:06,510 that there's a progress going on in hashtag progress. 403 00:21:06,890 --> 00:21:08,734 Now time to put the file. 404 00:21:08,782 --> 00:21:13,446 So when it's time to transfer, you use the command put 405 00:21:13,508 --> 00:21:18,150 because you are going from A to B and do kruger. 406 00:21:19,970 --> 00:21:20,960 Hit Enter. 407 00:21:21,590 --> 00:21:25,254 Right here it says, as soon as you hit, 408 00:21:25,352 --> 00:21:30,906 put kruger local, kruger remote, Entering Passive Mode, 150. 409 00:21:31,028 --> 00:21:33,190 Okay, to send data, hashtag, 410 00:21:33,250 --> 00:21:34,486 remember, this is the progress. 411 00:21:34,618 --> 00:21:37,398 If it was a huge file, you 412 00:21:37,424 --> 00:21:39,274 would have seen so many hashtags. 413 00:21:39,382 --> 00:21:40,866 226 Transfer complete. 414 00:21:40,928 --> 00:21:42,322 545 bytes sent, 415 00:21:42,466 --> 00:21:46,338 this is the size of my file. 545 sent, 416 00:21:46,484 --> 00:21:47,754 succeeded. Perfect. 417 00:21:47,852 --> 00:21:50,862 Now you could just do bye. Now you 418 00:21:50,876 --> 00:21:52,770 are back out to your machine, now 419 00:21:52,820 --> 00:21:54,318 do you want to confirm on 420 00:21:54,344 --> 00:21:56,814 the server if it's been transferred? Of course. Yes. 421 00:21:56,912 --> 00:21:58,230 Let's go to server. 422 00:21:58,670 --> 00:22:02,182 I am in my home directory nad let's do ls -ltr, 423 00:22:02,266 --> 00:22:04,738 and you're going to see right here, this is kruger. 424 00:22:04,834 --> 00:22:06,260 This is the file transfer. 425 00:22:06,830 --> 00:22:09,858 That's how the FTP file transfer works. 426 00:22:09,944 --> 00:22:13,066 I hope this lecture actually has served its purpose. 427 00:22:13,138 --> 00:22:15,306 And you know how the FTP works. 428 00:22:15,368 --> 00:22:16,926 If you have any questions, please 429 00:22:16,988 --> 00:22:18,762 do not hesitate to contact me. 430 00:22:18,836 --> 00:22:20,166 I'm here to help you. 431 00:22:20,288 --> 00:22:23,674 So let's go and work this FTP 432 00:22:23,722 --> 00:22:27,393 server to learn this thing together. Good luck. 433 00:22:27,393 --> 00:22:29,611 [No audio]