Allow non root processes to authenticate users based on the shadow group
[manu/libnss-mysql-bg.git] / FAQ
1 $Id: FAQ,v 1.6 2004/03/04 03:24:49 cinergi Exp $
2
3 Q: What is NSS?
4 Q: What is PAM?
5 Q: Which one do I need?  One?  Both?
6 A: NSS stands for NameService Switch.  NSS allows you to implement access to
7    various data using any number of modules.  This means that when the
8    operating system wants to look up the user "cinergi", it doesn't have
9    to know how - it calls upon the NSS system to perform the task.  In turn,
10    we can now configure NSS to look for users in traditional places like
11    /etc/passwd, NIS, LDAP, and now (using this module), MySQL.  The NSS
12    API is the backend for traditional UNIX user lookup routines like
13    'getpwnam' - providing details such as username, uid, gid, gecos, shell,
14    homedirectory, password, etc.  It does *NOT* provide for changing user
15    details.  This is where PAM comes in handy.
16    PAM stands for Pluggable Authentication Modules.  Like the name suggests,
17    PAM allows you to implement authentication (and data manipulation) using
18    any number of modules.  Note that this differs from NSS in that it ONLY
19    provides authentication.  It does not allow you to do such things as
20    "finger username", or create files owned by "username".  Unlike NSS,
21    however, it can enable users to change their passwords using traditional
22    methods like the 'passwd' command.
23    The libnss_mysql library, like the name suggests, provides an NSS-based
24    solution.  Whether you also need PAM depends upon whether you need
25    to enable users to change their password using traditional methods (you
26    could always script a passwd-like utility that performs MySQL commands).
27    PAM also allows more fine-grained setup than NSS does; you can specify
28    which programs use which authentication methods - IE your FTP daemon
29    could authenticate off a different database than SSH does.  There are
30    a few other things it can do, too.  Try 'man pam' for more information.
31    Most needs should be met using the NSS library.  There are a few cases
32    where it may not be enough.  There is one MySQL PAM module available
33    at the moment.  I don't know if it can be made to work in conjunction 
34    this library (I don't really see why not).  I may be writing my own
35    module(s) in the future to address better integration as well as
36    the Solaris PAM problem (See the file README).
37
38 Q: Do I need to edit any PAM configuration files?
39 A: Not likely.  See the above question.
40
41 Q: Can I get the system to automatically create a user's homedirectory?
42 A: Yes.  There's a PAM module, pam_mkhomedir, that allows just this.
43    I know that on RedHat linux, you can simply add the following line to
44    your /etc/pam.d/system-auth file:
45      session optional /lib/security/pam_mkhomedir.so skel=/etc/skel umask=0022
46    Note that systems running ssh in privilege-separation mode (default
47    in RedHat 8) will *NOT* be able to create homedirectories when logging
48    in via ssh.  You'll have to shut off priv-sep mode in /etc/ssh/sshd_config
49    and restart ssh.  There's no other known workaround at this time.  Other
50    programs that drop root privs before calling PAM/session (I've seen 'su'
51    do this) will have similar troubles.
52
53 Q: Are other databases (IE hosts, netgroup, automount, aliases, etc)
54    supported?
55 A: Not at this time.  I plan to support these in the future, however.
56
57 Q: I have a lot of open MySQL processes - why?
58 A: libnss-mysql maintains a persistant connection - it's the only sane
59    way to implement this library without a separate daemon.  If you've got
60    too many open processes, I recommend reducing the default (28800 seconds -
61    8 hours) timeout in MySQL to something like 60 seconds.  You can do this by
62    editing/creating /etc/my.cnf and adding the following:
63      [mysqld]
64      set-variable=wait_timeout=60
65
66 Q: Why isn't it working?
67 A: See the file 'DEBUGGING' provided with the distribution.
68
69 Q: Why doesn't ProFTPD see my accounts in the database?
70 A: You must set 'PersistentPasswd' to 'Off' in your proftpd configuration.
71    You may also need to set your PAM config to use pam_unix.so.
72
73 Q: Why do I get the following message when I try to use 'passwd' on Solaris?
74    "Supported configurations for passwd management are as follows" ...
75 A: Sun chose to write their unix PAM module to only allow a very restrictive
76    configuration in /etc/nsswitch.conf.  You must now specify '-r files' on
77    the 'passwd' command-line to manipulate the password file.  For example:
78    passwd -r files username
79    I know this sucks, so figuring out a better workaround is on my TODO list.
80
81 Q: Why do I get the following message when compiling on Solaris?
82
83     Undefined                       first referenced
84      symbol                             in file
85     (some-symbol-here)                  /usr/local/lib/mysql/libmysqlclient.so
86 A: There are a number of reasons for this, but basically you either need to:
87    a) change the linker you're using
88    b) add a library to the link line
89    - To change the linker, simply set the environment variable 'LD' to the
90      full path to the linker you want to use before running 'configure.
91      Usually you'll need to download and install the GNU 'ld' from the GNU
92      binutils package.
93    - To use the same linker but add the missing library, locate your libgcc.a
94      file from your GCC installation, and set the environment variable
95      'LDFLAGS' to the following before running 'configure':
96      -L/directory/containing/libgcc.a -lgcc
97
98 Q: I'm getting segfaults on Solaris; truss indicates a crash shortly after
99    libz can't be found.
100
101 A: If you're using Solaris 8+, this shouldn't be a problem as libz is included
102    with the OS.  On earlier versions, you've probably installed it into
103    /usr/local/lib or somewhere in /opt.  You need to make sure this directory
104    is included in the linker search PRIOR to building libnss-mysql.  If libz
105    is installed in /usr/local/lib, you'd need to do the following:
106    sh -c "LDFLAGS=-R/usr/local/lib ./configure"
107