LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 01-25-2005, 01:22 PM   #1
vigosh_j
LQ Newbie
 
Registered: Jan 2005
Posts: 2

Rep: Reputation: 0
URGENT: Need to verify user's password in Linux proghrammatically


Hi

The program has to prompt for user name and password and check it if it's correct , must work under any user account. on Fedora

getspnam doesnot work , due to read only flag set only for root on /etc/shadow file

Any ideas appreciated

Thanks in advance

Vigen
 
Old 01-25-2005, 01:30 PM   #2
leonscape
Senior Member
 
Registered: Aug 2003
Location: UK
Distribution: Debian SID / KDE 3.5
Posts: 2,313

Rep: Reputation: 48
How about su? If it suceeds then you have the right password, if not then it fails.
 
Old 01-25-2005, 03:20 PM   #3
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
If using pam, use the pam libraries. You should still be able to use those from userspace. I think.
 
Old 01-25-2005, 11:56 PM   #4
dustu76
Member
 
Registered: Sep 2004
Distribution: OpenSuSe
Posts: 153

Rep: Reputation: 30
Code:
[/home/soumen/tmp] $ cat ext
echo "su: correct password"
[/home/soumen/tmp] $ ls -l ext
-rwxr-xr-x    1 soumen   soumen         28 Jan 26 11:20 ext
[/home/soumen/tmp] $ #I am trying with correct password
[/home/soumen/tmp] $ su soumen -c "ext"
Password: 
su: correct password
[/home/soumen/tmp] $ echo $?
0
[/home/soumen/tmp] $ #I am trying with in-correct password
[/home/soumen/tmp] $ su soumen -c "ext"
Password: 
su: incorrect password
[/home/soumen/tmp] $ echo $?
1
[/home/soumen/tmp] $
This should enable you to come up with a shell script that suits your needs.

HTH.
 
Old 01-26-2005, 06:36 AM   #5
vigosh_j
LQ Newbie
 
Registered: Jan 2005
Posts: 2

Original Poster
Rep: Reputation: 0
PAM really worked from userspace
i did pam_start("su", ......
It worked on Fedora Core2, HP-UX 11 , but failed on SUN
An it only works for currently logged in user.
 
Old 01-26-2005, 06:56 AM   #6
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
please do not mark threads as urgent. it is not urgent for all the members whjo kindly donate the time to help others.
 
  


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
ow to create script change a user's password? passwd expects input from keyboard.. Arodef Linux - General 1 03-02-2005 10:40 PM
Lol I forgot a user's password urzumph Linux - Security 4 03-04-2004 05:00 AM
changing a regular user's password using root Pete Dogg Linux - General 2 11-28-2003 10:49 PM
Can I Confirm or Verify an md5 password? MikHud Linux - Security 1 04-03-2002 06:43 PM
Urgent, How can I reset linux password with Grab? sarmadys Linux - General 2 01-28-2002 08:12 AM

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

All times are GMT -5. The time now is 03:17 PM.

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