-   Linux - Newbie (
-   -   How do I copy user credentials from a MySQL table into SSH users (

Zoner 03-13-2011 05:52 PM

How do I copy user credentials from a MySQL table into SSH users
Hey guys,

I'm currently running a membership site which is Joomla-based. Basically I need a bash script to constantly check that MySQL users table and copy those credentials into my SSH users list (subsequently giving them SSH access).

I've looked at pam_mysql, but that merely is for authentication, it doesnt add them to the SSH users.

How would I go about this? Or is there a better way to implement it, anyone?


jlinkels 03-13-2011 06:46 PM

What you want is that SSH checks your MySQL instead of the local passwd file. What you say could be possible with some scripting, but is a workaround.

Making SSH check MySQL should be done by adding the PAM_MySql module (libpam_mysql) to your system. It means that PAM checks the username against the MySQL database, not against the passwd file.

I have not used it in this way, but I used it for a mail server much in the same way.


Zoner 03-13-2011 07:34 PM

You're right, pam_mysql works for authentication, but it doesn't work for authorization. Even if the pam_mysql module grants access, SSH wouldn't let it in because the user doesn't exist in the /etc/passwd file in the first place.

jlinkels 03-13-2011 08:25 PM

If SSH needs the name in /ect/passwd, what is pam_mysql good for?


All times are GMT -5. The time now is 10:11 PM.