Hello. My name is Corey Thompson. And in these lessons, you will learn how to use SCP to transfer files. You secure file transfer protocol and how to modify SCP options and enable SCP on the SSH server while configuring access to specific users. In this lesson, I will show you how to use SCP to transfer files. SCP which stands for Secure Copy Protocol as a widely used network protocol that enables secure and efficient file transfers between a local host and a remote server developed as an extension of SSH. SCP utilizes SSH encryption and authentication capabilities to ensure the confidentiality and integrity of data during transmission. The primary advantage of SCP is its ability to securely transfer files and directories over an unsecure network such as the Internet. By leveraging public key cryptography, SCP allows users to authenticate themselves to the remote server without transmitting passwords over the network, which mitigates security risk associated with traditional password based authentication. Using ACP is pretty straightforward, often executed from the command line interface of the local host. The syntax closely resembles the familiar copy command, which makes it simple for users to adapt. With ACP, files and directories can be copied both from the local hosts to the remote server and vice versa. Let's begin by creating a test file that we can transfer from our ubuntu1 machine over to our ubuntu3 machine. To do this, you can use any text editor of your choice. I'm going to use them and we'll name our file test out text. Once inside, go ahead and put some file content in there so we know that our transfer was successful. When you're finished, save the file, and now that our file is saved, we're ready to scp the file from our ubuntu1 machine over to our ubuntu3 machine. Before we attempt to transfer the file, It's important to know that transferring files requires permissions on the remote machine. The user account needs to have the appropriate permission to the location when trying to SCP the file. For this reason in the industry, a lot of times you will simply see the transfer destination to the temp directory. This is because by default everyone is allowed to write to the temp directory. Once the files inside the temp directory, the practice is then to move it to the correct location by user who has permissions on their device. To SCP our test text, begin with the command SCP test.txt If we were not in the current directory of the test file, we would have to provide the full path to the file location. But since we are, we can simply specify the file name. Now the next part looks similar to the SSH command. You provide the user which in this case is user3 followed by the hostname or IP address of the machine. Now we need to specify where on the machine, we want to see the file. To do this, simply put a colon immediately following the IP address or the hostname. Now place the directory, which for us will be the temp directory. And this is our completed SCP command. Go ahead, press enter and provide user three credentials on the machine. As you can see, our file was transferred over. To verify, Let's go ahead SSH into our ubuntu3 machine and make sure it's in the temporary directory. The command for this is SSH user3@ubuntu3 host, provide the password and now we're on the machine. Now we'll navigate to the temporary directory and run an LS command. As you can see, there's our test, our text And let's go ahead and look at the contents with the cat command. So our file transfer was successful. Now let's go ahead and open up the file and modify it so that we can perform SCP. But in reverse. We're going to change it from ubuntu1 to ubuntu3, save our file, and now we can exit the connection if we do in LS, we have our test, our text file. Let's go ahead and delete that, Since run back a new copy from ubuntu3 Machine. Now we can verify our test subtext file is gone. From our ubuntu1 machine, the syntax is similar to before for pulling the file to us, just the order is changed. We begin again with the command SCP, but now we provide the credentials to the remote device, which is the user3@ ubuntu3 IP address. Now we specify location to the file and then the last part is where we want to save the location. For us, putting in a simple period will mean save it in our current working directory and now we are ready to press enter, provide user3's password and as you can see, it downloaded the test our text file. If we open up the file and view the contents, we can see this is the file from ubuntu3 machine. Now let's perform a recursive copy and will copy back the entire directory. But this time we will also use our ubuntu2 machine that's listening on a different default port. To begin, we will use the command SCP and this time we need to provide - Capital P and the port number. Next we can do a - lowercase r that represents that we want to recursively copy back the entire directory, meaning that we want the directory and all the files inside. Now we specify the user and the remote machine. In the file location, which we have the test directory on the machine. Again, we'd like to save it to our current directory, so it just put a period. So press enter, and now provide users2 credentials. As you can see, a copy three files from the ubuntu2 machine. I do LS, I can see my test directory and all three files are inside of it. And here are the contents of each of the files and that's it. You have now learned how to use SCP to securely transfer files between a local host and a remote server to include recursively copying a directory and even connecting to a server on an alternate port. Stay tuned for the next lesson where I will talk about the advantages of SFTP over FTP and how to transfer a file using SFTP. Thanks for watching.