PHP linux user setup form
Moderator: General Moderators
-
Jim_cliff11
- Forum Newbie
- Posts: 7
- Joined: Mon Nov 03, 2003 7:05 am
PHP linux user setup form
Hi all
Im having a problem tryin 2 setup linux user accounts on my linux server.
What i want to do is create a form that creates a new user account on my linux box, with the username that they specify, then ill email them with the password. For example:-
First Name : Joe
last name : Bloggs
Email Address : joe_bloggs@domain.com
Username : Joe_bloggs
Those are just the basic fields i would use.
But once the user clicks submit, i need the linux server to execute the following commands:-
adduser joe_bloggs
chmod 777 /home/joe_bloggs
mkdir /home/joe_bloggs/public_html
chmod 777 /home/joe_bloggs/public_html
Then when that has created the account the user is displayed the message:-
"Thankyou for using briskfire.com your account has been created and your password will be emailed to you within 24 hours"
Then when i have made the changes i need to their account set password, permissions ect then i will email them with the password.
I need it to be secure as well, i dont want my server to be hacked.
Thanks i appriciate it.
Im having a problem tryin 2 setup linux user accounts on my linux server.
What i want to do is create a form that creates a new user account on my linux box, with the username that they specify, then ill email them with the password. For example:-
First Name : Joe
last name : Bloggs
Email Address : joe_bloggs@domain.com
Username : Joe_bloggs
Those are just the basic fields i would use.
But once the user clicks submit, i need the linux server to execute the following commands:-
adduser joe_bloggs
chmod 777 /home/joe_bloggs
mkdir /home/joe_bloggs/public_html
chmod 777 /home/joe_bloggs/public_html
Then when that has created the account the user is displayed the message:-
"Thankyou for using briskfire.com your account has been created and your password will be emailed to you within 24 hours"
Then when i have made the changes i need to their account set password, permissions ect then i will email them with the password.
I need it to be secure as well, i dont want my server to be hacked.
Thanks i appriciate it.
Are you tying to do this from a web page? Creating the user from the web page with PHP is almost impossible without writing another process in the background that does most of the work for you.
If this statement is wrong please provide some code for doing it as I had the same question earlier this year.
Gary
If this statement is wrong please provide some code for doing it as I had the same question earlier this year.
Gary
-
Jim_cliff11
- Forum Newbie
- Posts: 7
- Joined: Mon Nov 03, 2003 7:05 am
web form
Yeh im tryin 2 create it on a webform. So that users just fill in the required info and their account is created.
What do u mean by some sort of background process?
Couldnt i just use the exec() command built into a php code?
Yes im looking for some coding help, to accomplish this
Thanks ppl
Jim
What do u mean by some sort of background process?
Couldnt i just use the exec() command built into a php code?
Yes im looking for some coding help, to accomplish this
Thanks ppl
Jim
The problem is that using exec() you are running under the user that apache is running under. Because of this you can run the exec() and run a script but it won't be able to add a user (no enough permissions).
You could also go down a more dangerous path that won't work. You could set the sticky bit on a special copy of the PHP binary under the root user context and use this in a secondary script (which in theory would then execute as root) but we also tried this. No go.
Finally, you could compile apache with the "BIG_SECURITY_HOLE" or something like that parameter then have apache itself run as root. Please note, by doing so every script that everyone creates can execute any root command (including changing the root password). If you go this route please let us know the IP address so the group can have fun...
On a more serious note. We have had much lunch with creating a daemon that pulls records from a database. We discovered this while writing an accouting application. The daemon on each server reads a central database. This daemon runs under the root context and CAN add users. You use the web page to add the things to do to the database then your daemon picks up this and low and behold the user is added.
Hope this helps,
Gary Smith
You could also go down a more dangerous path that won't work. You could set the sticky bit on a special copy of the PHP binary under the root user context and use this in a secondary script (which in theory would then execute as root) but we also tried this. No go.
Finally, you could compile apache with the "BIG_SECURITY_HOLE" or something like that parameter then have apache itself run as root. Please note, by doing so every script that everyone creates can execute any root command (including changing the root password). If you go this route please let us know the IP address so the group can have fun...
On a more serious note. We have had much lunch with creating a daemon that pulls records from a database. We discovered this while writing an accouting application. The daemon on each server reads a central database. This daemon runs under the root context and CAN add users. You use the web page to add the things to do to the database then your daemon picks up this and low and behold the user is added.
Hope this helps,
Gary Smith
-
xavigonzalvo
- Forum Newbie
- Posts: 2
- Joined: Wed Dec 17, 2003 4:52 pm
Add linux user from PHP
Here you will find some help in the topic:
http://www.salleur.edu/~st06375/php.html
or
http://www.planet-source-code.com/vb/sc ... ick+Search
Thank you
http://www.salleur.edu/~st06375/php.html
or
http://www.planet-source-code.com/vb/sc ... ick+Search
Thank you
-
xavigonzalvo
- Forum Newbie
- Posts: 2
- Joined: Wed Dec 17, 2003 4:52 pm
It's another way to do that
I have a question.
How many times the cron should act to add a new user?
How long between actions?
I thought about it, and I preferred to do an action every time a user adds himself.
How many times the cron should act to add a new user?
How long between actions?
I thought about it, and I preferred to do an action every time a user adds himself.