1

I have been tasked with the job of creating a web based system to add system users to our Ubuntu linux server. I have been reading up online, and there seems to be a fair few different ways to go about doing it, none of which really have examples.

I understand the best way for me to do it would be to temporary give sudo to the apache user while adding the user and then remove it straight away with the sudo -k command.

I am unable to use any of the normal server admin interfaces as this is built in to a pre existing web admin panel. I am not massively experienced shell programmer too.

If anyone has got any links to good articles about scripting from PHP I would also be interested in reading.

Thanks In Advance

1 Answer 1

1

Probably the best option is to create a setuid program that adds the user and then use exec or similar to call it.

Sign up to request clarification or add additional context in comments.

2 Comments

If anyone else stumbles across this question and is considering the same thing, please, please, please consider the security issues during the design and implementation, in particularly, remember to validate user input.
To elaborate, when validating, consider both PHP script injections as well as shell script injections (e.g. '; rm -rf /').

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.