Watch all our Tutorials and Training Videos for Free on our Youtube Channel, Get Online Web Tools for Free on swebtools.com

Search Suggest

Setting up Linux FTP Server on Debian

Setting up Linux FTP Server on Debian, ftp server debian, ftp server, linux ftp server, install ftp server linux, setup linux ftp server, DevOps
Setting up Linux FTP Server on Debian

If you are looking for a secure and reliable way to share files between multiple users over the internet, setting up a Linux FTP (File Transfer Protocol) server on Debian can be an excellent option. In this article, we will provide you with step-by-step instructions to set up a Linux FTP server on Debian, including the installation and configuration of the necessary software and firewall rules.

Prerequisites

Before proceeding with the installation, make sure you have:

  • A Debian server with root access
  • A static IP address assigned to your server
  • Basic knowledge of Linux commands and networking concepts

Step 1: Install the FTP server software

First, update the package list and install the vsftpd package, which is a popular and secure FTP server software on Debian.

sudo apt update
sudo apt install vsftpd

Step 2: Configure the FTP server

Next, configure the FTP server to allow users to connect and transfer files securely. Open the vsftpd configuration file in a text editor:

sudo nano /etc/vsftpd.conf

Make the following changes to the configuration file:

  • Uncomment the following line to allow local users to log in and access their home directories:
local_enable=YES
  • Uncomment the following line to enable anonymous FTP access (if you want to allow anonymous users to connect):
anonymous_enable=YES
  • Uncomment the following line to allow the creation of new files and directories by users:
write_enable=YES
  • Uncomment the following line to restrict users to their home directories:
chroot_local_user=YES
  • Add the following lines at the end of the file to enable passive FTP mode and specify the range of passive ports to be used:
pasv_enable=YES
pasv_min_port=1024
pasv_max_port=1048

Save and close the file by pressing Ctrl+X, followed by Y and Enter.

Step 3: Create FTP users

You can create new FTP users on your Debian server using the adduser command. For example, to create a new user named johndoe and set a password for them, run:

sudo adduser johndoe

Enter a strong password and other information as prompted.

Step 4: Configure the firewall

To allow FTP traffic through the firewall, you need to open port 21 for FTP control traffic and the range of passive ports you specified earlier for FTP data traffic.

sudo ufw allow 21/tcp
sudo ufw allow 1024:1048/tcp
sudo ufw enable

Step 5: Test the FTP server

Restart the vsftpd service to apply the changes:

sudo systemctl restart vsftpd

Now, you can test the FTP server by connecting to it using an FTP client such as FileZilla. Enter your server's IP address, username, and password to connect. If the connection is successful, you should see your home directory and be able to upload and download files.

More Examples

  • To configure vsftpd to use SSL/TLS encryption for secure FTP connections, refer to the official Debian documentation on vsftpd.

  • To create virtual FTP users with restricted access to specific directories, you can use the PAM (Pluggable Authentication Modules) module with vsftpd.

  • To limit the maximum number of connections per IP address, add the following line to the vsftpd configuration file:

max_per_ip=5

Related Searches and Questions asked:

  • Does Linux Have FTP Server?
  • Setting up Linux FTP Server GUI
  • FTP Server Configuration in Linux Step by Step
  • What is FTP Server in Linux?
  • That's it for this post. Keep practicing and have fun. Leave your comments if any.