FTP 101: A Beginner’s Guide to File Transfer Protocol Operations
In this video, we’ll explore another method for transferring files, using the FTP (File Transfer Protocol). FTP uses port TCP/21 and TCP/20 to enable file transfers between a client and server. We can use an FTP client or PowerShell Net.WebClient to download files from an FTP server.
We can even set up our own FTP server using the Python3 pyftpdlib module. In this tutorial, we’ll walk you through the installation of the pyftpdlib module and how to configure the FTP server on port 21. If you don’t specify a username and password, anonymous authentication is enabled by default.
Once the FTP server is set up, we can use the pre-installed FTP client from Windows or PowerShell Net.WebClient to perform file transfers. For example, using PowerShell, we can download a file from an FTP server to our local machine with the following command:
PS C:htb$ (New-Object Net.WebClient).DownloadFile(‘ftp://192.168.49.128/file.txt’, ‘ftp-file.txt’)
However, when we get a shell on a remote machine, we may not have an interactive shell. In such cases, we can create an FTP command file to download a file. We need to create a file containing the commands we want to execute and then use the FTP client to download that file.
By the end of this tutorial, you’ll have a comprehensive understanding of how to use FTP to transfer files and set up your own FTP server. So, whether you’re a beginner or an advanced user, this video is perfect for anyone looking to learn more about file transfer using FTP.