LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
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 11-26-2004, 01:40 AM   #1
kyiydnlm
LQ Newbie
 
Registered: Nov 2004
Posts: 6

Rep: Reputation: 0
how to verfy username/password pair


when i crypt(3) a password, i could not get an output matching the shadowed one. is there a function to verify username/password pair for LINUX as there's pwdauth(8) doing that for SunOS4? or how can i encrypt a password to match its shadowed password?

Last edited by kyiydnlm; 11-26-2004 at 01:43 AM.
 
Old 11-26-2004, 03:17 AM   #2
sigsegv
Senior Member
 
Registered: Nov 2004
Location: Third rock from the Sun
Distribution: NetBSD-2, FreeBSD-5.4, OpenBSD-3.[67], RHEL[34], OSX 10.4.1
Posts: 1,197

Rep: Reputation: 47
Re: how to verfy username/password pair

Quote:
Originally posted by kyiydnlm
how can i encrypt a password to match its shadowed password?
Use the same salt that the one in the shadow file has.

(reread man 3 crypt if that doesn't make sense)
 
Old 11-26-2004, 03:29 AM   #3
kyiydnlm
LQ Newbie
 
Registered: Nov 2004
Posts: 6

Original Poster
Rep: Reputation: 0
No, i do not think it's a problem of salt. shadowed password is much longer than crypt()'s output.

the_unforgiven's answer perhaps makes sense.

-------------------------------------------------------------
the_unforgiven Posted: Nov 26 2004, 03:42 AM
Linux Freak
Group: Members
Posts: 662
Member No.: 8,625
Joined: 3-January 04

Have you enabled MD5 passwords?
If yes, then crypt() won't give you the shadowed password.
You have to use the MD5 API - check out man 3 md5
-------------------------------------------------------------
 
Old 11-26-2004, 12:26 PM   #4
sigsegv
Senior Member
 
Registered: Nov 2004
Location: Third rock from the Sun
Distribution: NetBSD-2, FreeBSD-5.4, OpenBSD-3.[67], RHEL[34], OSX 10.4.1
Posts: 1,197

Rep: Reputation: 47
That would explain it. I asumed since you were using crypt() you had crypt()'d passwords. My bad.
 
  


Reply



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
username and password no go bmd Linux - Newbie 7 04-06-2005 08:26 PM
username/password sailu_mvn Programming 5 12-21-2004 03:21 AM
UserName and Password luis8460 Red Hat 0 07-08-2004 04:45 AM
Username and Password dance2die Arch 3 09-01-2003 03:32 PM
No username and password Tec1 Linux - Software 1 08-10-2003 09:38 AM

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

All times are GMT -5. The time now is 09:55 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