Setting up an FTP server with vsftpd on Ubuntu
File Transfer Protocol still appears in Australian development workflows, where older build systems or supplier portals need a simple way to exchange files. Its security history is the catch: ordinary FTP sends login credentials and file contents without encryption. vsftpd, the Very Secure FTP Daemon, remains practical for Ubuntu when access is restricted and transfers use TLS. SFTP is a safer alternative when every client already supports SSH.
The setup below uses a named local account, a jailed home directory, explicit TLS and a controlled passive-port range. It assumes Ubuntu Server with the vsftpd package available and an administrator who can use sudo. Configuration remains in /etc/vsftpd.conf across releases, while the service-management command differs between older and newer installations. Start with a test host or isolated network rather than exposing a newly installed server directly to the internet.
Connection details matter in Australia. Many homes and small offices use NBN services through Telstra, Optus or TPG, with the supplied router commonly assigning private addresses such as 192.168.1.x. A public internet address therefore does not guarantee that an FTP server is reachable. NAT, port forwarding, a dynamic public address and inbound firewall rules all need consideration. A Brisbane team publishing large media files to a server in Sydney may also find that distance affects transfer times more than the advertised bandwidth.
Operation carries obligations beyond connectivity. If the server moves personal information, the Privacy Act 1988 and applicable state or territory privacy laws can govern its use, retention and disclosure. Many Australian government agencies and regulated businesses use the Australian Signals Directorate’s Essential Eight as a security benchmark, although it is not a blanket legal requirement for every organisation. The aim is a small, observable service with named users, protected credentials, useful logs and a recovery plan rather than an anonymous public file dump.
Choosing the right transfer protocol
FTP, FTPS and SFTP are often confused. FTP is the original client/server protocol for uploading and downloading files. FTPS adds TLS to FTP, either explicitly on the control connection or implicitly on a separate port. SFTP is a different protocol carried over SSH. Enabling vsftpd does not create an SFTP service, and changing a client to SFTP will not make it speak to port 21.
FTP remains useful when a partner requires it, a repository contains a large collection of predictable objects, or batch jobs need directory listings and scripted transfers. Its simplicity helps on constrained devices. The cost is a protocol designed before modern threat models. Plain FTP is unsuitable for credentials or confidential files, and anonymous access should be reserved for genuinely public material after the risks have been assessed.
Choose explicit FTPS for a straightforward deployment: the client connects to port 21 and negotiates TLS immediately. Choose SFTP if the organisation already operates SSH and all clients can use it; that removes a separate daemon and allows key-based authentication. Where clients are fixed and controlled, a VPN can provide a private path. Record the choice before installing packages, because it determines the accounts, firewall rules and client instructions.
Installing vsftpd on Ubuntu
Install the daemon and its supporting packages. Stop it first so default settings are not briefly active before access is locked down. Enable and start it only after the configuration and firewall checks below.
sudo apt update
sudo apt install vsftpd openssl ssl-cert
sudo systemctl stop vsftpd
Back up the original file, then replace it with a minimal local-user baseline. Each directive occupies one line.
listen=YES
anonymous_enable=NO
local_enable=YES
write_enable=YES
chroot_local_user=YES
allow_writeable_chroot=NO
local_umask=022
secure_chroot_dir=/var/run/vsftpd/empty
pam_service_name=vsftpd
The writable-chroot restriction depends on the ownership rules in the next section. On releases that use systemd, finish with sudo systemctl enable --now vsftpd; older releases use the distribution’s init script instead.
Restart after each focused change with sudo systemctl restart vsftpd, then inspect sudo systemctl status vsftpd --no-pager and the daemon’s error messages. A second reference can help translate policy into directives; this vsftpd configuration walkthrough is useful alongside a fresh installation. Avoid copying a large configuration wholesale, since permissive anonymous, networking or logging options can undo careful defaults.
Creating restricted local accounts
Create one account for each person or workload rather than sharing a generic login. Replace alice with a name that does not already exist.
sudo useradd --create-home --home-dir /home/alice --shell /bin/bash alice
sudo passwd alice
sudo install -d -o alice -g alice -m 0750 /home/alice/incoming
sudo chown root:root /home/alice
sudo chmod 0755 /home/alice
The incoming directory is the only area the account needs to write to. Its parent is root-owned, so the jailed home itself is not writable and the chroot restriction remains effective. Use a shell accepted by the host’s PAM configuration, and deny SSH access to this dedicated identity through the SSH server’s user rules; the FTP jail does not protect a shell login.
On Ubuntu, add alice to /etc/vsftpd.userlist and set userlist_enable=YES with userlist_deny=NO in vsftpd.conf. This permits listed identities while excluding other local accounts from FTP. Keep the list duplicate-free, review it when staff or contractors change, and remove stale entries promptly. If a client needs a different name from its Linux login, use a clearly mapped alias and document the mapping.
Set permissions to match the service’s jobs. Use local_umask=022 for public artefacts or 027 for a group-shared collection. local_max_rate=1048576 limits each local user to roughly one mebibyte per second on a contended connection. Audit symbolic links and scheduled scripts inside jailed homes: a familiar directory name is not a boundary if its contents point into unrestricted paths.
Enabling TLS for file transfers
Explicit TLS is the core control. Add this to vsftpd.conf, using Ubuntu’s snake-oil certificate for an isolated test.
ssl_enable=YES
force_local_logins_ssl=YES
force_local_data_ssl=YES
ssl_tlsv1_2=YES
ssl_sslv2=NO
ssl_sslv3=NO
ssl_tlsv1=NO
ssl_ciphers=HIGH:!aNULL:!MD5
ssl_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
ssl_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
The test certificate is unsuitable for public clients because it lacks a trusted, hostname-matching identity. Install a certificate and full chain for the public hostname, point the ssl directives at those files, and restrict the private key to root. Renew it before expiry; a failed handshake is a certificate lifecycle failure, not merely a connectivity fault.
In FileZilla, create a site with the hostname, username and passive transfer mode, then select Explicit FTP over TLS for encryption. Some clients call this FTP with TLS. Test that the server refuses an unencrypted login rather than assuming a client setting took effect. Avoid AUTH TLS on a service configured for explicit FTPS: the two forms negotiate the secure session differently.
Keep FTP credentials separate from administrative SSH credentials, and never embed them in scripts. For unattended jobs, use a restricted system account with a rotated secret rather than a person’s login. If SFTP satisfies the requirement, use it and gain SSH’s stronger authentication options. Plain FTP remains available unless a client requests TLS, so enforce the approved mode in clients and at the network boundary.
Configuring firewalls and routers
vsftpd supports passive mode, which is the practical choice for internet-facing servers. Keep pasv_enable=YES and choose a narrow data-port range in vsftpd.conf.
pasv_min_port=40000
pasv_max_port=40100
Allow the control port and that range through the local firewall. Preserve an existing SSH rule and test it before enabling UFW, or administrators can lock themselves out. Passive transfers do not need inbound port 20.
sudo ufw allow 21/tcp
sudo ufw allow 40000:40100/tcp
Australian NBN routers from providers such as Telstra, Optus or TPG commonly sit between the public connection and a private LAN. Forward TCP port 21 and the chosen passive range to the server’s fixed local address, reserve that address in the router’s DHCP settings, and apply the same rules in a cloud security group. Do not publish the private 192.168.1.x address as the FTP hostname. Use dynamic DNS if the public address changes, and prefer a VPN where clients are controlled.
Location affects performance as well as reachability. A Brisbane publisher sending large files to a Sydney-hosted server may see more latency than users in Melbourne experience. Compare transfers to the actual client locations, place the server near most users where practical, and use compression for text or compressible assets. FTP cannot remove the physical delay, but a regional host and sensible batch schedule can prevent long transfers from obstructing interactive work.
Testing transfers and reading logs
Test from a client outside the server’s LAN. FileZilla should show a successful Explicit FTP over TLS connection, followed by correct directory listings, an upload, a download and a deletion. Curl provides a quick command-line check; omit the password after the colon so it is requested interactively.
curl --ftp-ssl --user alice ftp://server.example.au/reports/summary.txt
curl --ftp-ssl --user alice -T report.txt ftp://server.example.au/incoming/report.txt
Use a test file first, since the second command overwrites a matching remote file.
Enable transfer logging and watch both the service journal and its transfer log. Avoid verbose protocol logging unless a specific investigation requires it, because filenames and network addresses may be sensitive.
xferlog_enable=YES
xferlog_file=/var/log/vsftpd.log
xferlog_std_format=NO
sudo journalctl -u vsftpd -f
sudo tail -f /var/log/vsftpd.log
Connection, authentication and permission failures look similar in a client. Confirm the account is allowed, the home is readable, the destination is writable and the certificate matches the hostname. If a passive connection reaches the control port but stalls on data, inspect the advertised passive address, the firewall range and any router forwarding. Check free disk space before diagnosing a mysterious zero-byte transfer, and verify that a restored file—not merely a backup archive—can be read.
Maintaining a secure, compliant service
Make configuration persistent and recoverable. Enable the daemon at boot with sudo systemctl enable vsftpd, keep a sanitised copy of vsftpd.conf under change control, and back up certificates and keys in a protected location. Document every non-default directive and its reason. After a change, restart the service, repeat the client test and preserve the relevant log output.
Personal information needs a defined purpose, an access list and a retention period. The Privacy Act 1988 applies to many Australian organisations, while Victorian legislation such as the Privacy and Data Protection Act 2014 may add obligations for relevant records. FTP logs can contain usernames, IP addresses and filenames, so treat them as potentially sensitive. Set rules for who may transfer data, which recipients may receive it, how long it remains and when it is securely deleted.
The Australian Signals Directorate’s Essential Eight provides a practical checklist for patch management, access restrictions, backups and incident response, even for teams that are not legally bound to use it. Pair it with regular account reviews, certificate expiry checks and tested restoration. Keep scheduled jobs in UTC while displaying local times in Brisbane, Sydney and Melbourne, which observe daylight saving differently. The finished service should have named owners, current credentials, verified backups and an audit trail that an administrator can interpret during an incident.