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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Linux User Authenication

Status
Not open for further replies.

aiyayo

Programmer
Aug 30, 2001
5
CA
hi everyone,

Seems many people using database to store user name and password for login purpose. I am wondering if I can use the database that linux already have (/etc/passwd) to do the authenication instead creating a database just for storing user name and password ? anyone know how to do it in PHP ?


that mean if someone try to login in html form, all we need is compare the uid and pwd with the linux host account list instead of running a sql statement.

Thank you
 
No because that is a system file and the passwords are hashed (similar to MD5) so they would not be readable. In addition, usually the people in the database to access your web site (especially a forum, discussion group, etc) aren't users on the system box.

I hope that helps.
 
Not sure if this will work, but try it.

SYNTAX NOT CORRECT...
$status = exec(su $userid $password)

if ($status == "")
....login
if ($status == "sorry")
....deny login.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top