π FTP Tutorial: Installing, Configuring, and Using FTP on Linux
Welcome to this tutorial on FTP (File Transfer Protocol). In this guide, we will cover the basics of FTP, how to install and configure an FTP server on Linux, and how to transfer files between a Linux client and server.
π Table of Contents
- π What is FTP?
- π What is a Protocol?
- π’ What is the Default FTP Port?
- π οΈ Installing and Configuring FTP on a Remote Server and Client
- π Examples: Moving Files Between Linux Client and Server
π What is FTP?
FTP (File Transfer Protocol) is a standard network protocol used to transfer files between a client and a server over a TCP/IP network, such as the internet or a local network. FTP allows users to:
- π₯ Upload files
- π€ Download files
- π Rename files
- β Delete files
- π Move files on a server
FTP operates in two modes:
- Active Mode πΆ: The client opens a port and waits for the server to connect.
- Passive Mode π: The server opens a port and waits for the client to connect.
π What is a Protocol?
A Protocol is a set of rules or standards that dictate how data is transmitted and received over a network. Protocols define the methods and formats for communication between devices, ensuring that data is sent, received, and interpreted correctly. Examples of protocols include:
- HTTP πΈοΈ: HyperText Transfer Protocol
- FTP π: File Transfer Protocol
- TCP/IP π: Transmission Control Protocol/Internet Protocol
- SMTP π§: Simple Mail Transfer Protocol
π’ What is the Default FTP Port?
The Default FTP Port 21 is the port number assigned to the control connection in the FTP protocol. When an FTP client initiates a connection to an FTP server, it connects to the server on port 21 to send commands. Data transfers typically occur over a separate port (usually port 20 or a dynamically assigned port in passive mode).
π οΈ Installing and Configuring FTP on a Remote Server and Client
π‘ On the FTP Server:
-
Install FTP Server Software:
-
On a Debian/Ubuntu server:
-
On a CentOS/RHEL server:
-
Configure the FTP Server:
-
Open the configuration file:
- Modify the following settings as needed:
- Ensure
anonymous_enable=NO
(to disable anonymous login). - Set
local_enable=YES
(to enable local user login). - Set
write_enable=YES
(to allow file uploads). - Enable passive mode by adding the following:
- Enable local time by adding:
- Ensure
-
Save and close the file.
-
Start and Enable the FTP Server:
- Allow FTP through the Firewall:
- On Debian/Ubuntu:
- On CentOS/RHEL:
π» On the FTP Client:
-
Install FTP Client Software:
-
On a Debian/Ubuntu client:
-
On a CentOS/RHEL client:
-
Connect to the FTP Server:
- Open a terminal and connect using the FTP command:
- Enter the username and password when prompted.
π Examples: Moving Files Between Linux Client and Server
π€ Upload Files
To upload a file from your local machine to the server:
ftp your_server_ip
# Login with your username and password
put /path/to/local/file /path/to/remote/directory/
π₯ Download Files
To download a file from the server to your local machine:
ftp your_server_ip
# Login with your username and password
get /path/to/remote/file /path/to/local/directory/
π Rename Files
To rename a file on the server:
β Delete Files
To delete a file on the server:
π Move Files on a Server
To move a file from one directory to another on the server:
ftp your_server_ip
# Login with your username and password
rename /current/path/file.txt /new/path/file.txt
This tutorial provides an overview of FTP, its installation, configuration, and basic usage for file transfers between Linux systems. Happy file transferring! ππ