LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices



Reply
 
Search this Thread
Old 12-06-2004, 05:03 PM   #1
jedediah
LQ Newbie
 
Registered: Sep 2004
Location: Oregon
Distribution: Slackware 10
Posts: 21

Rep: Reputation: 15
Command Line Password Check


I have a question for anyone out there who might be familiar with the command line.

I am designing a web application (in PHP) which will get a user's name and password, then change to a new password that the user requests.

However, I've run into a few small snags.

At first, I was going to just attempt to open an ssh session from php using the shell_exec() command (which lets a command line program to be run) and see if the session opens properly. But, as many will be quick to realize, there's no actual way to pass the user's password in a command line statement with ssh.

Then, my next thought was to log in to the local machine through ssh as root, and have a shell script automatically run that would confirm the user really gave me the right password. (I can log into root using a pub/priv key setup) However, I can't seem to find a method for checking whether or not the user gave me the correct password, seems like the applications passwd and chpasswd only let me change the password.

I looked into writing a script that would use "expect", but I don't have access to Tcl on this system, so expect isn't a possibilty.

Anyone have any suggestions?

Thanks a bunch.
 
Old 12-06-2004, 05:39 PM   #2
jailbait
Guru
 
Registered: Feb 2003
Location: Blue Ridge Mountain
Distribution: Debian Wheezy, Debian Jessie
Posts: 7,592

Rep: Reputation: 188Reputation: 188
"I am designing a web application (in PHP) which will get a user's name and password"

You could make the first command in the script invoke bash as a login shell:

/bin/bash -l -c (rest of script)

That should take care of verifying the old password.

See man bash.

-----------------------
Steve Stites

Last edited by jailbait; 12-06-2004 at 05:47 PM.
 
Old 12-07-2004, 04:13 PM   #3
jedediah
LQ Newbie
 
Registered: Sep 2004
Location: Oregon
Distribution: Slackware 10
Posts: 21

Original Poster
Rep: Reputation: 15
Clarification

Thanks for the help, unfortunately I'm having a little trouble getting bash to amount to anything worthwhile.

I spent some serious time digging through man bash, and I can't seem to find a way to make "-l" accept login information.

Any ideas?

Thanks again

Note: PHP is running as user "nobody", don't think that should make a difference though
 
Old 12-08-2004, 10:43 PM   #4
Krugger
Member
 
Registered: Oct 2004
Posts: 229

Rep: Reputation: 30
I was just wandering how a program that is running as nobody is going to read /etc/shadow. It would need to use something like PAM, right? There is a binary that does that. It is somewhere in /usr/local/bin or /usr/bin. It's the same route that screensaver take to verify the passwords.
 
Old 12-09-2004, 04:01 PM   #5
jedediah
LQ Newbie
 
Registered: Sep 2004
Location: Oregon
Distribution: Slackware 10
Posts: 21

Original Poster
Rep: Reputation: 15
PAM is a good thought, but I managed to come up with a way for 'nobody' to ssh to localhost through a pub/priv key scheme, then run the chpasswd command from there. It's made so that only the php process can have access to the private key.

Thanks for the help everyone.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Can you specift password on SSH command line? The_JinJ Linux - Newbie 4 07-26-2005 06:55 AM
Command-line 'adduser': password not hashing Talesin Fedora 0 10-08-2004 09:19 PM
written command line password generator lepricaun Programming 6 08-11-2004 01:36 AM
going to root without password thru command line amanjsingh Linux - Newbie 6 03-30-2004 12:38 AM
command line check to see if smbd and nmbd are running rioguia Linux - Networking 2 11-18-2002 02:46 AM


All times are GMT -5. The time now is 01:43 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration