# ProFTPD Configuration for WHP with PAM Authentication
# This configuration uses PAM authentication to integrate with system users
# and filesystem quotas - much simpler and more secure than MySQL

# Basic Server Settings
ServerName                      "WHP ProFTPD Server"
ServerType                      standalone
DefaultServer                   on
Port                            21
Umask                           022
MaxInstances                    50
MaxClients                      50
MaxClientsPerHost               3
UseReverseDNS                   off

# User/Group Settings
User                            nobody
Group                           nobody

# Authentication Settings
AuthOrder                       mod_auth_pam.c mod_auth_unix.c
AuthPAM                         on
AuthPAMConfig                   proftpd
RequireValidShell               off

# Directory and Security Settings
DefaultRoot                     ~
ShowSymlinks                    on
TimeoutNoTransfer               600
TimeoutStalled                  600
TimeoutIdle                     1200
DisplayLogin                    welcome.msg
DisplayChdir                    .message
ListOptions                     "-l"
DenyFilter                      \*.*/

# Transfer Settings
AllowOverwrite                  on
AllowStoreRestart               on
AllowRetrieveRestart            on

# Passive Mode Settings (for firewalls/NAT)
PassivePorts                    60000 60100
MasqueradeAddress               192.168.1.105

# Logging
SystemLog                       /var/log/proftpd/proftpd.log
TransferLog                     /var/log/proftpd/xferlog
ExtendedLog                     /var/log/proftpd/access.log ALL
ExtendedLog                     /var/log/proftpd/auth.log AUTH

# Welcome Messages
DisplayLogin                    welcome.msg

# Security Settings
RootLogin                       off
RequireValidShell               off
DefaultRoot                     ~
AllowOverwrite                  on

# Limit access to hosting users only (UID >= 1000, exclude system users)
<Limit LOGIN>
    DenyUser root
    DenyGroup root
    # Allow hosting users (UID >= 1000)
    AllowUser *
</Limit>

# Per-user directory creation and permissions
<Directory ~>
    Umask 022
    AllowOverwrite on
</Directory>

Include /etc/proftpd/conf.d/*.conf