I need to change the user php script at runtime. I looked at posix_setuid, but it looks unsafe and requires root priorities. What would be preferable is to change the script user id with the user password (something like posix_setuid($username, $password)) and avoid running the script as root.
I am open to other methods, and the script does not have to be PHP. However, it will be called from apache.
A good theology for the scenario is that cPanel su for the current user in this file manager.
I need to change the user because I am creating a file manager for multi-user setup. I currently have a file manager installed, so apache serves my PHP file manager as root. However, this is not reasonable, because in the event of a security error in the code, one user can edit files on the entire server.
I am looking for a SU method for a script for a registered user, so that in case of a security violation the user is limited only to his files.
source
share