[pure-ftpd] pure-uploadscript runs script as 'root' despite --uid option

Timur Tabi <[email protected]> Mon, 24 Feb 2020 08:42:15 -0600
Newsgroups gmane.network.pureftpd.user
Message-ID <[email protected]>
I'm running pureftp on my Raspberry Pi 4, and I have a shell script I 
wrote that calls youtube-upload on the file that is ftp'd. 
youtube-upload looks for the ~/.client_secrets.json and 
~/.youtube-upload-credentials.json configuration files.  However, when I 
pure-uploadscript runs my script, it's run as USER=root:

Using client secrets: /root/.client_secrets.json
Using credentials file: /root/.youtube-upload-credentials.json
Traceback (most recent call last):
[...]
oauth2client.clientsecrets.InvalidClientSecretsError: ('Error opening 
file', '/root/.client_secrets.json', 'Permission denied', 13)

When I use the --uid and --gid options, the UID and GID seems to be set 
correctly, but the USER is still root, which means ~ is /root not /home/pi.

How do I get pure-uploadscript to really run my script as user 'pi'?