[Proftpd-user] How do you set environment variables?

Ryan Nation <[email protected]> Fri, 27 Jan 2023 00:56:44 +0000
Newsgroups gmane.network.proftpd.user
Message-ID <CH3PR19MB7874094F610D8A7EDFE7E6CEE4CC9@CH3PR19MB7874.namprd19.prod.outlook.com>
I'm running ProFTPD 1.3.6c on Ubuntu 20.04. I'm trying to use an environment variable for the SQLConnectInfo password:


SQLConnectInfo                  proftpd proftpd %{env:PROFTPD_DB_PASSWORD}

To prove my syntax is correct and the variable is working I set the variable using SetEnv in my proftpd.conf. That works no problem. I can also start ProFTPD manually from the command line and using -D to pass the variable from my shell:

sudo /usr/sbin/proftpd -c /etc/proftpd/proftpd.conf -n -DPROFTPD_DB_PASSWORD=$PROFTPD_DB_PASSWORD

The problem is when I run ProFTPD as a service. It doesn't pick up the environment variable and I ultimately get an error in my sql.log:

message: 'Access denied for user 'proftpd'@'localhost' (using password: YES)'

So where is the best place to set the environment variable and how do you pass it to the service? I'm managing the service using systemctl if that helps.

ubuntu@proftpd:/etc/proftpd$ sudo systemctl status proftpd
● proftpd.service - LSB: Starts ProFTPD daemon
     Loaded: loaded (/etc/init.d/proftpd; generated)
     Active: active (running) since Fri 2023-01-27 00:35:03 UTC; 18min ago
       Docs: man:systemd-sysv-generator(8)
    Process: 1345 ExecStart=/etc/init.d/proftpd start (code=exited, status=0/SUCCESS)
      Tasks: 1 (limit: 1143)
     Memory: 5.5M
     CGroup: /system.slice/proftpd.service
             └─1354 proftpd: (accepting connections)

Jan 27 00:35:03 proftpd systemd[1]: proftpd.service: Succeeded.

_______________________________________________
ProFTPD Users List   <[email protected]>
Unsubscribe problems?
http://www.proftpd.org/list-unsub.html