LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-20-2005, 12:03 PM   #1
whysyn
Member
 
Registered: Jun 2003
Location: Cleveburg, OH
Distribution: mostly Fedora
Posts: 154

Rep: Reputation: 30
php user admin


hello all!

i know this might have serious security implications, i will evaluate and address those later... right now i just want to brainstorm and get started...

i need a way to add/remove users and change passwords through a php script. (i would need to feed arguments to the script, and not have it run interactively). this needs to integrate into a web script, and be able to run as a non-root user, but still needs some sort of security.

hopefully, i can have a utility to allow a hosting customer to add/delete/modify their own email users within a certain set of constraints, for example, customer a has all of their user aaccounts prefixed with "ca-<user>" they would only supply the <user> part, and the script would automatically prepend the "ca-" so the customer would only be able to modify their own logins.

i hope this makes sense, and maybe somebody will have a suggestion to at least get me started...

thanks!
 
Old 10-20-2005, 01:18 PM   #2
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
You could always execute a setuid script (chmod +s) with php but be very carefull
- what could happen if the page reloads and the script get executed more than one time ?
- if the script allows user to change password, make sure they can't do it for the root user

Take care of the worst thing that could happen
 
Old 10-21-2005, 10:52 AM   #3
whysyn
Member
 
Registered: Jun 2003
Location: Cleveburg, OH
Distribution: mostly Fedora
Posts: 154

Original Poster
Rep: Reputation: 30
Thanks for the tips. I was planning on using sudo, with the entire path to the script in the sudoers file, and the file only set for read & execute.

I would have built in checking to see if the user exists, etc., as well as only allowing users starting with "ca-" to be added/removed/modified by the script.

Here is the part I'm stuck on, and hopfeully somebody can point me in the right direction:
The system command "passwd" needs to run interactively, so I can't call that from within the php and just feed it variables... how can I actually set/update passwords on the accounts from within a non-interactive php script?

Thanks again!
 
Old 10-21-2005, 11:36 AM   #4
ralvez
Member
 
Registered: Oct 2003
Location: Canada
Distribution: ArchLinux && Slackware 10.1
Posts: 298

Rep: Reputation: 30
I think that what you want to do is best achieved by creating a directory (say: admin) and setting the .htaccess file in that directory, and then placing the php script there.
This would do two things for you: 1) establish a secure access to the php file. 2) Allow you to run the script with whatever access you need to resources.
There is also the possibility ouf using an "access" file (typically set outside the webserver area (for security reasons) that grants access to using the php script if they are "in the file".

Hope this helps.

Rick
 
Old 10-21-2005, 11:58 AM   #5
whysyn
Member
 
Registered: Jun 2003
Location: Cleveburg, OH
Distribution: mostly Fedora
Posts: 154

Original Poster
Rep: Reputation: 30
Thanks!

Again, I'm fairly set on security... what I need to know is how to set passwords properlyeither through the php script or a system call. 'passwd' will not work, so I'm looking for a nudge in the right direction for the actual act of setting/updating a password.
 
  


Reply


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
User admin and N/w admin on Gnome hangs ssrini *BSD 2 07-28-2005 07:55 AM
php-nuke blank admin.php zuessh Linux - Software 18 05-03-2005 07:47 PM
Searching For Someone who can hack Admin panel on PHP! :) skate Linux - Software 3 12-29-2004 09:26 AM
Admin user dee3lmo Linux - Security 1 07-12-2004 04:07 PM
User admin. How to change a user... Pug405 Linux - General 3 04-09-2004 01:33 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:42 AM.

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