Re: [Proftpd-user] ProFTPd - virtual users + single ftp location

"TJ Saunders" <[email protected]> Thu, 14 Aug 2025 13:59:51 -0700
Newsgroups gmane.network.proftpd.user
Message-ID <[email protected]>

On Thu, Aug 14, 2025, at 13:48, TJ Saunders wrote:
>> 2. Modified proftpd.conf
>>
>> DefaultRoot /srv/ftp
>> RequireValidShell off
>> AuthUserFile /etc/proftpd/ftpd.passwd
>> AuthGroupFile /etc/proftpd/ftpd.group <https://ftpd.group>
>> AuthOrder mod_auth_file.c
>
> The AuthGroupFile directive only takes a single path; 
> '/etc/proftpd/ftpd.group' in this case.  Any additional parameters may 
> cause config parsing errors.
>
>> 3. Create user using ftpasswd:
>> ftpasswd --passwd --file=/etc/proftpd/conf.d/ftpd.passwd --name=user1 
>> --uid=105 --gid=65534 --shell=/bin/false
>
> Here, you are creating an AuthUserFile, using the `ftpassswd` utility, 
> located at '/etc/proftpd/conf.d/ftpd.passwd'.  However, above you have 
> configured AuthUserFile to point to '/etc/proftpd/ftpd.passwd', which 
> is a different path.  Which is correct?
>
>> 4. Start proftpd: systemctl start proftpd
>
> Could you provide the contents of your 
> '/usr/lib/systemd/system/proftpd.service' file?  I ask because 
> sometimes the systemd unit file provided by a distribution may point to 
> a different ProFTPD config file than the one edited, and/or provide 
> other unexpected options.
>
> Using an Ubuntu 24.04 Docker image, it looks to be:
>
>   # cat /usr/lib/systemd/system/proftpd.service 
>   [Unit]
>   Description=ProFTPD FTP Server
>   Documentation=man:proftpd(8)
>   Wants=network-online.target
>   After=network-online.target nss-lookup.target local-fs.target remote-fs.target
>
>   [Service]
>   Type=forking
>   Environment=OPTIONS= CONFIG_FILE=/etc/proftpd/proftpd.conf
>   EnvironmentFile=-/etc/default/proftpd
>   ExecStartPre=/usr/sbin/proftpd --configtest -c $CONFIG_FILE $OPTIONS
>   ExecStart=/usr/sbin/proftpd -c $CONFIG_FILE $OPTIONS
>   ExecReload=/bin/kill -HUP $MAINPID
>   PIDFile=/run/proftpd.pid
>
>   [Install]
>   WantedBy=multi-user.target
>
>> Starting up gives me the following errors:"fatal: unknown configuration 
>> directive" followed by the first line in the virtual users password file 
>> (/etc/proftpd/ftpd.passwd). This error occurs twice, but the weird thing 
>> is I am still able to login as user1.
>
> Could you provide the exact errors you see on startup, please?
>
>> Reddit's AI says that proftpd is looking for a format in 
>> Apache format <User>....</User>
>
> In this case, Reddit's AI is incorrect.  ProFTPD does not use that 
> Apache format; see:
>
>   http://www.proftpd.org/docs/howto/AuthFiles.html
>
>> The main problem though, is that after logging in successfully, I can 
>> download files from /srv/ftp, but I cannot upload ("Permission denied"). 
>> The directory ownership of /srv/ftp is the same as the user running 
>> proftpd (ftp:nogroup), but I suspect that I am missing some directive in 
>> proftpd.conf, but I have no idea. Am I missing a step perhaps?
>
> If you are able to run ProFTPD in debugging mode (which can itself be 
> more challenging than expected, when dealing with systemd), it should 
> log more details about why the uploads are not working as expected:
>
>   http://www.proftpd.org/docs/howto/Debugging.html

Using the same Ubuntu 24.04 Docker image, I think I found another issue you may be encountering:

  # ls -aldn /srv/ftp/            
  drwxr-x--- 2 101 65534 4096 Aug 14 20:45 /srv/ftp/

This says that only the UID 101 has write permissions (thus upload permissions) to create files in this directory.

In the command to create your AuthUserFile:

  # ftpasswd --passwd --file=/etc/proftpd/conf.d/ftpd.passwd --name=user1 --uid=105 --gid=65534 --shell=/bin/false

You assigned UID 105, GID 65534 to the user that is logging in.  Thus your session will use UID 105 when attempting to upload the file -- not UID 101.  This might be why you see "Permission denied" errors for your uploads.

Hope this helps,
TJ


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