How to Configure BusyBox FTP Server (ftpd) Without inetd for Embedded Linux Systems


6 views

When working with embedded Linux systems using BusyBox, setting up an FTP server isn't as straightforward as running a single command. The standard approach using inetd might not be ideal for temporary access or development environments.

Here are three practical methods to run the FTP server without relying on inetd:

# Method 1: Standalone mode (requires -w flag for write access)
busybox tcpsvd -vE 0.0.0.0 21 busybox ftpd -w /path/to/ftp/root

# Method 2: Background process
busybox tcpsvd -vE 0.0.0.0 21 busybox ftpd -w / &

# Method 3: Using nohup for persistent connection
nohup busybox tcpsvd -vE 0.0.0.0 21 busybox ftpd -w / > /dev/null 2>&1 &

The tcpsvd utility handles the TCP connection management:

  • -v: Verbose output
  • -E: Don't set up environment variables
  • 0.0.0.0: Listen on all interfaces
  • 21: Standard FTP port

For quick file transfers during development, I recommend this setup:

#!/bin/sh
FTP_ROOT="/mnt/data"
mkdir -p $FTP_ROOT
chmod 777 $FTP_ROOT
busybox tcpsvd -vE 0.0.0.0 21 busybox ftpd -w $FTP_ROOT

Remember this setup has minimal security:

  • Use only in trusted networks
  • Restrict to read-only (-w flag removes all authentication)
  • Consider using SFTP instead if available

If you encounter "command not found" errors:

# Check if tcpsvd is compiled in your BusyBox:
busybox | grep tcpsvd

# If missing, you'll need to recompile BusyBox with:
# CONFIG_TCPSVD=y
# CONFIG_FTPD=y

Many embedded Linux developers face this exact scenario: you need quick file transfer capabilities on your resource-constrained device, but the standard Busybox ftpd implementation seems to require inetd configuration. Here's why this happens and how to work around it.

Busybox's ftpd was originally designed to work as part of the inetd superserver architecture for several good reasons:

busybox ftpd -w /
ftpd: use inetd or tcpsvd - use 'tcpsvd -vE 0.0.0.0 21 ftpd -w /'

The error message actually gives you the solution - tcpsvd is Busybox's built-in alternative to inetd:

tcpsvd -vE 0.0.0.0 21 ftpd -w / &

Let's break down the parameters:

  • -v: Verbose output
  • -E: Don't set up environment variables
  • 0.0.0.0: Listen on all interfaces
  • 21: Standard FTP port
  • ftpd -w /: The command to execute (-w allows write access to root)

For production systems, you'll want this to start automatically. Add to your startup scripts:

#!/bin/sh
# Start FTP server
tcpsvd -E 0.0.0.0 21 ftpd -w / &

Opening write access to root is dangerous. Consider these safer alternatives:

# Restrict to specific directory
tcpsvd -E 0.0.0.0 21 ftpd -w /home/ftp &

# Create FTP-specific user
adduser -D -h /home/ftp ftpuser
tcpsvd -E 0.0.0.0 21 ftpd -w /home/ftp

If tcpsvd isn't available in your Busybox build:

  • Recompile Busybox with tcpsvd support
  • Use a lightweight standalone FTP server like vsftpd or pure-ftpd
  • Consider SSH-based solutions (scp/sftp) if security is a concern

If things aren't working:

# Check if tcpsvd is available
busybox | grep tcpsvd

# Test with netcat
nc localhost 21