Can i write /etc/apache2/ directory. I want to create a file with php and apache. But i must root. Is there a way to sudoers?
Can do this?
Can i write /etc/apache2/ directory. I want to create a file with php and apache. But i must root. Is there a way to sudoers?
Can do this?
You can change the group of /etc/apache2 to the same group that apache runs as and give the group write permission. This might be safer than trying to su with php and a system call.
Any directory that you want the Apache process to write to needs to be writable by the user that the Apache daemon runs as. So you either need to make the directory world-writable (ie chmod 777) or owned by the Apache user.
You might be able to manage a way to do this, by changing /etc/apache2
's group owner or making your /etc/apache2
world-writable (permission 777), but this is perhaps the worst idea in the history of web-servers. Allowing your process to write files to that directory means that if someone found a way to write files with filenames other than those you specify, they could overwrite your virtualhosts, apace configurations, module configurations... you name it! You'd essentially be opening your webserver to any opportunistic internet thug who can rub two rootkits together and make a spark.