FTP Hooks

ftp_(create|modify)_post.sh

This script is called after an FTP account is created or modified.

Environment variables

  • username: DA account name
  • user: ftp username, e.g., "fred"
  • domain: domain name where the account is created/modified
  • login: login name for ftp account... if the IP is owned or a system account, the username would be just the username, e.g., "fred", whereas for a shared IP, it would be "username@domain.tld", e.g., "fred@domain.com"
  • passwd: password set for the user
  • password_is_already_crypt(0|1): whether the passwd variable is already encrypted
  • gecos: account type (system, ftp, user, custom)
  • root: document root path for account
  • file: file password is stored in /etc/proftpd.passwd or /usr/local/directadmin/data/users/username/ftp.passwd

ftp_delete_post.sh

This hook is called after an FTP account is deleted.

Environment variables

  • username: DA account name
  • user: FTP username, e.g., "fred"
  • domain: domain name where account is deleted
  • login: login name for FTP account (if IP is owned or a system account, then "fred", if shared, then "fred@domain.com"
  • file: file password is stored in /etc/proftpd.passwd or /usr/local/directadmin/data/users/username/ftp.passwd

ftp_change_pass_(pre|post).sh

API hook for changing the FTP account password.

  • ftp: user
  • domain: domain
  • main_domain: 1 or 0 (is this the main IP of the user account)
  • is_owned_ip: 1 or 0 (is this account on an owned IP)
  • passwd: newpass

Note that main_domain and is_owned_ip are important! If both of them are set to 1, the ftp login is just "user" and not "user@domain.com" (even though the change password form requires user@domain.com in all cases). All cases of is_owned_ip=1 means that the ftp.passwd file is:

/usr/local/directadmin/data/users/username/ftp.passwd
1

and not:

/etc/proftpd.passwd 
1
Last Updated: 6/23/2021, 9:36:08 PM