Transferring large files between a PC and an Android device often means juggling USB cables, cloud services, or paid apps. If you have a stable Wi‑Fi network, an FTP server running directly on your phone gives you a fast, cable‑free solution that works on any platform supporting FTP.
Termux is a lightweight terminal emulator and Linux environment for Android. It runs without root, installs packages from the same repositories used on Debian/Ubuntu, and lets you execute standard command‑line tools. By using Termux you avoid:
With a few commands you get a fully functional FTP server that serves any folder you choose, and you can stop it instantly when you’re done.
After the initial setup you’ll see a prompt that looks like username@localhost:~$. This is your Linux‑like shell.
pkg update
pkg upgrade
python and openssh (the latter provides the ssh‑keygen utility we’ll use to create a password file):
pkg install python openssh
termux-setup-storage
You’ll be prompted to allow “Files and media”. Accept.
Now you have a full Python interpreter and the ability to read files from the shared /sdcard directory.
We’ll use the pure‑Python pyftpdlib library because it’s easy to install and runs with a single command.
pip (Python’s package manager):
pip install pyftpdlib
python -c "import pyftpdlib; print('pyftpdlib version', pyftpdlib.__version__)"
If you see a version number printed, the server is ready.
Termux sees your shared storage under /sdcard. You can create a dedicated folder, for example /sdcard/FTPShare:
mkdir -p /sdcard/FTPShare
Any file placed in FTPShare will be visible to FTP clients.
By default pyftpdlib runs an anonymous server, meaning anyone on the network can read (and possibly write) files. To restrict access:
users.txt inside the shared folder:
echo "myuser:mystrongpassword" > /sdcard/FTPShare/users.txt
Replace myuser and mystrongpassword with something you can remember but is not obvious.
Run the following one‑liner. It starts the server on port 2121 (chosen to avoid the default FTP port 21, which is often blocked on Wi‑Fi routers) and points it at the FTPShare folder.
python -m pyftpdlib -p 2121 -w -d /sdcard/FTPShare -P /sdcard/FTPShare/users.txt
Explanation of the flags:
-p 2121 – listen on port 2121.-w – enable write permissions for authenticated users.-d /sdcard/FTPShare – set the home directory for all sessions.-P /sdcard/FTPShare/users.txt – use the password file for login.After you press Enter, you should see a line similar to:
pyftpdlib FTP server listening on 0.0.0.0:2121
This means the server is active and waiting for connections.
On the same Termux session, type:
ip addr show wlan0
Look for the line containing inet. It will look like 192.168.1.45/24. The part before the slash (e.g., 192.168.1.45) is the IP you’ll use on the client.
Use any FTP client (FileZilla, WinSCP, the built‑in Windows Explorer, or even a web browser) and enter:
ftp://192.168.1.45:2121 (replace with your IP)myusermystrongpasswordWhen the connection succeeds you’ll see the contents of FTPShare. Drag and drop files to upload or download.
After copying a file, refresh the FTP client view. The file should appear instantly. On Android you can open the FTPShare folder with the Files app to confirm the file exists.
Return to the Termux window where the server is running and press Ctrl +C. You’ll see a message like KeyboardInterrupt and the prompt will return, indicating the server has stopped.
If you prefer a GUI approach or need additional features (e.g., TLS encryption), consider these options:
openssh in Termux and run sshd. SFTP encrypts traffic, but you’ll need an SSH client on the PC.The Termux method stays lightweight, gives you full control, and works on any Android version that supports Termux (Android 5.0+).
-p 2122 in the launch command.termux-setup-storage and accepted the permission dialog.-d /sdcard/FTPShare flag pointing to the exact folder.OSError: [Errno 98] Address already in use, another process is already listening on the chosen port. Stop the previous server (Ctrl +C) or pick a free port.FTPShare directory; keep sensitive files elsewhere.sshd and connect via SFTP.By following these steps you now have a fully functional FTP server running on your Android phone, powered by Termux. The setup is lightweight, reversible, and works without rooting. Whether you need to move photos, backup documents, or quickly share a video with a laptop, the server provides a fast, cable‑free workflow that you control from the command line.
Remember to shut down the server with Ctrl +C when you’re finished, and keep the password file secure. For encrypted transfers, switch to SFTP – the same Termux environment makes that transition painless.









