How can I get apache2 to write password to etc/passwd in a script
by rblampain from LinuxQuestions.org on (#5BMDN)
I am not familiar on the subject.
There are plenty of solution examples on the net but all involve user input somehow. I am sure this is a basic problem faced by many, many times before.
I have script writing files under Apache2 with user www-data, which need later to be read by other www-data owned scripts, but one part of the script needs to write a hashed password to etc/passwd (useradd) which needs root permission. Changing the script permission halfway through its execution and then restoring it seems complicated, an overkill and risky, is there an easy way?
What is a conventional solution to this problem?
Thank you for your help.


There are plenty of solution examples on the net but all involve user input somehow. I am sure this is a basic problem faced by many, many times before.
I have script writing files under Apache2 with user www-data, which need later to be read by other www-data owned scripts, but one part of the script needs to write a hashed password to etc/passwd (useradd) which needs root permission. Changing the script permission halfway through its execution and then restoring it seems complicated, an overkill and risky, is there an easy way?
What is a conventional solution to this problem?
Thank you for your help.