0

I've found some tutorials for ProFTP with MySQL connection. But these handling by general scheme, 99% of them are identically. And do not go into the detail of the configuration.

Is SQLGroupInfo required?

I've noticed the groups are always the same. Therefore, only one database record is needed in the groups table.

I want to fix this by omitting the group table and setting it directly in the configuration.

How can I do this?

The first try was, to register a custom query:

# Hardcoded groups
SQLNamedQuery get-groups SELECT 'ftp' AS `name`, 2001 AS `group`, 'ftpd' AS `members`
SQLGroupInfo sql:/get-groups

But here, i've get following error:

fatal: SQLGroupInfo: badly formatted parameter on line 34 of '/etc/proftpd/sql.conf'

Adrian Preuss
  • 3,228
  • 1
  • 23
  • 43

1 Answers1

1

The problem is, i must return correct rows like gid, groupname and members. If wanted, you can remove the FROM $table WHERE [...], thats not required.

Here is the solution:

# Hardcoded groups
SQLNamedQuery get-group-by-name SELECT "`username` AS `groupname`, '1010' AS `gid`, `username` AS `members` FROM `fh_ftp_user` WHERE `username`='%{0}'"
SQLNamedQuery get-group-by-id SELECT "`username` AS `groupname`, '1010' AS `gid`, `username` AS `members` FROM `fh_ftp_user` WHERE `username`='%{0}'"
SQLNamedQuery get-group-by-member SELECT "`username` AS `groupname`, '1010' AS `gid`, `username` AS `members` FROM `fh_ftp_user` WHERE `username`='%{0}'"
SQLGroupInfo custom:/get-group-by-name/get-group-by-id/get-group-by-member

Or

# Hardcoded groups
SQLNamedQuery get-hardcoded-group SELECT "'YourHardcodedGroup' AS `groupname`, 1010 AS `gid`, 'MemberName' AS `members`"
SQLGroupInfo custom:/get-hardcoded-group
Adrian Preuss
  • 3,228
  • 1
  • 23
  • 43