2

I have a web application running built in PHP using MySQL as database. I'm trying to give specific users access to a Linux system via SSH to perform simple command-line tasks. Since I do already have a database ready filled with usernames/passwords, I would like to use this data for users to sign in. I'm using the PHP function password_verify and in some cases one time passwords, so I am unable to use MySQL directly for authentication.

I would like to write a PHP script to log users in, something like this:

php login.php username password

that simply returns 1 or 0, or maybe home directories, permissions, etc.

I have read a lot about PAM & PHP, but this is about using PAM in PHP, and I want it the other way around. Using a LDAP server for this purpose seems a bit overkill to me. I am unable to find something that I need.

Can someone give me a nudge in the right direction?

Wouter
  • 21
  • 3
  • 3
    I'd skip php and go straight to mysql with something like http://pam-mysql.sourceforge.net/ – golemwashere Mar 21 '14 at 22:45
  • That would require me to rehash all passwords I guess? – Wouter Mar 22 '14 at 06:52
  • mmm that might be, supported formats look like : crypt,md5, mysql password() cfr http://pam-mysql.sourceforge.net/Documentation/package-readme.php?seemore=y – golemwashere Mar 23 '14 at 09:25
  • OK, this seems like the best way to do it :) – Wouter Mar 23 '14 at 13:46
  • It's unclear if this is a development exercise or a configuration exercise. Are you writing PHP code? if so this is off topic and the question belongs on stackoverflow.com. – hookenz Mar 23 '14 at 22:31

1 Answers1

1

Ok so my suggestion is use pam-mysql which accepts these formats of password encription

golemwashere
  • 734
  • 1
  • 10
  • 22