We have an FTP where customers can drop their files. We want to run a script that sweeps the files out of the folders every 15 minutes.
The current permission and folder structure looks like this:
drwxr-xr-x 3 root ftpusers 4.0K Apr 12 20:45 client1
|-- drwxr-xr-x 3 client1 ftpusers 4.0K Apr 12 20:45 incoming
|-- drwxr-xr-x 3 client1 ftpusers 4.0K Apr 12 20:45 processed
drwxr-xr-x 3 root ftpusers 4.0K Apr 12 09:58 client2
|-- drwxr-xr-x 3 client2 ftpusers 4.0K Apr 12 20:45 incoming
|-- drwxr-xr-x 3 client2 ftpusers 4.0K Apr 12 20:45 processed
drwxr-xr-x 3 root ftpusers 4.0K Apr 12 07:06 client3
|-- drwxr-xr-x 3 client3 ftpusers 4.0K Apr 12 20:45 incoming
|-- drwxr-xr-x 3 client3 ftpusers 4.0K Apr 12 20:45 processed
My first thought was to create a user that has no password and make it part of the ftpusers group and then give ftpusers write access, but that seems like it would give unnecessary permissions to the client* accounts that wouldn't be secure. Also, vsftp prohibits using chroot jails with folders that have write access to any other user than root.
What is the best practice for setting up a cron / user that can execute a task like this? It's job is going to be finding all files in the incoming folders, pushing them to an API and then moving them to the processed folders. It needs to be able to modify files across the entire set of folders.