FTP downloads (PBFtp)

Callers can download files from your board with any FTP program, such as FileZilla, WinSCP, lftp or curl. They log in with their own BBS name and password and see one folder for each file area they may use. It is download only: there is no upload, delete or rename, and no real folder of your disk is ever visible.

  • Login. The caller's BBS user name (or alias) and password, checked against USERS.BBS by the same code the web portal uses. Level 0 users and deleted accounts never get in.
  • Folders. One per file area, named <area number> - <area name>, shown only if the caller's level and flags allow that area. Each lists the files named in that area's listing that exist on disk. A file that is on disk but not in the listing is not visible.
  • Limits. The same rules as downloads on the board and in the web portal: the daily KB limit, upload and ratio rules, download hours, free areas and FREEFILE.CTL, and the IGNORE flag. A file is charged only when its last byte was delivered, so a dropped connection costs nothing. Resume works. The FTP command SITE ALLOWANCE shows what is left today.
  • Security. Explicit FTPS (RFC 4217). By default TLS is required: a caller must start TLS before anything else and a plain login is refused. The data channel must be encrypted as well, must resume the control connection's TLS session, and must come from the same address. Active mode is refused. TLS 1.2 or newer.
  • Login Guard. Wrong passwords count toward Login Guard. Banned addresses get an FTP 421 reply.

PBDispatch owns the FTP port and starts one PBFtp.exe for each caller, so a download in progress survives restarting PBDispatch.

Set it up

The FTP Server screen in PBConfig Figure 1. Network > FTP Server in PBConfig. In this picture plain FTP and sharing with the QWK hub are both ticked; neither is on by default.

The screen is laid out in sections. On the left are FTP server (enable, plain FTP, sharing with the QWK hub, port, session limits, lowest level, wrong passwords, greeting name) and Certificate (TLS). On the right are Network (passive mode), Downloads and security, Users who may not use FTP (one name per line) and Folders and log. Leave the user database folder empty to use <system folder>\MSGBASE\. The two boxes under Downloads and security are both on by default: the first applies the board's download limits, counters and log, and the second requires data connections to resume the TLS session. Un-tick the second only if a caller's FTP program cannot connect.

  1. Open Network > FTP Server in PBConfig and tick Enable the FTP server. The defaults suit most boards: port 21, passive data ports 50100 to 50200, 8 sessions, 5 per address, minimum level 1. Tick Also allow plain FTP only if you want unencrypted logins too (use it on a LAN or VPN, or for old programs that cannot do TLS).
  2. Certificate. FTP over TLS needs one. Either type the host name or address your callers will use into Name on the certificate and click Create self-signed certificate (it works at once; FTP programs show its fingerprint the first time and ask you to trust it), or put a certificate from a certificate authority, in PEM format, into the two file boxes. A renewed certificate is picked up without a restart.
  3. Network. Behind a router you must forward the control port (21) and the whole passive range (50100 to 50200), allow both in Windows Firewall, and set External address to your public IPv4 address or DNS name. auto hands out the address the caller connected to, which is right on a LAN and wrong behind NAT. If you skip this, callers connect but cannot list or download.
  4. Click Save, then Test settings. It checks the file, the certificate, the file-area setup and the user database.
  5. Restart PBDispatch (a changed port, session limit or on/off switch needs it). The log shows FTP enabled and FTP: listening … on port 21. A bind error means the port is taken.

Tools > FTP Sessions… in PBDispatch lists who is connected and says whether the port is really open (NOT LISTENING if not).

Ports

Port 21 and the passive range 50100 to 50200 are the defaults. The range was chosen to avoid the PBLink QWK hub's passive range (50000 to 50040). The SSH server uses 22. The hub's built-in FTP server also defaults to port 21, so on one PC with default settings the second one to start fails. Give one of them another port, or share the port as below.

Sharing the port with the QWK hub

The two servers can share one port, the one in PBFTP.CFG, with the caller's first command deciding which gets the call: AUTH TLS goes to PBFtp, a user name that is one of the hub's node IDs goes to the hub, and any other user name goes to PBFtp as plain FTP (if allowed).

  1. Network > QWK Hub: change the hub's FTP port to a private one such as 2021, set its bind address to 127.0.0.1, and keep its passive range apart from PBFtp's. Save and restart the hub.
  2. Network > FTP Server: set the port callers already use, tick Share this port with the QWK hub, and save.
  3. Restart PBDispatch. Its log says FTP: the QWK hub shares this port. Your nodes keep calling the same host and port as before.
  4. Forward and allow the shared control port and both passive ranges.

Keep hub node IDs different from BBS user names. Hub nodes use plain FTP, so a node whose software tries AUTH TLS first would reach PBFtp and could not log in as a node. If the hub is stopped, node calls get 421 and BBS callers are not affected.

Settings reference (''Configs\PBFTP.CFG'')

PBConfig writes the file. If it does not exist, FTP is off. If it has a mistake, the log names the line and FTP stays off.

Setting Meaning Default
enabled yes or no. yes
port Control port. 21
allowplain Also accept unencrypted FTP. no
hubroute, hubcfg Share the port with the QWK hub, and where the hub's config is. no
maxsessions, maxperip Limits (1 to 64) for everybody, and per address. 8, 5
syspath, msgpath The data folder, and where USERS.BBS lives.
certfile, keyfile PEM files. Optional when allowplain yes.
passiveports low-high 50100-50200
externaladdress auto, an IPv4 address or a DNS name. auto
bbsname, banner Text in the greeting.
logfile Session log (connects, logins, downloads, refusals).
idletimeout, transfertimeout Seconds without a command, or a stalled transfer. 300, 120
sessionreuse Data connections must resume the control TLS session. yes
downloadaccounting Apply the board's download rules. yes
minlevel Lowest security level that may use FTP. 1
denyuser A user who may not use FTP. Repeatable.
maxloginattempts Wrong passwords per connection (1 to 10). 3

Things to know

  • A few FTP programs cannot resume a TLS session on the data connection (Python's ftplib, some old or embedded clients) and get a 522 error. Setting sessionreuse no lets them in at a small cost in safety. FileZilla, WinSCP, lftp and curl do not need it.
  • A user is blocked by level (minlevel) or by name (denyuser). Account expiry dates are not checked.
  • Users flagged to ignore download hours and KB are exempt from hours and charges, but still hit the daily KB limit.
  • ASCII mode is accepted, but nothing is translated.
  • PBFtp never writes USERS.BBS. Charges go to the same ledger the web portal uses, and ProBoard.exe adds them to the user's record at their next logon. Until then the limit still holds.
  • Passwords are never written to any log.

Testing

From the ProBoard folder:

PBFtp.exe -cfg Configs\PBFTP.CFG -test
netstat -ano | findstr ":21 "
curl --ssl-reqd --insecure -u name:password ftp://localhost:21/

The first checks everything without a network connection; every line should say OK. The second shows whether PBDispatch is listening. The third lists the root over TLS (–insecure only because of a self-signed certificate). Test from the same PC first, then another PC, then from outside. If login works but a listing hangs, the cause is the passive range or the external address.