I've read the previous posts but I'm still looking for a good way to manage directories permissions and users. Here's the layout :
- You have a php app whose code is provided by 3rd party. Dirty things are done in php code, like changing file permissions, creating temporary files in docroot subfulders, uploading arbitrary files.
- There must be some ssh, ftp and sftp accounts for coworkers, scripts and external webdesigners.
Here's what you have to achieve :
- Apache should have read only permission on documentroot except for a few subfolders (let's call them upload and temp) where it must have read write access.
- External webdesigners foo and bar should have sftp read write access to a few subfolders (let's call them "css" and "static"). And of course they know how to mess with umask client side.
- Scripts have ftp read write access to only one directory (call it "csv").
- Coworkers who have root access have no permission issue ;). Others coworkers, Null and Dave, must have at least ssh access with rw access to entire document root and read access to logs and configuration.
- Everyone must have is own unique login and password.
- Permissions should be set once for all : No more manual chown or chmod should be needed afterwards.
Question, how should be permissions, users and groups?
ps : The above is just an example but I have a "one more" real close case at work.
Bonus question #1 : Is it possible to prevent webdesigners from accessing the filesystem except directories css and static?
Bonus question #2 : Is it possible to ensure that files uploaded by php scripts are real pictures (not php scripts nor html page named .png nor .exe virus) without modifying php scripts?
Bonus question #3 : Is it possible to use vcs like subversion to manage docroot (more permission issues, binary and temporary file should be excluded... )?
Bonus question #4 : It would be nice if the setup could be portable (eg change from php to tomcat and from linux to aix)