Hey there! I’m Jules from Techamat, and today I’m going to walk you through setting up an FTP server using Apache MINA. If you’ve ever struggled with setting up an FTP server on a tricky Linux OS like RedHat Enterprise—where updates can cost you—or just want a reliable, cross-platform solution, Apache MINA’s FTP Server is a fantastic choice. It’s 100% Java, which makes it super easy to install and run consistently across different platforms. Let’s get started with version 1.1.4, and I’ll also point you to the latest version if you want to go cutting-edge!
Why Use Apache MINA FTP Server?
I love Apache MINA because it’s a lightweight, Java-based FTP server that’s easy to get up and running. Here are a couple of reasons why I recommend it:
- Cross-Platform: Since it’s Java, it works the same way on Windows, Linux, or macOS—no need to worry about platform-specific quirks.
- Alternative to vsftpd: If you can’t get vsftpd and its dependencies installed on a system like RedHat Enterprise (where updates can be pricey), Apache MINA is a great fallback.
Whether you’re setting up a file server for your team or just need a quick FTP solution for testing, Apache MINA has you covered. Let’s dive into the setup process using version 1.1.4.
Step-by-Step Guide to Set Up Apache MINA FTP Server
Here’s how I set up Apache MINA FTP Server on my system. Follow these steps, and you’ll have your FTP server running in no time.
Step 1: Prerequisites
Before we start, make sure you have Java installed on your system, as Apache MINA is a Java-based application. Version 1.1.4 requires at least Java 8, but I recommend using Java 11 or later for better performance and security. You can check your Java version by running:
java -version
If Java isn’t installed, download and install it from the official Oracle
website or use your system’s package manager (e.g., sudo apt install openjdk-11-jdk
on Ubuntu).
Step 2: Download the Binaries
First, you’ll need to download Apache MINA FTP Server version 1.1.4. You can grab it directly from the Apache website using this link:
https://www.apache.org/dyn/closer.lua/mina/ftpserver/1.1.4/apache-ftpserver-1.1.4-bin.tar.gz
This link will take you to a page that suggests the closest mirror for downloading the file. Click the
link to download apache-ftpserver-1.1.4-bin.tar.gz
.
Note: If you want the absolute latest version, Apache MINA FTP Server 1.2.1 was released on February 1, 2025. You can find it in the Apache archives at this link. The setup steps are very similar, but I’ll be using 1.1.4 for this guide as it’s a stable release.
Step 3: Install Apache MINA FTP Server
Once you’ve downloaded the file, let’s extract it and move it to a suitable location. I like to keep my
servers in /srv/
, but you can choose a different directory if you prefer. Here’s what I do:
Open a terminal and run:
tar xzvf apache-ftpserver-1.1.4-bin.tar.gz
This extracts the archive. Next, move the extracted folder to /srv/ftpserver
:
mv apache-ftpserver-1.1.4 /srv/ftpserver
Now your FTP server files are in /srv/ftpserver
, ready for configuration.
Step 4: Configure the FTP Server
Apache MINA comes with a typical configuration file that we can use as a starting point. Let’s edit it to
set up the basics. Navigate to the configuration file at
/srv/ftpserver/conf/ftpd-typical.xml
and open it in your favorite text editor (I use
nano
or vim
).
Replace the contents of ftpd-typical.xml
with the following:
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to you under the Apache License, Version
2.0 (the "License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 Unless required by
applicable law or agreed to in writing, software distributed under the
License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied. See the License for
the specific language governing permissions and limitations under the
License.
-->
<server xmlns="http://mina.apache.org/ftpserver/spring/v1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://mina.apache.org/ftpserver/spring/v1 http://mina.apache.org/ftpserver/ftpserver-1.0.xsd"
id="myServer">
<listeners>
<nio-listener name="default" port="21">
</nio-listener>
</listeners>
<file-user-manager file="./conf/users.properties" encrypt-passwords="clear"/>
</server>
What I Changed: I kept the configuration simple by removing the SSL settings (you can
add them later for secure FTP). I also set encrypt-passwords="clear"
in the
file-user-manager
element, so passwords are stored in plain text for now. This makes setup
easier, but for production, you should consider encrypting passwords or enabling SSL. The schema
location in the XML hasn’t changed since version 1.0, as the core configuration structure remains
compatible.
Step 5: Configure Users
Next, we need to set up the users who can access the FTP server. Apache MINA uses a
users.properties
file for this. Open /srv/ftpserver/conf/users.properties
in
your text editor and add a user like this:
ftpserver.user.myusername.userpassword=mypassword
ftpserver.user.myusername.homedirectory=./res/home/myusername
ftpserver.user.myusername.enableflag=true
ftpserver.user.myusername.writepermission=true
ftpserver.user.myusername.maxloginnumber=0
ftpserver.user.myusername.maxloginperip=0
ftpserver.user.myusername.idletime=0
ftpserver.user.myusername.uploadrate=0
ftpserver.user.myusername.downloadrate=0
Replace myusername
with the username you want (e.g., jules
) and
mypassword
with a secure password. Here’s what each line does:
userpassword
: The user’s password.homedirectory
: The directory where this user’s files will be stored (relative to/srv/ftpserver
).enableflag
: Set totrue
to enable the user.writepermission
: Set totrue
to allow the user to upload files.maxloginnumber
andmaxloginperip
: Set to0
for unlimited logins.idletime
,uploadrate
,downloadrate
: Set to0
for no limits.
If you want to add more users, just copy this block, paste it below, and change the username and
password. For example, to add a second user named alice
, you’d add:
ftpserver.user.alice.userpassword=alice123
ftpserver.user.alice.homedirectory=./res/home/alice
ftpserver.user.alice.enableflag=true
ftpserver.user.alice.writepermission=true
ftpserver.user.alice.maxloginnumber=0
ftpserver.user.alice.maxloginperip=0
ftpserver.user.alice.idletime=0
ftpserver.user.alice.uploadrate=0
ftpserver.user.alice.downloadrate=0
Make sure the home directory exists. For example, create the directory for myusername
:
mkdir -p /srv/ftpserver/res/home/myusername
Step 6: Run the FTP Server
Now that everything is configured, let’s start the FTP server. Navigate to the
/srv/ftpserver
directory:
cd /srv/ftpserver
Then run the server using the configuration file we edited. In version 1.1.4, the startup script is named
ftpd.sh
, and you can run it like this:
bin/ftpd.sh conf/ftpd-typical.xml
This starts the server in the foreground. If you want to run it in the background, you can add
&
at the end:
bin/ftpd.sh conf/ftpd-typical.xml &
You should see output indicating the server has started, listening on port 21 (the default FTP port). To
stop the server, you can press Ctrl+C
if it’s running in the foreground, or find the
process ID and kill it (e.g., kill $(pgrep -f ftpd.sh)
).
Step 7: Test Your FTP Server
Let’s make sure the server is working. You can connect to it using an FTP client like FileZilla, or even
from the command line. Here’s how I test it with the ftp
command:
ftp localhost
Log in with the username and password you set (e.g., myusername
and
mypassword
). If everything is set up correctly, you should be able to log in and see the
contents of the user’s home directory (/srv/ftpserver/res/home/myusername
).
If you’re on a remote machine, replace localhost
with your server’s IP address (e.g.,
ftp 192.168.1.100
). Make sure port 21 is open on your firewall if you’re testing remotely.
On a Linux system, you can check with:
sudo ufw allow 21/tcp
Final Thoughts
And there you have it—an Apache MINA FTP Server up and running with version 1.1.4! I love how
straightforward this setup is, especially when dealing with systems where traditional FTP servers like
vsftpd are a hassle to install. If you want to use the latest version (1.2.1), the steps are nearly
identical—just update the file names and use the ftpserver.sh
script instead of
ftpd.sh
for starting the server.
Once your server is running, you can explore more advanced configurations, like enabling SSL for secure
transfers (check the ftpd-full.xml
example in the conf/
directory) or setting
up rate limits for users. If you run into any issues—like connection errors or permission
problems—double-check your configuration files and ensure the home directories exist. Also, make sure
Java is properly installed and your firewall isn’t blocking port 21. Feel free to reach out if you need
help troubleshooting!