LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How do I copy user credentials from a MySQL table into SSH users (https://www.linuxquestions.org/questions/linux-newbie-8/how-do-i-copy-user-credentials-from-a-mysql-table-into-ssh-users-868364/)

Zoner 03-13-2011 06: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?

Thanks

jlinkels 03-13-2011 07: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.

jlinkels

Zoner 03-13-2011 08: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 09:25 PM

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

jlinkels


All times are GMT -5. The time now is 02:55 AM.