Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Linux Forums > Linux - Server
User Name
Linux - Server This forum is for the discussion of Linux Software used in a server related context.


  Search this Thread
Old 01-23-2013, 01:18 AM   #1
Registered: Sep 2007
Location: Folsom, California
Distribution: Debian 4.0 (Etch), Debian 5.0 (Lenny), Ubuntu 8.04
Posts: 302

Rep: Reputation: 32
Create user automatically via php web form

Hello all. Been a while since I've posted.

I'm working on a server project for me and some friends for data backup and storage.

I want to create local users from information collected in a web form I intend to create with php.

I will plan on having a database of user information so they can make some changes to their account. Not sure exactly what, but just to make it seem more offical.

I want to give them access to rsync (so ssh by default), ftp, owncloud and http of their own directories. I intend to use quotas to regulate the amount of storage space available to each user.

To the best of my knowledge, it is not possible to directly create a user via php do to privledge restriction. The only way I can think to do it is have the form store the information to a file and have a cron job create the account for me. I'm not sure how well this will work unless I tell the cron job to run frequently enough to make it convenient.

Does anyone have a better idea of how I might do this?

I'm aware of the possibility of using virtual users, but then I loose some ability to control quotas.
Old 01-23-2013, 03:06 AM   #2
Senior Member
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 2,380

Rep: Reputation: 849Reputation: 849Reputation: 849Reputation: 849Reputation: 849Reputation: 849Reputation: 849
I'm sure you'll get other posts about ensuring security etc. However to achieve what you've asked I would suggest:

When users complete the form display: "Your account may take up to X minutes to set-up, you will receive an e-mail when this is completed".
Store the information in a file and run your cron job to create users every X minutes (could even be every minute I suppose) and then notify the user by e-mail when it's created.

Alternatively could you specify that the user contect that PHP runs under (apache user?) has unpassworded sudo ability to run the relevant system commands?
1 members found this post helpful.
Old 01-23-2013, 06:53 PM   #3
LQ Guru
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,357

Rep: Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367
I'd prefer the former soln (ie it'll take a while to setup an acct), rather than allowing php/Apache any privileged cmds.
If you really want instant and secure, look at dnotify
This is probably overkill unless you NEED (not just want) an instant response/acct.
1 members found this post helpful.
Old 01-23-2013, 10:49 PM   #4
Registered: Sep 2007
Location: Folsom, California
Distribution: Debian 4.0 (Etch), Debian 5.0 (Lenny), Ubuntu 8.04
Posts: 302

Original Poster
Rep: Reputation: 32
I was thinking along those same lines. Just stating that it could take X amount of time for the account to become active. In the end it shouldn't really matter too much because it only occurs once. Of course, password changes could cause an account to be only accessable via an older password for X amount of time. But a small price to pay for security.

Thank you guys.


add, php, users, web form

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Automated Printing from PHP/MySQL web form information Using Debian Linux - Newbie 2 03-28-2011 01:00 AM
Virtualmin create server from web form DavidMaitland Linux - Server 1 06-15-2010 09:51 PM
Web form retrieve <select><option> with PHP esteeven Programming 2 08-01-2009 03:18 AM
how to create a chained js web form ? graziano1968 Programming 2 11-12-2004 03:55 AM
Add FTP User Via Web Form alanpollenz Linux - General 2 05-28-2004 05:14 PM

All times are GMT -5. The time now is 11:59 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration