check Linux password from /etc/shadow
Hi,
I want to write a C Program that get a password and user name, then compare it with encrypted password in /etc/shadow. Please help me with SIMPLE CODES. |
Have a look here:
man crypt |
There's some simple examples here
|
I try below program:
Code:
#define _XOPEN_SOURCE Code:
gcc 1.c -o 1 Code:
/tmp/cci2MSHh.o: In function `main': |
try add -lcrypt in the gcc command line
|
OK, thanks.
Now how can I write a C Program that get a password and user name, then compare it with encrypted password in /etc/shadow for authentication? |
@ bgeddy,
That was an interesting and informative article. Thanks for posting it here. Linux Archive |
Finally I found the way. :)
Code:
#include <stdio.h> e.g.: root:$1$Og9RbNrT$/gNprNaDgv.hNS01Ue2gi1:14159:0:99999:7::: |
Thanks for this I've been trying a number of different example and this is the first that worked.
P.S. one minor typo "puts("Access granted"\n);" should be puts("Access granted\n"); |
All times are GMT -5. The time now is 04:30 AM. |