Add new system users with exec() ??

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
samsbox
Forum Newbie
Posts: 4
Joined: Mon Apr 19, 2004 2:52 am
Location: Telford, UK

Add new system users with exec() ??

Post by samsbox »

I want to be able to add new users to my Linux box using PHP's exec() command.

Can it be done? If so, could someone please explain how...

All help is appreciated, so thanks for your time :)
kettle_drum
DevNet Resident
Posts: 1150
Joined: Sun Jul 20, 2003 9:25 pm
Location: West Yorkshire, England

Post by kettle_drum »

Of course it can. You can either use exec() or system() to run a command to add a user - just like you would if you were on the command line.

Or you can open the passwd file and insert the line by hand. Or you can use exec() or system() again to do something like exec('echo blah:::: > etc/passwd');
Post Reply