The File Transfer Protocol (FTP) is a widely used method for transferring files between computers over a network. An FTP server allows users to upload, download, and manage files on a remote system, making it essential for file sharing, backup purposes, and remote access. Setting up an FTP server on Linux can be a great way to enhance your file-sharing capabilities, especially if you manage multiple systems or need secure access to files remotely.

In this article, we’ll walk through the steps to install, configure, and secure an FTP server on various Linux distributions.
Prerequisites
Before you begin, you’ll need:
- A Linux system with root or sudo privileges
- An active internet connection
- Basic knowledge of the Linux command line
Install an FTP Server on Various Linux Distros
There are different ways to install an FTP server depending on the Linux distribution you are using. Each distribution has its package management system, so we’ll walk through the installation steps for some popular Linux distros.
Install FTP Server on Ubuntu/Debian
To install an FTP server on Ubuntu or Debian-based systems, you can use the apt
package manager. The most commonly used FTP server is vsftpd, which is secure and lightweight.
- Update the system package list:
sudo apt update
- Install vsftpd FTP Server:
sudo apt install vsftpd
Install FTP Server on CentOS/RHEL
CentOS and RHEL systems use the yum
package manager for installation. vsftpd is a widely used and reliable choice for FTP functionality.
- Install vsftpd:
sudo yum install vsftpd
- Start the vsftpd service:
sudo systemctl start vsftpd
Install FTP Server on Fedora
On Fedora, you use the dnf
package manager. Like other distros, vsftpd is the recommended FTP server.
- Install vsftpd:
sudo dnf install vsftpd
- Enable and start the service:
sudo systemctl enable --now vsftpd
Install FTP Server on Arch Linux
Arch Linux uses the pacman
package manager. vsftpd is a popular choice on Arch due to its stability and security features.
- Install vsftpd:
sudo pacman -S vsftpd
- Enable the service:
sudo systemctl enable --now vsftpd
Configure the FTP Server
The FTP server configuration is managed through the vsftpd.conf
file. Let’s modify some essential settings to secure and configure the FTP server:
- Open the configuration file:
sudo nano /etc/vsftpd.conf
Make the following changes for security and functionality:
- Disable anonymous login:
anonymous_enable=NO
- Enable local user login:
local_enable=YES
- Allow file uploads:
write_enable=YES
- Chroot users to their home directories (restricts them to their directories for security):
chroot_local_user=YES
Save and close the configuration file by pressing CTRL+X
, then Y
, and Enter
.
Check Out | How to Install OpenSSH on a Linux Server
Create and Configure FTP User Accounts
To manage files through FTP, you’ll need to create user accounts. Here’s how you can add a user and set up FTP access.
- Add a new user:
sudo useradd -m username
- Set a password for the user:
sudo passwd username
- Create a directory for FTP access:
sudo mkdir /home/username/ftp
- Set the appropriate ownership for the directory:
sudo chown username:username /home/username/ftp
Test FTP Server Connectivity
Once everything is set up, it’s time to test the FTP server to ensure it’s functioning correctly.
- Test the FTP server locally:
ftp localhost
- Log in with the username and password that you created.
- Check if FTP is accessible remotely by using an FTP client or another system on the same network.
- Verify that you can upload and download files to and from the server.
Maintaining an FTP server
Maintaining your FTP server’s security is critical. Here are some best practices:
- Monitor FTP server logs for any suspicious activity:
sudo tail -f /var/log/vsftpd.log
- Regularly update your server and FTP software to patch vulnerabilities:
sudo apt update && sudo apt upgrade
Use fail2ban or similar tools to protect against brute-force attacks:
- Install fail2ban:
sudo apt install fail2ban
Set up FTP server backups to prevent data loss.
Check Out | How to Install Nginx on a Linux Server
Connect to the FTP Server via the Command Line in Linux
Once you’ve installed and configured your FTP server on Linux, you can easily connect to it using the command line. This method is fast, reliable, and useful for system administrators managing remote file transfers. Here’s how to connect to an FTP server using built-in Linux terminal commands:
ftp <hostname or IP address>
Steps:
- Open your terminal.
- Run the
ftp
command followed by the server IP or domain. - Enter the username and password when prompted.
- Use FTP commands like
ls
,cd
,get
,put
, andbye
to interact with the server.
Conclusion
In this tutorial, we learned how to install, configure, and secure an FTP server on various Linux distributions using vsftpd. We also explored how to connect to the server using the command line, allowing users on the local or remote network to upload, download, and manage files with ease. Whether using terminal commands or an FTP client, this setup enables efficient and secure file transfers across systems.