Skip to content

Instantly share code, notes, and snippets.

View markc's full-sized avatar

Mark Constable markc

View GitHub Profile
@alpacaaa
alpacaaa / README.markdown
Created July 29, 2012 09:01
Use mysql for authentication in ubuntu 12.04

Authenticating users against mysql

I couldn't find any relevant information for getting this to work on ubuntu precise, so I'm writing my founds here.
It's actually pretty simple, this approach doesn't involve PAM but just NSS. The implications are clearly explained in the FAQ of the nss-mysql module:

NSS stands for NameService Switch. NSS allows you to implement access to various data using any number of modules. This means that when the operating system wants to look up the user "cinergi", it doesn't have to know how - it calls upon the NSS system to perform the task. In turn, we can now configure NSS to look for users in traditional places like /etc/passwd, NIS, LDAP, and now (using this module), MySQL. The NSS

function serve_cgi(filename, res, get, post, method, vhost, port, pinfo, get, sname, uri, droot) {
var env = {
CONTENT_LENGTH: post.length,
CONTENT_TYPE: 'application/x-www-form-urlencoded',
DOCUMENT_ROOT: droot,
GATEWAY_INTERFACE: 'CGI/1.1',
HTTP_HOST: vhost,
QUERY_STRING: get,
REDIRECT_STATUS: '200',
REQUEST_METHOD: method,