2008-07-07

 

SSH and Virtual User Authentication

I was searching around for a solution on how to authenticate users via OpenSSH on a Linux system, if the users live in a DB. It appears that not a lot of information is available on the topic on some of the more obvious search terms, but after some digging the solution was actually straight forward.

Of course I'm running Debian stable, so the following solution should work for all Debian based systems. However - try at your own risk :-)

Step 1: Install all dependencies:

# apt-get install mysql-server libpam-mysql libnss-mysql-bg

Step 2 : Prep your database:

# mysql -uroot < /usr/share/doc/libnss-mysql-bg/examples/linux/sample_database.sql

Step 3
: Modify your /etc/nsswitch.conf file by replacing the following lines:

#passwd:         compat
#group: compat
#shadow: compat
passwd: files mysql
group: files mysql
shadow: files mysql

Step 4 : Restart SSH and TEST

Also refer to the libnss-mysql-bg documentation online.

Labels: , ,


Comments: Post a Comment

<< Home

This page is powered by Blogger. Isn't yours?