Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Mail Systems
Eclipse Documentation

How To Guides
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Problem Solutions
Privacy Policy




29.18. Apache to use shared libraries

Since we have compiled apache to use shared libraries, we need to install them into the chroot directory structure. Use ldd /chroot/httpd/usr/sbin/httpd to find out which libraries are needed. The output, depending on what you've compiled with Apache will be something similar to: =>/lib/ (0x40016000) =>/lib/ (0x4001f000) =>/lib/ (0x4003b000) =>/lib/ (0x4003e000) =>/lib/ (0x4006b000) =>/lib/ (0x40081000) =>/lib/ (0x40090000) =>/lib/ (0x400cb000)
        /lib/ =>/lib/ (0x40000000)

Copy the shared libraries identified above:
        [root@deep ]/# cp /lib/ /chroot/httpd/lib/
        [root@deep ]/# cp /lib/ /chroot/httpd/lib/
        [root@deep ]/# cp /lib/ /chroot/httpd/lib/
        [root@deep ]/# cp /lib/ /chroot/httpd/lib/
        [root@deep ]/# cp /lib/libnsl* /chroot/httpd/lib/
        [root@deep ]/# cp /lib/libresolv* /chroot/httpd/lib/
        [root@deep ]/# cp /lib/ /chroot/httpd/lib/
        [root@deep ]/# cp /lib/ /chroot/httpd/lib/
        [root@deep ]/# cp /lib/ /chroot/httpd/lib/

You'll also need the following extra libraries for some network functions, like resolving:
        [root@deep ]/# cp /lib/libnss_compat* /chroot/httpd/lib/
        [root@deep ]/# cp /lib/libnss_dns* /chroot/httpd/lib/
        [root@deep ]/# cp /lib/libnss_files* /chroot/httpd/lib/

  1. We now need to copy the passwd and group files inside the /chroot/httpd/etc chrooted directory. The concept here is the same as how ftpd uses passwd and group files. Next, we'll remove all entries except for the user that apache runs as in both files passwd and group.

    1.               [root@deep ]/# cp /etc/passwd /chroot/httpd/etc/
                    [root@deep ]/# cp /etc/group /chroot/httpd/etc/

    2. Edit the passwd file, vi /chroot/httpd/etc/passwd and delete all entries except for the user apache run as in our configuration, it's www:

    3. Edit the group file, vi /chroot/httpd/etc/group and delete all entries except the group apache run as, in our configuration it,s www:

  Published under the terms of the Open Publication License Design by Interspire