Linux NFS Server and File Transfer Protocols | Imran Afzal | Skillshare

Linux NFS Server and File Transfer Protocols

Imran Afzal, Systems Manager / Instructor

Play Speed
  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x
5 Lessons (1h 25m)
    • 1. Course Overview

      1:57
    • 2. Network File System NFS

      36:45
    • 3. FTP File Transfer Protocol

      22:29
    • 4. SCP Secure Copy Protocol

      7:56
    • 5. Rsync Remote Synchronization

      15:55

About This Class

Learn how to download, install and configure NFS server in Linux.  Also learn most used file transfer protocols

Transcripts

1. Course Overview: Hello, everyone. Let's look at our course review and courses about Lennox NFS server and file transfer protocols. So let's see what we're going to cover. The first and foremost the main topic that we are covering. And this course is about network file system, in short, also referred as to NFS. So we will learn how we could download and install the NFS server. That includes downloading the package using RPM or jump command and then that will go through the install off that NFS server. They will talk about how we could configure the NFS server and then we'll do create some directories and we will share that file system over NFS and then under clients, I will configure, declined and eventually mount those NFS shared directory to the client So this baby could share file system from one system from one server to another. Additionally, I am also including the file transfer protocols, meaning how you learn how you could transfer that over. FTP will learn how we could set up an FTP server and then how we could transfer files through FTP. We'll also talk about the SCP, which is secure copy from one server to another. And the last one, which is part of the file transfer protocols are our sinks, and our sink is to again copy file from one server to another. All of these, if you notice, are the protocols are the actual service which are used to trash your files from once over to another. So these are the main topics that will cover, so hopefully you'll enjoy it. I will also include a few other topics later on, but for now, enjoy. And I'll see you in the actual ah videos later. 2. Network File System NFS: network file system, which is also stands for NFS. This is one off the biggest and major topics, and I am including this lesson in our in our module off disks because it is actually about sharing your disk or sharing your directory or sharing your files with other computers and other users. So network file system, as I have explained you previously, there are different type of file system, like E x t two, txt three X fs and TFS and Windows are F A T fat file system. That's all. Turn windows just like that. There is another file system that is called network file system. Now this file system again, it's not local to your computer. Um, it's called Nass, which is also a network attached storage. So NFS is part is one of the protocol is part off Nass. So let's see. NFS stands for network file system Ah, file system developed by Sun Microsystems. Sun Microsystems. A few guys don't know this. This was a company who actually had ah, one of the biggest operating system called Solaris. That Solaris operating system, um, runs on UNIX environment, and it still exists. But now Sun Microsystems is being bought out by Oracle anyway, Our focus is not son or Oracle. Our focus is NFS, which is one of the Lennox organic services to share your file system between servers. Now it is a client server system that allows users to access files across a network and treat them as if they resided in a local file directory. It's just that simple. When you mounted from one system to another, the other system will see it as if it actually mounted locally on its own system. Now, for example, if you were using a computer links to a second computer via NFS, you could access files on the second computer as if they're resided in a directory on the first computer. This is accomplished through the process of exporting. So you export from the server that is sharing the follow system the process by which an NFS server provides room or clients the access to its files and mounting the process by Rich Client, which is the other computer. The other end climb map NFS sheared file system. So this is how basically NFS works and I hope you understand. If you do not understand and you still confuse what NFS is. Please, don't worry. I'm here. Don't worry about it. I will take you every step, step of the way, and I will show you how NFS works. Okay, So now let me show you real quickly through the pictures through the diagram, because pictures speaks 1000 words, right? So you have a machine, a computer. It's probably nowadays it's could be either Lennox or could be UNIX or could be Windows. This machine wants to attach ah, file system that is being shared from another computer. So what it does is it sends an NFS request that NFS request goes to a server that is hosting that file system. So if that file system it's hosting that's ABC file system or whatever the name of the file system that is being hosted on the server, then based on the rules that are defined on the server meaning the policies which server to share with which server to trust and all that once that is satisfied, then the server is going to send approved request back to its client. It's going to say, Hey, I know you are asking me to share my file system with you. Now, First of all, let me see if the file system that you want me to share with you if I am authorized to share first of all second, if you are authorized to view that fall system. And of course, there are other options that can be defined, which we will discuss literal going on network file system. What are the steps that we need to do while there is a server that is going to share its file system? And then there is a client which is gonna mount that file system, right? So what other steps we need to take on the server side. So and this in these slides, I'm actually going to show you What are the steps we need to take once I'm done with this slide than actually our log into the machine and we'll do there will work, So steps are first on the server side. Now we need to install NFS packages, and those NFS packages are NFS dash your tills lib NFS I d map these other two packages that you need, um, on your latest, um, red hat or sento us words in seven servers, most likely they are installed in your machine. But the way you could check it, you could check it by running r p m minus Qiwei and groping for NFS. And you will see if these packages are installed. We'll check that together. So no worries. Next thing you have to do once these packages are installed, enable and start NFs services. So you know that every enabling, any service, meaning you are telling the service to start at boot time. So you want these two services to start at boot time. That's why we are using the option enabled once we enable them. Then I'm going to start the services RPC bind NFS server, RPC stat D and NFS I d. Mapped. These are four services that I want to start. I put them all in one line, But make sure you, when you are running your command, they shouldn't be in one line because it will give you an error. I am trying to save some space here. That's why I'm putting everything in one line. Okay, moving on, then create NFS sheer directory and assigned permissions. So once we are on the end of service, we're gonna create a directory or if you already have a directory that you want to share, then you don't need to do this part where you have to create and assigned permissions. So in our lab, we're assuming that we are creating or you're sharing a new file system, a newer directory. So I'm I'm gonna name it my pretzels, and I'm gonna assign the permissions off that to my pretzels. So my pressel, I just picked a name. You could pick anything. I like this word pretzels, because that's one of the my favors lines from Seinfeld that says these pretzels are making me thirsty. So I just picked that name anyway. Then we have to modify the permissions for that. My pretzels directory. Then we had to modify the export at sea export file because the reason we wanted to modify that is because if you want to have this file system to be shared, I have to have certain option it. So as you could see, I have put in the I p address one I to 1 68 Wanda 12 7 It means I want my pretzel to be shared only with the server that has this. I p and it will have the read write permission. So let's look at them one by one. So here is my NFS year. That's the NFS sure that I'm sharing. Then here is the I. P. Address off the client machine. From whom which I'm going to share my file system with now. What if you wanted to share with everybody? Then you go to simply put star the gastric? Yes. Then next thing read and write, you are giving permission to your clients to read that fall system as well as right to it. Then there's another option. Sink Sync is telling that all changes to the to the according classism are immediately flushed to the disc. Their respective write permissions right operations are being waited for, So don't wait any any longer. When you're writing to this file system for my client just right into the dissuade away, then the last option we have right here say's root on the client machine will have the same level of access to the files on the system as a route server. So the root server, which this NFS servers coming from, will have the same permissions as a client route so that's what it's saying. So now, of course, this is for one host because we have specified the host name or the I P address. But if you want to specify everybody, not just one computer than you would use Lennox Miley next year. Oh, sorry. This is not my Lennox. Here. You have to change it to my pretzels. I had it using before Miley next year. But to make it mawr meaningful, uh, change it to my pretzel anyway, if the Miley next year, whatever the length here is Asterix and the entire line off options, that is to give it to everybody. Then once that is done, you edited the etc export file. Then you export the NFS file system by running the command export F s space minus R V. So what are these different options are is to republish everything that is inside, off etc. Export and V is to show over boss mode. So I hopefully you understand. This is the NFS configuration on the server side, the server which is trying to share its file system. So in our in our example, our NFS server is ours over server. Our lab server that we have built for this training. And remember, the hosting for the lab server is my first Lennox VM. Right? This is the That's the one we created, right? So let me go to my Lennox PM and Mitt Log in real quick, okay? And just to host name you see, my first Lennox P. M. This is the Lennox we m that we've been working on. Right? So this is going to be our NFS server where we will create our file system to be shared with other servers. Okay, so now we will export it. We will enable Sorry. You install the packages enabled these services start the services, create what we need to create what we need to share, change permissions, then modify the etc export file to have that shared moving on to the next light. Now steps for NFS Klein configuration. Now, of course, you have one services my linen. My first line. Ex PM. Right, That server configuration. Now we are going to create another machine that will actually mount that file system on its mounted point. Whatever that you need to define. So what we're gonna do is begin install these packages yum install. And if Sutil rpc bind same packages as NFS server, then we're going to start. Once the packages are installed, enable and start RPC bind service. You have to make sure Onley this service that you have to be up and running RPC bind start Then, um, make sure there's no firewall or I p Tables are running in your system. The client. Then we will do a short mount Command to see what is available for enough for me to mount, then create a mount point like m k d. I r slash mt slash ap or slash mt slash Let's say Cramer whatever that you want to do, you could do that just like that. I have it right here. Some mountain, the file system like mount the name off the I P address off the NFS server slash my pretzels, which is the first shared file system mount to Cramer or Mount to app or what? Ever The mount point that you wanted to make then verified amount of file system by running the command DF minus age and to unm ound that file system is you mount slash mt slash creamer. So that's it folks, enough talking now. I'm sure you probably heard a lot of things. Now let's do the real work. Let me go back to my and if a server configuration and that's where we're gonna start off it. So I am going into my Linux machine. And the limits machine is my first Linux VM. How I'm logged in. Who am I? And which directory on men and which host I am on verified everything Perfect. Now go hadn't become route. Okay, we are route now. Before you install these packages, you could run rpm command to verify if the's packages already exists or not. And you see, it tells you that NFS does you till and lib NFs i d map are already installed. Now, if you try to install it with young commander to yum installed and a fest dash you till you tills it will go out on the repository. But I will say right here, See this package And if a util already installed and has the latest version perfect Soviet , we we've been through the first insult NFS package. Okay, done. Second thing we need to enable the rpc bind an NFS server service so took the command to do that system. CTL enable rpc bind Perfect. You get the prom back, It means it worked. Then you do the same thing by doing up a rookie instead of rpc bind. Do NFS dash server because it's NFS Dash server, right? Yes. Hit Enter. Okay, created Symbolic link. This this this Why didn't create it before? Maybe we have already or I have already enabled that rpc buying previously and that's why the link was there. But anyway, I am enabling this NFS taxable for the first time. And that's why it's saying created symbolic link, which is what it's supposed to do. Okay, anyway, so now the time to start the service system. See Thiel, start RPC bind. Look it started. See? Didn't give me any error message if one If I wanted to check the status of that service A loose status system CTS status RPC bind and you'll see it says right here, active, loaded and running. This is what we wanted to see. Perfect. Now next service I want to start is and if s dash server See right here It's his NFS dash server hit Enter. They should start the service RPC Dash That d right has confirmed rpc dashed at D. C s hit. Enter Okay, is up and running. Perfect. And I could just do start again. It started. I'll check the status running. Okay. Perfect. Next one NFS i d map d It started. Now let's check the status active and running. Perfect. Now it's time to create our shared file systems. So I'm gonna go into my CD slash directory. You see, I am in slash cd slash just slash Now I'm going to create a directory Cold make the I r. My brittles. Okay, I am in slash and unless minus l and you will see it is created right here. I could do ls minus. Lt are to see it at the bottom. Now I need to assign the proper permission. So I'll do change. Mar a for all plus r w x my pretzels hit. Enter. See, these are all the rights. Okay. Perfect. No, I already have my directly Let let me go into my pretzel threat. Okay. What's inside My pretzel director? Nothing right now. Okay. I could create a couple of files like Touch A B c. All right. Perfect I could also create a file called Touch Cramer and I could echo into the fall. These print Oezil's are making me thirsty, and I'm gonna output to cream Cramer file Perfect. Let's echo creamer file cat. Sorry, Cat crema file and you will see these Pressel are making me thirsty. Now, this directory, my pretzels, has how many files? Four ABC and Creamer. So that's good enough for our testing. Now what we need to do next thing we have to edit the etc exports. So we I at sea exports. Since we are doing that for the first time, you will see this father's empty. Be very careful to modified. I always What I will do is I always do copy at sea exports and then at sea exports underscore I put a date in, like, 0808 2020. So this way, if I make a mistake, I could always copy it back to the original version. For now, I could go into V i X export, but anyway, this was empty. So now what? I want to export. First of all what? I'm trying export. I am going to export slash my pretzels. Okay, perfect. Who am I exporting it to? I wanted to export it to everyone if you wanted to export it to you other Lennox machine, which we will build later on. And you want You have the i p. And you want to come back here and specify the i P. You could do it. But for now, I'm just gonna do Estrich now. Then I have to specify ass trick. Parentheses are w read, Write comma, sink, comma No underscore route underscore squash and that's it. This is what we need. So if you guys, I need to know the exact instructions, I will try to put it in this entire instructions right here. You see, on my slide, I'll put it into the the notes folder. The north section. Okay, so now that file is edited. Go ahead and saved out file. Perfect. What? We need to do the last thing. Export that file system. Okay, go ahead and type the command export five system dash, Are we again? Are stands for to republish everything. Whatever's in their publishing again doesn't I don't really care and I ve is devore boss mode had enter. And now it is telling you that exporting it is exporting the file system toe everybody. And the false system is my pretzels. Okay, so you have created it. Your NFS server is ready. It is exporting to other machines. Now, the question is, I do not have another Lennox machine to test mounting this file system to another machine. So what I'm going to do is I am going to build another machine which is going to be client , and I will show you how to build at this. The whole thing I'm gonna do by building this another one the next machine. I'm gonna do it really fast. I'm gonna fast forward it because since you guys have already, um, have experience off creating another Lennox washing machine. So I'm gonna go do it really fast. So right now, if you could see if I go into my oracle Veum worship box, then I'm gonna go ahead and create new I'm gonna name it. Ah, Monk, monks, monks is a name off Seinfeld. Show that there, That's a restaurant where everybody goes. So it's like a shared environment. I'm using this as, ah client name. So monks and Windows Microsoft Windows. I'm gonna pick Lennox because you're belittling it's machine. And now pick Lennox 62.63 dot x four x 64 bit Now go ahead, click Next memory size Lee with default. Create new disc your disk dynamically created. Next. You already know that the size of the disk that will be created eight Gig, leave a default Create It is created Now, Monks, VM is creating. I'll go ahead and power on this is asking you Where is your eyes? So image remember we actually downloaded are sent Os Isa image. If you do not have that eyes an image right now, it's OK. You could go ahead and download again from the internet. And once you have downloaded, come back and start again from this lesson on how you could select it. And I'm sure you know this how to select it. So here, go ahead and pick the location. I already have the location pick and it as this window sent Cento a seven. I'm gonna click open and start Now this is going to start, um, installation. It's by default, tells you this test media and it's all centers, so go ahead. Hit up Iraqi and click on Install Santo us and hit enter. Okay. From this time, from this point on, I am going to fast forward the entire installation because you notice I am going to pick the minimum install. What minimum install means that there is not gonna be any green stalled. I don't really need greed at this time. I just want to test my mounting and if s file system. And that's why I'm gonna leave a default. The installation destination. You click on it and select a disk and leave everything as is automatically configure petitioning. Go up and click Done and then come down. You'll see the network host name. This is not connected. Click on it. Go up, Turn this on and now give it a host name. I picked the VM host name is Monk somewhere they use the same name Monks click Apply and it will say the current host name is monks go up, Click Done. So everything is set up America's New York time zone. You could pick a different time zone according to your region Language insulation source Local media software insulation minimum As I said, we don't need agree and we don't need any other extra software's come down installation destination. We picked it already. Which is the default. Everything's default and alcohol and click begin installation. Once it begins installation, click on root password. Specify the root password. If it's weak, you would have to enter. You have to click. Done twice. Use the creation. I don't want to create any user right now. Okay, so now you'll see it is going through the installation process off installing 303 packages . And right now it is at 15 packages, so it's gonna take time. I'm gonna go fast forward again from here. And when we come back, we should have ah built up machine. All right, everyone, our machine, the second machine client monks is being built. Go ahead and log in as root. So now checked the i p. Address of this machine. Okay. It does not have the number of utilities that you need to check the config, but there is another command that we learn previously. Its i p p a d d r. Yes. So you notice you have an i P address off $10.0 15. So if your I p address is different in the other servers. Let's check our server. My I p address here is if config it is 19 to 1 $61.18 and its i p address the other machines. I Pierre is different. The reason is we have to change the setting on the virtual box. So that's the machine. Go to setting grew network. And you see it's right here says attacks to Nat changes to Bridget Network adapter and broad can extreme gigabit Ethernet. If you have a wife, I you picked that one click. Ok, now it should have a new address. If it doesn't end, run the command system CTL restart Network It has restarted. Now you check I p a d d r and you will see the new I p I have right here is one I to 1 $61.11. So, from here, make sure you do press it right. Click to get out of this machine. Um, box so you could go ahead and pink 1 90 to 1 68 Rwanda 11. Just to make sure you're not 1 11 make sure you go ping it. Yes. You see you getting a response back. Perfect. So now let's go back to our machine. Also try to do pink www dot google dot com to make sure your machine can get to the Internet. Yes, it can go to clear the screen. Now we'll get back to our lesson where we have to actually go to the client so you have to insult. And if, as you till rpc bind, um installed NFS stash you till if on one package 15 dependency, Go ahead Hit. Why? As yes hit. Enter Perfect. It's finished Now. The next thing we have to do our PC bind yum install RPC bind one would. And this time do minus y option. Okay says it's already installed. Perfect. So we don't need any of thes more packages. So now what? Next we have to start that RPC bind service seduce instead of service. You have to do system CTL because service is an older commander works with Red Hat six or Santo a six start RPC bind. It has started. You could check by doing PS minus CF Group RPC, and you'll see it is up and running. Now let's make sure the firewall or I P. tables, not running PS minus F e grip, fire will or I p table. So we see the, um both know only firewall D is running, so let's stop that. So, system, see, Thiel, stop Firewall de this is going to stop that Also disabled that service to start at boots. Okay, it is deceived. She'll mount Show amount. From which machine? Show mt minus e. What is the I P address off our, um, other server and fs over machines. So let's go to our other manifest machine and check our i p address. If config r i p address. Whichever the command you prefer. It's one night to 1 $61.18. So let's go back and do show mount 1 90 to 1 68.1 dot 18. And this should return what is being shared from that server. Okay, it's saying unable to receive error number 113 No route to host. So let's pink. First 68 don't wander 18 coping Get. But I cannot It's not showing me the mount The check on the service side If the server side is running I p tables. Ah, So there was a fire wall on the server side that is running. We have to disable that. Okay, so now that fire was disabled, Let's check on the client side again and see if he could be the show. Mt. Ah, perfect. Now we see the show mount. So now let's go to our document. We have where? Fight it. Now we have to create a directory where you have to mount it on our client. So let's clear the screen and now create a direct treat. We call it M k D. I r under MNT will call it Cramer. All right, so let's do Ellis my cell and Manti will see the creamers to to the Mount Mount 1 90 to 1 68 That Wanda 18 colon slash my pretzels and map it where? Map it to mount slash Cramer. Okay, we got the problem back. Perfect. It means it did mount a DF minus h or type. Define station and you'll see right at the bottom is coming up as MNT Mount creamer. Now if I go to CD slash MNT Cramer and to Ellis Marcel tr You see, I have the same files now that I created on my server, which is right here. And if you go to seedy, um, my pretzels, That's my cell TR. So these are the file system. So now, if I wanted to write something to this, let's say from the client side, I'm gonna create a file called Touch um David Hit, Enter verified and it created on the client side. Now let's see if it shows up in the silver side and you see it showing up on the server side. The last thing that I want to cover here is you verified it. And if you want to amount that from the client, then you could just simply do you mount slash MNT slash Cramer yuk amount the Mount point. Or you can mount the file system, which everywhere you like. So when you hit enter, it's going to say devices busy. Why? Because you are already inside off the director. So you get out of the directory to CD hit. Enter now You're not in that directory. Now up a rookie and do this you mount and has amounted to do a DF minus age and you'll see it is not there. It is gone. So, guys, that's how you do the NFS try it. It's a very, very important lesson and a lot of people ask for NFS US services and I I'm including this in this training because a lot off students have asked me on NFS. So that's why I decided to create that for you. How right, guys? Good luck. 3. FTP File Transfer Protocol: hype in this lesson, we're going to cover FTP, which stands for file transfer protocol. The FDP is a standard number portal closures for the transfer of computer files between a client and a server on a computer network. FTP is built on a client server model architecture using separate control and data connection between the client and the server. This is the definition that I have. I have actually got it from exactly from Wikipedia in very simple words. And FDP is a protocol that is used to transfer ah file from server A two server be. Now that the Pearl call is actually a set of rules used by computers to communicate that that's a pearl call that tells the computer Hey, this is how it should be transferred. This is the poor that you should use. This is encryption that you should use. These are all defined rules that are already built in. But then a computer and operating system for the FDP. The default FTP poured is 21 just like for Ssh, we have 22 for DNS. We have 53 for many other services that we run in the next for FTP the use port 21 to communicate for one server to another. Now, for this lecture we needed to Lennox machines. Um, if you do not have to links machine, I would recommend you that you should go ahead and build another Lennox machine running Cento s, which could be exactly the same one as you had previously. So my first machine that I've been using is my first Linux VM. This is Ah, host name and the second machine that I created and I'm referring it to as the host name as Lennox Cento s seven. It's just a word. It's just a name that I picked. So anyway, I'm sure you already have my first Linux VM cento s v m. And what you need to do is to install another Lennox Reum. So if I give you a quick information on the ARCA virtual box, you see, this is the first vm that I was running and this is the information it has. Um, one gig mint machine 10 gig, remember? Sorry. Dis space. That second machine that I'm using as a server is also has this meat. Same specifications 10 gig one get everything. Exactly the same. Even I'm losing the same version of Santos as well. So But I am using a build a 2nd 1 so we could go through this. Let this Lex lesson. Sorry. All right, So to put in a graphical way, let's go into detail. So we have a A client. A server that needs to send a file to another server is called. It's over A and several B. And whenever you have one server trying to connect to another server, that recipient becomes a server and the sander becomes a client, so it wants to send a file or FTP protocol. Now, if this is the recipient server, if it's not running any kind of listening service to receive that protocol, then it's gonna reject that, um, that transfer. So we need to make sure that it is running ftp de demon or the service or the application on that server, and by default, whenever we run it, it will start up that service on poor 21. All right now, what is the process to actually configure that on Klein and server? So let's look at the server side first. So here are the quick step that will cover to do the installation configuration off FTP on the remote server. Um, after becoming a rood, will check of the house FTP server installed Will check If you have Internet connectivity, will install the V sftp deep package on the server and then we'll modify the V sftp D dot configuration file and in that file will make certain configuration changes, and these changes are here listed. We'll go over them one by one, and that will start. The service will enable the service it could start a boot time. Ah, will stop the firewall d so the communication can take place between sober eight and several B. If you wanted to leave yours of horrible d up and running, then you have to add a rule for it to allow to accept port or traffic 21. So traffic on port 21 you could find that online how to add FTP, um, port on the firewall D. And then you could disable that firewall D. If you're not using it, just disable so it won't start back online. And the last step is, of course, make sure you create a user account on that FTP server if you do not already have it because that's that's that Comey will use to transfer file from Celebrate Too Soon. Will Be and the Last Port Are part would be the will install FTP client on the client server will become ruled Yemen Saul FTP become a regular user and then we will create a file called Krueger. Now, this is just a regular file. You could actually use any file name you like. You could pick pizza, pasta, whatever the finally. But if you want to be consistent, staying with the just make a file called Krueger Once with filers created, then we'll ftp to the server who enter our credentials, will put in a B I for binary hat and then had for hash tagging that so you could see the progress and will use the command. Put Kruger once it's trash for them to be simply type of bias to get out of that FTP process. All right, so now let's let me go back to the installation process off FTP on the server. All rights, as I said, for that I have a client, which is my first, and it was just the very first Linux VM that I created and I called it my first of the next PM And then I have another machine that I'm using for this lecture purpose. And then that that machine I'm calling Lennox Center s now in this machine. Once you have it built and configured, I want you to become route. By the way, I was logged in as myself. So if I exit and I do, who am I? You're going to see that on this server. I have already created an account I absolve. So if you do not have a camp during the installation created, go ahead and create it. If you have it good and become rude after becoming rude, of course you could do who am I just to confirm of which is residual logged? And as now you need to install the FDP demon or the FDP service on your machine before you install it. Check if it has already been installed. So I recommend you type RPM deskee way and group for V S f t p d. This is the name off the package that needs to be downloaded. Okay, it is not downloaded, and it has not been stalled. So I will run the command before I run the command. Or before I go out on the center s repository to install it. I wanted to make sure this machine that I'm logged in right now has Internet access. So I'll do. Simply paying a dub dub dub dot google dot com. And you see, I'm getting a response back. Perfect. It means I have Internet connectivity. Now I'll go ahead and do jum installed v sftp d now disk. A man is going to the older repositories and it is checking. Hey, do you have the S f D ppd package that I need to download and then installed? It did. It did go there. It checked, and it says, Yes, I do have it. And this is for architecture 64 but And the version that I have the latest one is 3.0 dot to do you want to download and the sizes 1 71 case? Yes, I do want to download. So simply type y and hit Enter is saying downloading package and then it's saying it has a fingerprinting, some information, some security information. Is this okay that comes with the package. That is fine. Go ahead and click. Yes, Running transaction check running transaction test. It will go through the process off fetching that package, downloading the package, installing the package and then verifying the installation. And at the end, you say it is completed and verified. Of course. Now, if you run that same command rpm desk, you away and grow for V S f d p d. You will see it will show up the package that is installed. There you go. This is a package that installed So we confirmed that it has been downloaded and of course , it is installed. Now we need to configure it. So every time you hear the word configure, it means we have to configure it on the configuration file. The configuration file for FTP server is at CVS, F d p d slash ves ftp d dot com file. So, before I modified, I always recommend that you make a copy off it. So let's go to see d v sftp d do ls minus. L t r. And you will see this is the file. Now, I want you to go ahead and make a copy of that So copy CPV sftp d dot cough the sftp d doc off dot or Ridge, This is the name I usually pick to make a copy as its reads. It's will tell me that this is the actual original thought. All right? The copy or the backup has been created. Now I need to modify that follow v sftp d dot call. Well, and now I have to go through these parameters that I have listed on my slide it to modify these parameters. The first thing is fine the following lines and make the changes as shown below Disabled Anonymous. Log in. So I will search for slash a and O and M. Sorry. Y m O U s anonymous. It took me to the first word because I'm doing a search within B. I took me the first word, but this is not the line that I'm looking for. So I'm gonna hit and need to go to the next one, and there is, says, anonymous underscore enable. And it is yes. So go ahead and remove that and put no, because you don't want anyone else to come into your FTP server as anonymous. Good. Next parameters is A S C II A scuzzy ice. Ah, And now you have to uncommon these two lines. Upload enabled. Download enabled. That's perfectly fine. Now come down to where is his F t p D? Search for that? And there is his f DPD underscore banner. Welcome to block FTP server. That is fine. And you could remove that uncommon t'd. Now, if you want to change to welcome to Bly FTP server to welcome to my beautiful FTP server. That is fine. You could do that. Now, the last thing it says add at the end of this file, if you want to go to the end of this while you have to press shift E g and it will take you to the end. And here I'm just gonna put first. I'm gonna put comment as local time, and I'm gonna put in that parameters. Says use underscore. Local time equal. Yes, Perfect. That's Onley. These are the only configuration changes you have to make. I'll go ahead and save the file. Perfect file is saved. Now it's time to start that V sftp de service. And for Dad, we have to use the command system. CTL start v sftp d It is started. Let's check the status if it is actually started or not. Yes, it say's started. See, Active here. Beautiful. Now I want to enable that. So every time my system reboots, I don't have to go back and and start that service manually again. I, wanda service to start every time the system reboots. And for that I have to use the command system CTL space enable V S f d p d hit enter. And it is It has been enabled Now Perfect. Now I want to disabled the firewall on this server to disable lead. I'll use the commence before I disabled. I need to stop it to stop firewall D. Now, As I said earlier, if you do not want to disable firewall D which I don't recommend you, I'm disabling it because this is my lab environment. So I'm okay. So if you're in a production environment and you have, I will de running, then you need to add the rule toe. Allow poor 21 2 in as an incoming traffic for their firewall. Anyway, going back. Let's stop the far wall de because I'm using my lab and I'd really don't need that. It is stopped. No, let's check the status. See? Right here it say's inactive. Dead. Perfect. Now I want you to disable it. Meaning every time My computer reboot. I don't want this service to start back again. It is disabled. Perfect. Beautiful. We did out work on the server side. And the last line you're going to see it's his user at I absolve if the user does not exist already. I mean, I do exit out off the root and I do Who am I? You see, I already have an account. My account IVs all on this machine. So I don't need to recreate if you do not have the account or if you do not have an account that you will be using for the FDP purpose that I want you to go ahead and create an account. Anyway. So this is the configuration we followed on the ftp. Sorry. On the FTP server. Now we have to do a few things on the FTP client. So the client needs to install ftp the package and for to do that, let's go in to our client and my client is right here. This in my first links via perfect. Now here. If I become route whether I was logged in as I absorbed. Now if I run FTP command, you see it say's bash FTP command now found the reason it is not found because I do not have the ftp Klein installed. So I need to install decline. No, of course. As I said, Always checked to make sure you have Internet connectivity and for that pink any website that you like online and it say's I am getting their spots back. Perfect. Now I could go ahead and do jum install ftp now. This is not the V sftp d. This is f'd piece of Eden year insulting the client part here, not the server package. All right, so once you do John men stall ftp, it will go online. Check for the package and it says running transaction check package. This will be installed. Perfect. This is what I want. The version number so and so. And the size has been 61 k That's perfect. Good. Why Look, a transaction tests succeeded verifying it, installing it, verifying it, and completed. Beautiful. So now if you type ftp and just simply hit Enter, you seal. It actually took that command, and it brought you into the ftp interactive session. You don't want to use that right now. Just click buy so you could get out and get your prompt back. Now I want you to become I have zala gain you could do s you dash. I have salt. Or of course, in this case, it's yourself, but or you could just simply to exit and we'll bring you back to your own user account I've saw. All right, so if I do ls minus. Lt are these other directories and files I have right now in my ah, home directory. So this is home directory. Okay? Now I want to create a file called Touch Kruger. It is created if you do Alice myself here. You see, it has zero bytes, and right here it says zero bytes. If you want to add something to it, it's a I will do ls minus. Lt are. I'll put that to Kruger. Perfect now. And you do all this mind? Lt are you see? Now it has total of 517 bites. If you do cat on, Kruger. You're going to see basically the output of Exactly ls my SLT are. Anyway. So I Why did I do that? No reason. I just wanted to have some information in their file. You could have done V I and typed in something else like the I Kruger. Like, this is my file. Blah blah. Anyway, I just wanted to populate that file with some information, so it won't be zero bytes now. Right now it has 545 bites. Alright, beautiful. We're moving along. Now we have the file. Now the question is, I want to trash for that Kruger file to the server. Then the server is the one where we installed that FTP de package. So in order to trash for the file over to server, we need to know the i p address of that server. So I'll go back into my server. Doesn't my server for the i p. Address al type? If config. And if I move up, you're going to see the I. P. Address for E and P zero s three. The signed one is 1 90 to 1 $61. 58 perfectly. Got the I p address Now I'm gonna do ftp 1 90 to 1 68.1 dot 58. Hit. Enter. Beautiful. There you go. Says welcome to Bly. FTP Server. See that black thing? I told you, if you want to put a like, beautiful hair would show Beautiful stare. Okay, so anyway, it stays Name and I p address and user name is Ives. Also by default. It picked the using name that I've been trying to ftp or if you wanted to use a different user name, then you will specify. Here. Let's say you want to use John or whatever, but I wanted to use my own name. I was also I'm not gonna enter anything. I'm gonna leave it as default and I'm gonna go ahead and hit. Enter. Please specify the password. This is the password off your eyes. All account to that server or to that remote machine. It says 2 30 log and successful remote system type is UNIX using binary motor to transfer files. Perfect. Now what I need to do, I want you to type B I or been as switching to binary mode because you wanted to transfer the file always using FTP to the binary mode. That is fine. Then I want you type hash hash meaning when you doing the trash for Show me the hashtags which will show which will tell me that there's a progress going on in hashtag progress now time to put the fall So whenever you when it's time to trash for you use the command put because you're going from a to B and do cougar hit Enter right here. It's a Z as soon as you hit. Put Kruger Local cougar remote and drink Passive mode 150. Okay, to send data hash tag. Remember this the progress If it If it was a huge file, you would have seen so many hashtag to 26. Transfer complete 5 45 bite. Since this is the size of the on my file 5 45 cents Succeeded succeeded. Perfect. Now you could just do by now. You're back out to your machine now. Do you want to confirm on the server of has been transferred? Of course. Yes. Let's go to server. I am in my home directory. Unless to a less minus. Lt are and you're going to see right here. This is Kruger. This is a file transfer. That's how the FTP file transfer works. I hope this lecture actually have served its purpose. And you know how the FDP works. If you have any question, please do not hesitate to contact me. I'm here to help you. So let's go and work this FTP server and learn this thing together. Good luck. 4. SCP Secure Copy Protocol: hello And this lesson we are going to cover SCP, which is secure Copy protocol. The secure copy poor coal or SCB helps to transfer computer files securely from a local host to a remote host. It is somewhat similar to FTP, but add security and authentication. So if you are transferring a file again from server A to sever, be you could use as CP as the protocol of the command rather than FTP. And the reason it is preferred is because it is secure. It adds more security and authentication. Now the protocol is that said before the Pearl call is a set of rules just by computers to communicate. So and SCP was built, they decided, OK, this is the protocol that SCP should use and this is the port that should be used to transfer a file from one server to another. The default SCP port is ssh are poor 22. So there is no different protocol that was established or set up for SCP. So it actually leverages onto the same as the sage protocol every used to connect from one server to another or ssh Now for this lecture again, we needed to Lennox machines. One is for the client and one is for the server. Decline is where we have the file. And the server is where we want to trash for their file too. For the client, I have my limits machine and it is called my first Linux VM. For the server, I have a server which is exactly the same as Klein as well. But I named it Lennox Center was seven. So the process is SCP perk. The process in the graphical way is you have a client, A and Klein be server now. Client A wants to copy. Ah, file over to server. Be now. Evils use the protocol SCP or the Commander CP. But it Ashley scratch for that over through the protocol we already have in place. And that is ssh. So there is no new particle for that. It actually piggyback on Ssh. And of course, the ssh port is 22 the service for SS age demon should be running under recipient order Remote server in order to accept Engram Incoming incoming traffic. Okay, what's the process? The SCP command to transfer files to the remote server. First of all, you have to log in yourself, then create a file any fall. Let's say V in this Ah, in this lesson or in this lab, we will create a file called Jack. Once the Jack fall is created, then we will simply run the command SCP That finally, in Jack I absolve is a user name that actually exists on their remote server at 1.2168 1 dot exe is the at the actual I p off the remote server off course replaced that expert the digit that is the digit off your remote server. And the last part is cold in the slash home slash I have. So this is where you want to file to go to in this directory on the remote server once is connected, then it's gonna ask you to enter user name and password, and it will transfer the fall successfully. Now enough is enough. Let's actually start our Lennox machine. Um, which I have already started. And I have already logged into my party. This is my legs machine, and I refer to as my client machine because this is the one that connects to the server and this machine host name is my first Linux VM. Who is logged in. Who am I? I'm logged in as myself. But I followed the directions here. I'm gonna create a file called Jack in my home directory in my home. Director slash home slash I have solved. I'll go ahead and do touch Jack, and I do ls minus. Lt are. You will see. I have a file called Jack. It has zero bytes. Now. I want to transfer that. But before a translate put something in there just to make sure it is transferred with the right content. So let's do V I on Jack and just put, um, Jack is Jerry's, um, uncle, That's it. Do ls minus. Lt are now. You'll see. It has total by 22. Perfect. Now we need to trash for this file to our remote server. But before we trash for the file to the remote, sir, where we wanted to know What is the i p. Address off that remote server? So I'm gonna go into my remote server, which I also have it opened. And I'm going to do if config e and P zero s three. Because that's the interface where the I P is assigned and the I P is one I to 1 68 $1.58. Beautiful. Let's go back to my client. And now this time I'm going to run the command. That's clear the screen so you could see it better. Now run the command as cp the name of the file which is Jack, the name of the user who was going to log in to the remote server. What is a remote server? 1 90 to 1 68.1 dot 58? Yes, and then colon slash Where is it going? To a rich directory. It's going to home. I've ZOLL had enter, and it's gonna ask you for the password. If you are doing SCP for the first time, that is gonna ask you for the fingerprints where you have to type and yes, and then enter the password. So go ahead and password, and it say's a jack, which is a file name. 100 person transferred and the size was 22 this is the time it took to trash for Okay, I got this message on decline. But let's confirm on the server whether it was transport or not. So first of all, it was transferred as I absolved, so I have to log in as I absolve. So who am I? I am I absolved. Beautiful. Now which directory and my logged into I am in my home directory? Because that's where I transferred the file. Right now I will do ls minus. Lt are to check if that Jack Fall came in, It did. Perfect. Is this the right file that came in List Cat it. We did. The cat Jack is Jerry's uncle. Perfect. This is how the SCP works. And you could also do the same thing, by the way as cp to go into this remote server. If you want to pull something out of that server from server to decline and you have just have to reverse the command anyway, try it out. And these are the couple off commands, a few commands that wanted to cover and very important commands. When you are dealing with transferring file from one server to another 5. Rsync Remote Synchronization: hello. In this lesson, we are going to look into our sink. Yes, another utility to transfer files from one machine to another, or copy from one machine to another, and then our sink stands for remote synchronization. What exactly are think is? It's a utility for efficiently transferring and synchronizing files within the same computer or tour more computer by comparing the modification times and size of the files. So basically trashing file from 18 subway to sever B and the way it works efficiently is because it looks at the modification time to enter sizes. If the sizes let's suppose to gig, it will transfer the first time to kick it. The second time is four gig. It will only transfer the change, which is to get not the entire forget. I'll tell you a little bit more about it. Now the our sink is a lot faster than those tools. Like FTP or SCP. This utility is mostly used for the backup of files and directories from one server to another. A lot of system administrators and engineers actually have our sink commander utility running in the Krahn tab to actually copy files everyday files of modified files from one server to another as a purpose to back them up the default arson port as 22 which is the same as ssh that as s h uses. So there is no arsenic server that you don't need to install on the remote server to accept the incoming traffic. It is going to use the ssh particle just like SCP uses the same protocol s a sake. Our sink does the same thing. So it piggybacks on poured 22. Ssh! For this lecture again, we need to Lennox machine because we need to test from copping or synchronizing files from one server to another. I have my first machine is my first Lennox VM, which is I refer to as Klein because I transfer files from that machine to another. And what is another machine is my server, which is which I created another center as a VM Ah, and I named it Lennox Cento. US seven. It has the same specifications as the first machine that I created. Nothing changed. The only thing change is the host name. All right, let's look at Mawr on an A graphical or a diagram way. So I make you understand how the are singularly works. So you have a server, A or client that needs to go to server be. And he needs to transfer those files over the utility. Our sink now are sinking uses as a sage or piggyback or ssh to trash for the files. And for that, you need s sensation de service running on the destination server where the files are going and a poured by default for S s h E d is 22 now it what it does the arsenic it actually copies and and and copies the destination. Keep the same copy the same size and and the time from source to destination How it works. Let me show you right now, if you have a two Meg, the size of the file is to Meg off a file. It transferred the very first time, the exact same size to Mac. Next time someone comes in and change their file, not a flower size. Become from two meg to eight. Meg. So now you need to trash for this file from server A to serve a B. So now this is the beauty off our sink. It is not going to take your entire eight Meg and copied over again. It will actually subtract those to make that was copied earlier and Onley copy the wanted that the difference in the file Just six make Meg. And then, ultimately, the first half or the 1st 2 Meg plus the six Meg it's gonna make combine them together to make it eight Meg. Similarly, if the file grows from eight Meg to 20 Meg, the our single, it subtracted the difference. And on Lee transferred the difference over to the destination server. All right, let's look into the technical side how the command works. So Basics Index of Arson Command is our sink space. The option. If you want to specify any option than the source, what are you copying or transferring? Destination? Where are you copying and which location? Install our sink in your Lennox machine. So first thing we need to do is if harsh sink is not already installed or the command is not available, we have to install that utility, but first, before you go ahead and install, check if it is already is installed. So if it's not Dujan, install our sink and sent to us. Red had distribution in a bun to day being you do apt get install our sink, then our single fall on a local machine. So you need to copy a file from local machine within local machine. Um, you need to do, Let's say, if you want to tar. Um, So for that, let's create ah ah, back up off the entire home directory and we put in a tar and then we back it up. Well, our sink, a director on the local machine are sync a file to a remote machine and we'll are sync a file from the remote machine. All right, so these are the steps we will take. So I know it's a lot of information throwing at you, but we'll try one by one, and I'm sure you'll understand by the time it was done with the sector. So I have my limits machine open. This is my Linux machine, which is my client and which is my first Lennox VM ups. Okay, now what I need to do is I need to make sure I have the our sink package installed before I actually go in and do jum install. Let's do our PM Dash Qiwei and grew up for our sink. Beautiful. It is there, by the way. I am logged in as myself and again. My host name is my first experience. And to check if the package is installed or not, you don't need to be route. You could just simply run rpm deskee way. But if you need to install a package, then yes. Then you need to run Jump Install are sick with the root credentials. All right, now we have confirmed that we do have our sink package. Now let's get into the fun part. Where you going to do the are sync a file on a local machine. So I am in home my home directory and on and I do ls minus. Lt are you see all these directories and files. What I wanted to do is I wanted to put all these directories and falls into a tar fall into a container in Torit. So for that, I'll do tar C v f back up. This is a name I wanted to give Once it's archived and tarred and what I'm tarring, I'm talking everything within the same director. And this is the same director, which is PWD. When I did its whole my abs also, that's why I'm using dot I could have used slash home slash hives. All as well. But since I'm already in this directory, no need to specify the absolute path. Go ahead and enter. All right, so it has tarred all the files and directories into backup. Tatar. You see it? Is there perfect. Now I'm gonna are used our singer to the D to our sink. This backup doc tar into another directory. And that another director I'm picking is slash temps ash backups. So before I do that, I wanted to create that backup directory, which I don't have it created yet. So do M k D i r slash stamps as backups. Perfect. It is created to test you could do CDs, Ash temp sash back up. And there you go. It is and you are in slash temps like backups. That's how you conform. Anyway, your CD back out. Do pwd just to make sure you are in your home directory. Yes. Allah, run the command. Our sink Dash z VH. If you want to know every little detail about each of these options that I'm using. Then you should run the command man our sink, and it will give you the information about every option that is available to you. Here are the different options, any of it. Our sink, dash z the H back up, which is the file name that he created and backing up where it's gonna tell me. Temp backups slash temp slash backups Good hit. Enter they go. It's sent it say's one point. There was six bytes received 35 by its size and ah took 77 54 bytes per second. It's a transfer speed. So now go to seedy temp slash backups and check. Verify If the back of dot tar fall came through or not, that's well, it's my SLT are it? Is there nice? Okay, now, next thing we wanted to do here, let me move this up or on the side right here. Sink a directory on a local machine. So before we sink the file now I want to sink a directory. So let me go back into my home directory by just typing Cdn Hitting and turnout do pwd You're gonna see its home IVs all do ls minus. Lt are to see the content inside of my directory. No, again, You probably have a lot of different files in your home directory. Ah, that you do. You might not see on my screen because I make a lot of changes when I go through making videos. So don't worry about it if my contents don't match with your contents, Okay, So our sinker directory. So to do that, I want to our sink everything that I have in this directory to this temp back of directors . For that I will use the Commander Our sink. That's a z vh slash home slash i of salt Perfect. And then move this up and I'll put it the spin, the right hair. So you know exactly where I am. Okay? And now where I am copying it to slash temp slash backups that enter bingo. Beautiful. It works. So let's go to temper, backup, verify everything that I have in my home directory, which is which is home slash home slash abs. All you know, it's everything has been synchronized here. Perfect. Now let's talk about the part right here that's moving down. It says are single file to a remote machine. Now. Now, for my remote machine, I have this as my remote machine. And I call it Lennox Cento Us and the I p address for this or more home remote machine is if config e and P zero s three it is one i to 1 68 $1.58. This is the I P. Address. And this is where I want to trash work. So let's minimize again. So I'll go into my home directory and I wanted to copy or our sink the back of dark tar file. Now, before I are Think this over to the remote, sir, where I wanted to create the destination folder where this is going to go. So I will go back into my server and I'll go into slash temp. And here I will create a directory called Back up Backups ls minus. Lt are. And you're going to see right here the bottom it has been created. It's clear the screen. Now let's go back to our Klein machine. This is our client machine. Now we're gonna use the command, our sink, dash a V Z back up. That so far do you want to transfer over now. You want to transfer over as what? User as myself. Okay, which machine is it going to? It's going toe 18 to 1 68 $1.58 which is the I. P address we just checked on our A mortar. And which directory? It's going to colon slash temp slash backups. This is the director is going to go ahead. Hit. Enter. It's gonna ask you for the past, for for the I absolve on the remote machine. Put in the password. Beautiful. It is trash. What it says sent it tells you a lot Information and speed and everything. Now wants his transfer. Is your job to verify it has been transferred. Go to your CD sash temps as backup directory to ls minus. Lt are and you'll see right here. This is the one that's been transferred. Perfect. That's move on. Let me minimize this. Now The last part is right here at the bottom. This is our sync. A file from a remote machine. Now we want to go to the remote machine and fetch ah file from there. So which fall are refreshing? So first, let's make a test file dummy fall. So I'll go into my home directory because on the server on Logged In as myself here, I'm going to create a file. I'm not Call it server file. Do ls myself tr and you're gonna see the server fathers there. Perfect. Now, if I come to my client machine to PWD and two ls minus lt are you see, I don't have that several file, so I need to bring or pull that's ever file from the server. And for that, I will have to do our sink dash a visi h. I absolved because this is the Jews in a models used to log into their remote host. What is the I p off the remote host 58? Perfect. Now, where is that file that you are trying to bring? The file is in home. IVs all and the file name Miss Server file. Perfect. Now, when you bring it, where do you want to save it? Or copy it to going to copy it to my temp backups file or directory? Good hit. Enter is gonna ask you for the password. Perfect has sent 43 bites. Now where did it go? Let's verified. I asked to come to my slash temp slash backup directory. Do Ellis myself to your and you're gonna see right here says server file. See, that's how you fetch a file from the server. So anyway, there are different options that are available on our sink that allows you to do like dry runs, allows you to do, um, arson continuously allows you to do only only Delta's meaning. Only the changes. You just need to pick the right option to use. Which option works for your own requirement. Good luck.