Good day to you all!
I have a Ubuntu 18.04 LTS server with MySQL 8.0 and ProFTPD 1.3.5e Server.
I used these instructions to set up MySQL authentication for ProFTPd.
https://medium.com/@nico26deo/how-to-set-up-proftpd-with-a-mysql-backend-on-ubuntu-c6f23a638caf
And it works great!
The article above sets up the first user "test" with a UID of 5500 and a GID of 5500. It says that the FTP user directory should be created and chowned to 5500:5500. All very nice.
What it does not say is what to do when the second and third and successive users come along. It is easy to create new users in the database with an INSERT query but should the UID and GID be unique to the new ftp user? If so, is there an easy way to get MySQL to AUTO_INCREMENT the new values above 5500 and 5500 respectively?
Obviously, outside of that query, I will need an auxiliary process that creates the directory and chowns it to the correct UID and GID in the database. My thoughts is as follows:
So to make my questions crystal clear:
Thanks!
For auto-incrementing using MySQL, you can define the UID and GID columns, in your users table, as using the AUTO_INCREMENT
MySQL keyword.
In general, it is best to have separate UID and GID values for your users. This helps ensure that filesystem access/permissions to those files are unique/separate. If you re-used the same UID/GID for all your users, it is like having one user with multiple working passwords -- to the filesystem, all the files and directories would be owned by, and accessible to, the same user, regardless of how they logged in. A mistaken configuration would allow one user to access another user's files, because to the filesystem (which only cares about UIDs/GIDs, not names), they are all the same.
As for creating the home directories, this can be automated/done in ProFTPD itself, using its CreateHome
configuration directive.
Hope this helps!