Skip to content

Documentation/netutils: add comprehensive guide for ftpd - #20514

Merged
xiaoxiang781216 merged 1 commit into
apache:masterfrom
Swatantra-66:doc/ftpd-guide
Oct 9, 2026
Merged

xiaoxiang781216 merged 1 commit into
apache:masterfrom
Swatantra-66:doc/ftpd-guide

Conversation

@Swatantra-66

Copy link
Copy Markdown
Contributor

Summary

Provide a comprehensive documentation guide for the ftpd (FTP server) network utility in Documentation/applications/netutils/ftpd/index.rst, replacing the previous 6-line placeholder stub.

Addresses #11081.

Key Additions:

  1. Architecture & Multi-Threading Model:
    • Details master server listening socket on port 21, dynamic worker pthread creation per client connection (CONFIG_FTPD_WORKERSTACKSIZE), control vs. data stream separation, and POSIX VFS mapping.
  2. Security Considerations & Credential Hardening:
    • Highlights unencrypted plaintext FTP credentials risks, network isolation recommendations, home directory jail enforcement (FTPD_ACCOUNTFLAG_GUEST), mandatory credential hardening advice, and encrypted password authentication (CONFIG_FTPD_LOGIN_PASSWD).
  3. Supported Commands Reference:
    • Complete table covering RFC 959 core commands, RFC 2428 IPv4/IPv6 extensions (EPRT, EPSV), and RFC 3659 metadata extensions (SIZE, MDTM).
  4. Configuration Reference:
    • Comprehensive Kconfig table (CONFIG_NETUTILS_FTPD, worker stack sizes, command buffer lengths, data buffer transfer sizing, port options).
  5. NSH CLI & External Client Walkthroughs:
    • Documents ftpd -4 / ftpd -6 (address-family options) and ftpd_stop NSH commands with account placeholders.
    • Provides interactive ftp and curl examples that avoid embedding plaintext passwords in command arguments (prompting securely to avoid shell history and process table exposure).
  6. Public C API Reference:
    • Covers ftpd_open(), ftpd_adduser(), ftpd_session(), and ftpd_close().
  7. Runnable Application Example:
    • Demonstrates multi-user server configuration, loop execution, and clean, thread-safe termination via sig_atomic_t signal handling (SIGINT/SIGTERM) and companion POSIX kill stop routines.
  8. Resource Tuning Guidelines:
    • Guidance on worker stack sizing for flash filesystems, I/O buffer sizing, and NAT/firewall passive mode operation.

Impact

  • Documentation: Fills a blank documentation page identified in Documentation: blank pages in documentation #11081.
  • Security: Warns users against plaintext credential transmission over untrusted links, documents directory isolation flags, and enforces secure credential practices.
  • Developer Experience: Eliminates confusion around mandatory -4/-6 CLI flags, account management, and thread-safe session termination.
  • Build / ABI: Documentation-only change. No functional code or ABI alterations to existing NuttX libraries or apps.

Testing

  • Verified reStructuredText syntax, section underline lengths, and directive syntax.
  • Verified 0 trailing whitespaces (git diff --check).
  • Validated command-line behavior and options against apps/examples/ftpd/ftpd_main.c.
  • Cross-referenced all public C API signatures and account flag constants against apps/include/netutils/ftpd.h and apps/netutils/ftpd/ftpd.c.

xiaoxiang781216
xiaoxiang781216 previously approved these changes Oct 8, 2026
acassis
acassis previously approved these changes Oct 8, 2026
@github-actions github-actions Bot added Area: Documentation Improvements or additions to documentation Size: L The size of the change in this PR is large labels Oct 8, 2026
hartmannathan
hartmannathan previously approved these changes Oct 8, 2026

@hartmannathan hartmannathan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well written doc! Thank you for helping to improve NuttX documentation!

@hartmannathan

Copy link
Copy Markdown
Contributor

Hmm, the CI complains there is unexpected indentation on line 42, but I don't see an indentation problem there. Does anyone know why it complains?

@acassis

acassis commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Hmm, the CI complains there is unexpected indentation on line 42, but I don't see an indentation problem there. Does anyone know why it complains?

I don't see it

@acassis

acassis commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Well written doc! Thank you for helping to improve NuttX documentation!

Good point. @Swatantra-66 if you are using AI to write the documentation (because its very well designed and formatted), please indicate it using: Assisted-by: AI Vendor and Model

Provide a complete documentation guide for the ftpd (FTP server) network
utility in Documentation/applications/netutils/ftpd/index.rst, replacing
the previous 6-line placeholder stub.

Includes:
- Protocol architecture overview (control/data connection separation, multi-session worker pthreads, VFS mapping)
- Security considerations regarding unencrypted plaintext FTP credentials, mandatory credential hardening, home directory isolation, and encrypted password authentication
- Comprehensive supported RFC 959 / RFC 2428 / RFC 3659 FTP commands reference table
- Configuration options table and networking prerequisites (CONFIG_NETUTILS_FTPD, worker stack size, buffer sizes)
- NSH terminal usage (ftpd -4 / -6, ftpd_stop) with address-family flag requirements and configured account placeholders
- External client connection walkthroughs (FTP CLI, cURL) using configured account and anonymous workflows
- Public C API reference for types, account flags, and lifecycle functions (ftpd_open, ftpd_adduser, ftpd_session, ftpd_close)
- Complete, runnable C application example demonstrating multi-user server setup, signal-driven termination (SIGINT/SIGTERM) with atomic sig_atomic_t state, POSIX kill stop routine, and credential placeholders
- Embedded design and resource tuning guidelines (stack sizing, flash/SD card I/O buffering, and NAT passive mode)

Addresses apache#11081

Assisted-by: Google Gemini
Signed-off-by: Swatantra Yadav <[email protected]>
@Swatantra-66

Copy link
Copy Markdown
Contributor Author

@hartmannathan @acassis Thank you for the reviews!

Regarding the line 42 indentation error: in Sphinx / Docutils, when sub-bullets are nested under an enumerated list (1., 2., 3.) without an intervening blank line, the reST state machine treats subsequent indented lines as an ambiguous blockquote, throwing an Unexpected indentation error on the very next numbered item (4.).

I have flattened those sub-items into clean inline text and verified locally with Docutils (0 warnings, 0 errors). I have also added the requested Assisted-by: Google Gemini tag to the commit message.

@xiaoxiang781216
xiaoxiang781216 merged commit a4b6b8b into apache:master Oct 9, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: Documentation Improvements or additions to documentation Size: L The size of the change in this PR is large

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants