<?xml version="1.0" encoding="utf-8"?>
<bug><id>9244</id><link>http://bugs.mysql.com/bug.php?id=9244</link><status>Verified</status><category>Server: General</category><sdesc>Provide better support for chroot=...</sdesc><ldesc>I&#039;m currently chrooting mysqld via &#039;chroot=/srv/mysql&#039; in my.cnf.  This works fine, but only if I copy some libraries into the chroot:

    pushd $CHROOT_DIR &gt; /dev/null
    # for reading etc/passwd and etc/hosts
    cp /lib/libnss_compat.so.2 lib
    cp /lib/libnss_files.so.2 lib

    # needed only when compiled with --with-mysqld-ldflags=-all-static
    cp /lib/libc.so.6 lib
    cp /lib/ld* lib

(Full chrooting setup available on http://blog.blackdown.de/2005/03/04/chrooting-mysql-on-debian/ )

It would be nice if chrooting worked without copying any libraries into the chroot.  Both Apache (via mod_chroot or mod_security) and bind9 manage to change the user in the chroot without having any libraries and /etc/passwd in the chroot.

It shouldn&#039;t be hard to implement this for mysqld.cc too, just do all user lookup stuff (ie. getpwuid(3), getpwnam(3), ...) before calling chroot(2) (currently it&#039;s the other way round).
src/mysqld.cc is a huge file and I probably don&#039;t know enough about the code flow, so this change should be implemented by someone more competent.
</ldesc><reporter>260315</reporter><submitted>1111047435</submitted><modified>1196880943</modified><version>4.1.10a</version><os>Linux (Debian Linux)</os><cpu_arch>Any</cpu_arch><severity>S4 (Feature request)</severity></bug>