OpenWrt-based FTP server
This document describes how to build a simple FTP server on top of OpenWrt. We assume you already have a working OpenWrt installation and that you have configured basic networking (/etc/config/network) and the host’s name (/etc/config/system).
- Install the following packages:
- zlib
- libopenssl
- vsftpd-tls
- openssh-keygen
- openssh-server
- openssl-util
- Remove the dropbear package
- Take care to set the root password.
- Create the directory
/home/ftp. - Add a new user to the system, setting his home directory to
/home/ftpand his shell to/bin/false. - Set the new user’s password.
- Configure cleartext FTP: write the following to
/etc/vsftpd.conf:
background=YES
listen=YES
anonymous_enable=YES
write_enable=NO
local_umask=022
check_shell=NO
local_root=/home/ftp
session_support=NO
- Configure ciphertext SFTP: write the following to
/etc/ssh/sshd_config:
AuthorizedKeysFile .ssh/authorized_keys
UsePrivilegeSeparation sandbox
Subsystem sftp internal-sftp
Match User *
ChrootDirectory %h
AllowTCPForwarding no
X11Forwarding no
ForceCommand internal-sftp