LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-13-2011, 06:52 PM   #1
Zoner
LQ Newbie
 
Registered: Dec 2010
Posts: 6

Rep: Reputation: 0
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
 
Old 03-13-2011, 07:46 PM   #2
jlinkels
Senior Member
 
Registered: Oct 2003
Location: Bonaire
Distribution: Debian Wheezy/Jessie/Sid, Linux Mint DE
Posts: 4,493

Rep: Reputation: 635Reputation: 635Reputation: 635Reputation: 635Reputation: 635Reputation: 635
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
 
Old 03-13-2011, 08:34 PM   #3
Zoner
LQ Newbie
 
Registered: Dec 2010
Posts: 6

Original Poster
Rep: Reputation: 0
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.
 
Old 03-13-2011, 09:25 PM   #4
jlinkels
Senior Member
 
Registered: Oct 2003
Location: Bonaire
Distribution: Debian Wheezy/Jessie/Sid, Linux Mint DE
Posts: 4,493

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

jlinkels
 
  


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
mysql 'Table 'mysql.user' doesn't exist' Joe of Loath Linux - Server 13 08-05-2010 07:54 AM
Building a table to display from user input: PHP, MySQL deesto Programming 11 06-11-2008 06:25 PM
Locked myself out of mysql...root user db table destroyed organica Linux - Server 2 12-08-2006 11:35 AM
mysql user table corruption creolophus Linux - Software 1 04-23-2006 09:12 PM
mysql 'user' table read-only fuelinjection Linux - General 2 06-13-2004 10:05 AM


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