Linux - SecurityThis forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
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.
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.
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.