Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

unix user authentication 2

Status
Not open for further replies.

esromneb

Programmer
Mar 30, 2002
76
US
Hi, I'm trying to setup an admin pannel (using php) where users can login and change their passwords. For awhile I was using webmin, but it's too much work and I'd rather do it myself. I also want to allow users to change passwords for extra e-mail accounts they have created. My first problem is the login. I can't figure out how to authentiate a unix user using php. First I tried to
su $username
using proc_open. However, this returns the error (in stderr) "standard in must be a tty". I also tried to compare the user and hashed password against /etc/shadow but I can't figure out how to sudo for a fopen. Any ideas? Thanks
-ben
 
Use this to set a term environment before calling su... some unix command need a TERM env.:

from:
<?php
exec('TERM=xterm /usr/bin/top n 1 b i', $top, $error );
echo nl2br(implode(&quot;\n&quot;,$top));
if ($error){
exec('TERM=xterm /usr/bin/top n 1 b 2>&1', $error );
echo &quot;Error: &quot;;
exit($error[0]);
}
?>

Hope this help!

Sincerely,

Dan Grant
Lead programmer
dan at abusinesshosting dot com
 
If all you want to do is provide a method for users to add/modify accounts, there is a module for webmin that will do that.
 
Really? I looked into it a little bit, but I never thought of searching for a module. If possible I'd acually like to program my own module. I have a little perl exp, but I don't have a clue about where to start. Any ideas/suggestions/tutorials would be much appreciated.

P.S: If I used the above mentioned module, how would it work? I'm still having cgi problems on my server. suexec is being a pain...
 
Thanks but I already am struggling with usermin. I don't think it's the right module for me. I'm using it with virtualmin and it just gives the user too much control. I'm interning at a startup company, and they are hosting webpages. With virtualmin and usermin together, the user can change such things as his dns settings and appache config. I'd rather write my own modules for usermin. Does anybody have and documentation on _that_ ? Thanks.
 
yea, I looked at those, and they were a bit over the top..

Well, the only documention is provided on
The docs assume you know how to 'code' and cover only how to write apps for webmin/usermin etc
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top