<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>The Linux Blog &#187; root</title>
	<atom:link href="http://linuxblog.ro/tag/root/feed/" rel="self" type="application/rss+xml" />
	<link>http://linuxblog.ro</link>
	<description>UNIX, LINUX, BSD, OSX</description>
	<lastBuildDate>Thu, 19 Aug 2010 14:32:39 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>How to install Xcache module for Apache</title>
		<link>http://linuxblog.ro/xcache-module-for-apache-howto/</link>
		<comments>http://linuxblog.ro/xcache-module-for-apache-howto/#comments</comments>
		<pubDate>Tue, 10 Mar 2009 12:49:34 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[phpize]]></category>
		<category><![CDATA[root]]></category>
		<category><![CDATA[xcache]]></category>

		<guid isPermaLink="false">http://linuxblog.ro/?p=350</guid>
		<description><![CDATA[XCache is a fast, stable PHP opcode cacher that has been tested and is now running on production servers under high load. It is tested (on linux) and supported on all of the latest PHP cvs branches such as PHP_4_3 PHP_4_4 PHP_5_0 PHP_5_1 PHP_5_2 HEAD(6.x).]]></description>
			<content:encoded><![CDATA[<p>XCache is a fast, stable PHP opcode cacher that has been tested and is now running on production servers under high load. It is tested (on linux) and supported on all of the latest PHP cvs branches such as PHP_4_3 PHP_4_4 PHP_5_0 PHP_5_1 PHP_5_2 HEAD(6.x). ThreadSafe/Windows is also supported. It overcomes a lot of problems that has been with other competing opcachers such as being able to be used with new PHP versions. See Introduction for more information.</p>
<p>You don&#8217;t have to check the following list yourself, the configure script will do for you, unless you have problem with configure/make.</p>
<p>Check version with cli</p>
<p>$ php-cgi -v<br />
PHP 4.4.3-dev (cgi-fcgi) (built: Mar 10 2006 18:46:02)<br />
Copyright (c) 1997-2006 The PHP Group<br />
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies</p>
<p>or setup a file with:</p>
<p>Check version with phpinfo</p>
<p>&lt;?php<br />
phpinfo();<br />
?&gt;</p>
<p>and request it from your browser.</p>
<p>* Get the php works with webserver without XCache first!<br />
* common build tools: c compiler, make, libtool (required by php build env)<br />
* php building env installed. if you&#8217;ve install php yourself, make sure you have do &#8220;make install&#8221;. for some os distro, there is &#8220;php-devel&#8221; package. check it out with:</p>
<p>Check phpize</p>
<p>$ which phpize<br />
/usr/local/bin/phpize<br />
(or)<br />
/usr/bin/phpize</p>
<p>you output may be vary from this, depending on your installtion of php. if it&#8217;s not found, you should find it yourself</p>
<p>* m4<br />
* indent (optional)</p>
<p>Building:</p>
<p>~ $ cd ~/src/xcache<br />
~/src/xcache $ ls<br />
(you XCache source is here)</p>
<p>~/src/xcache $ phpize<br />
(generating configure &#8230;. everytime you upgrade php, or update to a new XCache, you have to run phpize again)</p>
<p>(it is suggested to build outside of the source directory, so make an build directory first and enter it)<br />
~/src/xcache $ mkdir ../xcache-build<br />
~/src/xcache $ cd ../xcache-build<br />
~/src/xcache-build $ ../xcache/configure &#8211;help<br />
&#8230;&#8230;<br />
&#8211;enable-xcache         Include XCACHE support.<br />
&#8211;enable-xcache-optimizer       XCACHE: (N/A)<br />
&#8211;enable-xcache-coverager       XCACHE: Enable code coverage dumper<br />
&#8211;enable-xcache-assembler       XCACHE: (N/A)<br />
&#8211;enable-xcache-disassembler    XCACHE: Enable opcode to php variable dumper<br />
&#8211;enable-xcache-encoder         XCACHE: (N/A)<br />
&#8211;enable-xcache-decoder         XCACHE: (N/A)<br />
&#8211;enable-xcache-test            XCACHE: Enable self test &#8211; FOR DEVELOPERS ONLY!!<br />
&#8230;&#8230;</p>
<p>(run configure with options you selected now)<br />
~/src/xcache-build $ ../xcache/configure &#8211;enable-xcache &#8211;enable-xcache-coverager<br />
(many output here, if you have problem, read the error message twice)<br />
(and search inside config.log, and check Pre-requirement in this page above)</p>
<p>~/src/xcache-build $ make<br />
(many output here again, check if it success or error out.)</p>
<p>NOTE: It&#8217;s always better not to enable unnecessary modules for production server unless you&#8217;re not the maintainer of the server. Play with it locally.</p>
<p>WARNING: If you&#8217;re using something like /opt/php/bin/phpize which isn&#8217;t the 1st one found in $PATH, remember to configure &#8211;with-php-config=/opt/php/bin/php-config, exactly the same directory as phpiz.</p>
<p>Special path</p>
<p>~/src/xcache-build $ PATH=&#8221;/opt/php/bin/:$PATH&#8221; ../xcache/configure \<br />
&#8211;with-php-config=/opt/php/bin/php-config \<br />
&#8211;enable-xcache \<br />
&#8211;enable-xcache-coverager<br />
(line is broken up for readability)<br />
~/src/xcache-build $ make</p>
<p>Installing</p>
<p>~/src/xcache-build $ su<br />
Password:<br />
(input your root password here. whenever u see a red # in code listing in this wiki, it means you need to be root to do that)</p>
<p>~/src/xcache-build # make install<br />
(many output here, and you can see where the XCache extension is installed into, remember the extension path)</p>
<p>You have to modify php.ini to make XCache enable in your php!</p>
]]></content:encoded>
			<wfw:commentRss>http://linuxblog.ro/xcache-module-for-apache-howto/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Red Hat / CentOS: Chroot Apache 2 Web Server</title>
		<link>http://linuxblog.ro/red-hat-centos-chroot-apache-2-web-server/</link>
		<comments>http://linuxblog.ro/red-hat-centos-chroot-apache-2-web-server/#comments</comments>
		<pubDate>Sat, 07 Mar 2009 13:56:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[chroot]]></category>
		<category><![CDATA[chroot jail]]></category>
		<category><![CDATA[disk]]></category>
		<category><![CDATA[root]]></category>

		<guid isPermaLink="false">http://linuxblog.ro/?p=303</guid>
		<description><![CDATA[A chroot on Red Hat / CentOS / Fedora Linux operating changes the apparent disk root directory for the Apache process and its children.]]></description>
			<content:encoded><![CDATA[<p style="margin: 0px 0px 1.571em; padding: 0px;">A chroot on Red Hat / CentOS / Fedora Linux operating changes the apparent disk root directory for the Apache process and its children. Once this is done attacker or other php / perl / python scripts cannot access or name files outside that directory. This is called a &#8220;chroot jail&#8221; for Apache. You should never ever run a web server without jail. There should be privilege separation between web server and rest of the system.</p>
<p style="margin: 0px 0px 1.571em; padding: 0px;">In this exclusive series, you will learn more about:</p>
<ul style="margin: 0px 0px 1.571em 1.571em; padding: 0px; list-style-type: square;">
<li style="margin: 0px; padding: 0px;">Securing an Apache 2 web server under Red Hat Enterprise Linux / CentOS Linux using mod_chroot</li>
<li style="margin: 0px; padding: 0px;">Virtual hosting configuration under chrooted jail.</li>
<li style="margin: 0px; padding: 0px;">Troubleshooting Chrooted Apache jail problem.</li>
</ul>
<p style="margin: 0px 0px 1.571em; padding: 0px;">
<h2 style="margin: 0px; padding: 0px; font-size: 1.8em; font-weight: normal; line-height: 1.267em;">Requirements</h2>
<ol style="margin: 0px 0px 1.571em 1.571em; padding: 0px;">
<li style="margin: 0px; padding: 0px;">Server:<span class="Apple-converted-space"> </span><strong style="margin: 0px; padding: 0px;">Apache 2 Web</strong><span class="Apple-converted-space"> </span>server.</li>
<li style="margin: 0px; padding: 0px;">Jail directory:<span class="Apple-converted-space"> </span><strong style="margin: 0px; padding: 0px;">/httpdjail</strong>.</li>
<li style="margin: 0px; padding: 0px;">User / Group:<span class="Apple-converted-space"> </span><strong style="margin: 0px; padding: 0px;">apache</strong><span class="Apple-converted-space"> </span>/<span class="Apple-converted-space"> </span><strong style="margin: 0px; padding: 0px;">apache</strong><span class="Apple-converted-space"> </span>(never ever run chroot using root user).</li>
<li style="margin: 0px; padding: 0px;">Virtual domain directory for all domain inside jail:<span class="Apple-converted-space"> </span><strong style="margin: 0px; padding: 0px;">/home/httpd</strong>.</li>
<li style="margin: 0px; padding: 0px;">PHP is configured via default mod_php.</li>
<li style="margin: 0px; padding: 0px;">Instructions are tested under CentOS / RHEL 5.x.</li>
</ol>
<h3 style="margin: 1.833em 0px 0.611em; padding: 0px; font-size: 1.286em; font-weight: normal; line-height: 1.222em;">More about Jail directory: /httpdjail</h3>
<p style="margin: 0px 0px 1.571em; padding: 0px;">Create a jail directory as follows:<br style="margin: 0px; padding: 0px;" /><code style="border: 1px solid #dddddd; margin: 0px 0px 1.692em; padding: 0.615em 0.846em; background: #eeeeee none repeat scroll 0px 0px; overflow: auto; font-family: Consolas,'Andale Mono',Courier,'Courier New'; line-height: 1.385em; font-size: 0.929em; display: block;"># J=/httpdjail<br style="margin: 0px; padding: 0px;" /># mkdir $J</code></p>
<ol style="margin: 0px 0px 1.571em 1.571em; padding: 0px;">
<li style="margin: 0px; padding: 0px;">Do<span class="Apple-converted-space"> </span><strong style="margin: 0px; padding: 0px;">not create /dev</strong><span class="Apple-converted-space"> </span>directory inside your jail.</li>
<li style="margin: 0px; padding: 0px;">Do not create<strong style="margin: 0px; padding: 0px;"><span class="Apple-converted-space"> </span>special device files</strong><span class="Apple-converted-space"> </span>inside jail.</li>
<li style="margin: 0px; padding: 0px;">Do not<strong style="margin: 0px; padding: 0px;"><span class="Apple-converted-space"> </span>copy shell or any other single executable</strong><span class="Apple-converted-space"> </span>files inside your jail.</li>
<li style="margin: 0px; padding: 0px;">Do not run<span class="Apple-converted-space"> </span><strong style="margin: 0px; padding: 0px;">httpd or php / perl / python as root</strong><span class="Apple-converted-space"> </span>user.</li>
<li style="margin: 0px; padding: 0px;">If possible mount $J using a separate<span class="Apple-converted-space"> </span><a style="margin: 0px; padding: 0px; color: #006699; text-decoration: underline;" href="http://www.cyberciti.biz/tips/the-importance-of-linux-partitions.html" target="_blank">partition with nosuid, nodev and noexec options</a>. This will improve security as user will not able to run suid enabled programs and device files inside a jail.</li>
</ol>
<h3 style="margin: 1.833em 0px 0.611em; padding: 0px; font-size: 1.286em; font-weight: normal; line-height: 1.222em;">Install Apache, PHP and MySQL</h3>
<p style="margin: 0px 0px 1.571em; padding: 0px;">Install required packages using<span class="Apple-converted-space"> </span><a style="margin: 0px; padding: 0px; color: #006699; text-decoration: underline;" href="http://www.cyberciti.biz/faq/rhel-centos-fedora-linux-yum-command-howto/">yum command</a>, enter:<br style="margin: 0px; padding: 0px;" /><code style="border: 1px solid #dddddd; margin: 0px 0px 1.692em; padding: 0.615em 0.846em; background: #eeeeee none repeat scroll 0px 0px; overflow: auto; font-family: Consolas,'Andale Mono',Courier,'Courier New'; line-height: 1.385em; font-size: 0.929em; display: block;"># yum install mysql mysql-server httpd php-mysql php-pear php-xml php-mysql php-cli php-imap php-gd php-pdo php-devel php-mbstring php-common php-ldap php httpd-devel</code><br style="margin: 0px; padding: 0px;" />Now, create required directories inside your jail:<br style="margin: 0px; padding: 0px;" /><code style="border: 1px solid #dddddd; margin: 0px 0px 1.692em; padding: 0.615em 0.846em; background: #eeeeee none repeat scroll 0px 0px; overflow: auto; font-family: Consolas,'Andale Mono',Courier,'Courier New'; line-height: 1.385em; font-size: 0.929em; display: block;"># mkdir -p $J/var/run<br style="margin: 0px; padding: 0px;" /># chown -R root.root $J/var/run<br style="margin: 0px; padding: 0px;" /># mkdir -p $J/home/httpd<br style="margin: 0px; padding: 0px;" /># mkdir -p $J/var/www/html<br style="margin: 0px; padding: 0px;" /># mkdir -p $J/tmp<br style="margin: 0px; padding: 0px;" /># chmod 1777 $J/tmp<br style="margin: 0px; padding: 0px;" /># mkdir -p $J/var/lib/php/session<br style="margin: 0px; padding: 0px;" /># chown root.apache $J/var/lib/php/session<br style="margin: 0px; padding: 0px;" /></code></p>
<ol style="margin: 0px 0px 1.571em 1.571em; padding: 0px;">
<li style="margin: 0px; padding: 0px;"><strong style="margin: 0px; padding: 0px;">$J/var/run</strong><span class="Apple-converted-space"> </span>will store PID and other files.</li>
<li style="margin: 0px; padding: 0px;"><strong style="margin: 0px; padding: 0px;">$J/var/lib/php/session</strong><span class="Apple-converted-space"> </span>PHP session file path (configured in php.ini).</li>
<li style="margin: 0px; padding: 0px;"><strong style="margin: 0px; padding: 0px;">$J/tmp</strong><span class="Apple-converted-space"> </span>- Used by many scripts and cms software to upload files.</li>
</ol>
<h2 style="margin: 0px; padding: 0px; font-size: 1.8em; font-weight: normal; line-height: 1.267em;">Install mod_chroot</h2>
<p style="margin: 0px 0px 1.571em; padding: 0px;">mod_chroot makes running Apache in a secure chroot environment easy. You don&#8217;t need to create a special directory hierarchy containing /dev, /lib, /etc. mod_chroot allows you to run Apache in a chroot jail with no additional files. The chroot() system call is performed at the end of startup procedure &#8211; when all libraries are loaded and log files open. Download mod_chroot using wget command:<br style="margin: 0px; padding: 0px;" /><code style="border: 1px solid #dddddd; margin: 0px 0px 1.692em; padding: 0.615em 0.846em; background: #eeeeee none repeat scroll 0px 0px; overflow: auto; font-family: Consolas,'Andale Mono',Courier,'Courier New'; line-height: 1.385em; font-size: 0.929em; display: block;"># cd /opt/<br style="margin: 0px; padding: 0px;" /># wget http://core.segfault.pl/~hobbit/mod_chroot/dist/mod_chroot-0.5.tar.gz</code><br style="margin: 0px; padding: 0px;" />Untar it:<br style="margin: 0px; padding: 0px;" /><code style="border: 1px solid #dddddd; margin: 0px 0px 1.692em; padding: 0.615em 0.846em; background: #eeeeee none repeat scroll 0px 0px; overflow: auto; font-family: Consolas,'Andale Mono',Courier,'Courier New'; line-height: 1.385em; font-size: 0.929em; display: block;"># tar -zxvf mod_chroot-0.5.tar.gz</code><br style="margin: 0px; padding: 0px;" />Compile and install mod_chroot for using apxs, enter:<br style="margin: 0px; padding: 0px;" /><code style="border: 1px solid #dddddd; margin: 0px 0px 1.692em; padding: 0.615em 0.846em; background: #eeeeee none repeat scroll 0px 0px; overflow: auto; font-family: Consolas,'Andale Mono',Courier,'Courier New'; line-height: 1.385em; font-size: 0.929em; display: block;"># cd mod_chroot-0.5<br style="margin: 0px; padding: 0px;" /># apxs -cia mod_chroot.c</code></p>
<h3 style="margin: 1.833em 0px 0.611em; padding: 0px; font-size: 1.286em; font-weight: normal; line-height: 1.222em;">Configure Apache mod_chroot</h3>
<p style="margin: 0px 0px 1.571em; padding: 0px;">Open /etc/httpd/conf/httpd.conf file, type:<br style="margin: 0px; padding: 0px;" /><code style="border: 1px solid #dddddd; margin: 0px 0px 1.692em; padding: 0.615em 0.846em; background: #eeeeee none repeat scroll 0px 0px; overflow: auto; font-family: Consolas,'Andale Mono',Courier,'Courier New'; line-height: 1.385em; font-size: 0.929em; display: block;"># C=/etc/httpd/conf/httpd.conf<br style="margin: 0px; padding: 0px;" /># vi $C</code><br style="margin: 0px; padding: 0px;" />Set PidFile path in which the server should record its process identification number when it starts. Find line that reads as follows:</p>
<pre class="ini" style="border: 1px solid #dddddd; margin: 0px 0px 1.692em; padding: 0.615em 0.846em; overflow: auto; font-family: Consolas,'Andale Mono',Courier,'Courier New'; background-color: #eeeeee; clear: both; font-size: 0.929em; line-height: 1.385em;">PidFile run/httpd.pid</pre>
<p style="margin: 0px 0px 1.571em; padding: 0px;">Replace with:</p>
<pre class="ini" style="border: 1px solid #dddddd; margin: 0px 0px 1.692em; padding: 0.615em 0.846em; overflow: auto; font-family: Consolas,'Andale Mono',Courier,'Courier New'; background-color: #eeeeee; clear: both; font-size: 0.929em; line-height: 1.385em;">PidFile /var/run/httpd.pid</pre>
<p style="margin: 0px 0px 1.571em; padding: 0px;">Next add ChrootDir directive, enter:</p>
<pre class="ini" style="border: 1px solid #dddddd; margin: 0px 0px 1.692em; padding: 0.615em 0.846em; overflow: auto; font-family: Consolas,'Andale Mono',Courier,'Courier New'; background-color: #eeeeee; clear: both; font-size: 0.929em; line-height: 1.385em;">ChrootDir /httpdjail</pre>
<p style="margin: 0px 0px 1.571em; padding: 0px;">Find line that read as follows:</p>
<pre class="ini" style="border: 1px solid #dddddd; margin: 0px 0px 1.692em; padding: 0.615em 0.846em; overflow: auto; font-family: Consolas,'Andale Mono',Courier,'Courier New'; background-color: #eeeeee; clear: both; font-size: 0.929em; line-height: 1.385em;">ServerRoot <span style="margin: 0px; padding: 0px; color: #993333;">"/etc/httpd"</span></pre>
<p style="margin: 0px 0px 1.571em; padding: 0px;">Append following lines:</p>
<pre class="ini" style="border: 1px solid #dddddd; margin: 0px 0px 1.692em; padding: 0.615em 0.846em; overflow: auto; font-family: Consolas,'Andale Mono',Courier,'Courier New'; background-color: #eeeeee; clear: both; font-size: 0.929em; line-height: 1.385em;">LockFile /var/run/httpd.lock
CoreDumpDirectory /var/run
ScoreBoardFile /var/run/httpd.scoreboard</pre>
<p style="margin: 0px 0px 1.571em; padding: 0px;">Make sure mod_chroot.so line exists. For example, 64 bit Linux should have line as follows:</p>
<pre class="ini" style="border: 1px solid #dddddd; margin: 0px 0px 1.692em; padding: 0.615em 0.846em; overflow: auto; font-family: Consolas,'Andale Mono',Courier,'Courier New'; background-color: #eeeeee; clear: both; font-size: 0.929em; line-height: 1.385em;">LoadModule chroot_module      /usr/lib64/httpd/modules/mod_chroot.so</pre>
<p style="margin: 0px 0px 1.571em; padding: 0px;">32 bit Linux config line:</p>
<pre class="ini" style="border: 1px solid #dddddd; margin: 0px 0px 1.692em; padding: 0.615em 0.846em; overflow: auto; font-family: Consolas,'Andale Mono',Courier,'Courier New'; background-color: #eeeeee; clear: both; font-size: 0.929em; line-height: 1.385em;">LoadModule chroot_module      /usr/lib/httpd/modules/mod_chroot.so</pre>
<p style="margin: 0px 0px 1.571em; padding: 0px;">Save and close the file.</p>
<h3 style="margin: 1.833em 0px 0.611em; padding: 0px; font-size: 1.286em; font-weight: normal; line-height: 1.222em;">Disable SELinux for Apache</h3>
<p style="margin: 0px 0px 1.571em; padding: 0px;">You need to disable SELinux for apache, enter:<br style="margin: 0px; padding: 0px;" /><code style="border: 1px solid #dddddd; margin: 0px 0px 1.692em; padding: 0.615em 0.846em; background: #eeeeee none repeat scroll 0px 0px; overflow: auto; font-family: Consolas,'Andale Mono',Courier,'Courier New'; line-height: 1.385em; font-size: 0.929em; display: block;"># setsebool httpd_disable_trans 1</code><br style="margin: 0px; padding: 0px;" />See article &#8220;<a style="margin: 0px; padding: 0px; color: #006699; text-decoration: underline;" href="http://www.cyberciti.biz/faq/howto-disable-httpd-selinux-security-protection/" target="_blank">disabling SELinux for only Apache / httpd in Linux</a>&#8221; for further details.</p>
<h4 style="margin: 0px; padding: 0px; font-size: 1em; font-weight: bold;">Patch up /etc/init.d/httpd</h4>
<p style="margin: 0px 0px 1.571em; padding: 0px;">Open /etc/init.d/httpd file, enter:<br style="margin: 0px; padding: 0px;" /><code style="border: 1px solid #dddddd; margin: 0px 0px 1.692em; padding: 0.615em 0.846em; background: #eeeeee none repeat scroll 0px 0px; overflow: auto; font-family: Consolas,'Andale Mono',Courier,'Courier New'; line-height: 1.385em; font-size: 0.929em; display: block;"># vi /etc/init.d/httpd</code><br style="margin: 0px; padding: 0px;" />Find out line that read as follows:</p>
<pre class="bash" style="border: 1px solid #dddddd; margin: 0px 0px 1.692em; padding: 0.615em 0.846em; overflow: auto; font-family: Consolas,'Andale Mono',Courier,'Courier New'; background-color: #eeeeee; clear: both; font-size: 0.929em; line-height: 1.385em;"><span style="margin: 0px; padding: 0px; font-style: italic; color: #808080;"># Start httpd <span style="margin: 0px; padding: 0px; font-weight: bold; color: #000000;">in</span> the C locale by default.</span>
<span style="margin: 0px; padding: 0px; color: #007800;">HTTPD_LANG=</span>$<span style="margin: 0px; padding: 0px; font-weight: bold; color: #7a0874;">{</span>HTTPD_LANG-<span style="margin: 0px; padding: 0px; color: #ff0000;">"C"</span><span style="margin: 0px; padding: 0px; font-weight: bold; color: #7a0874;">}</span></pre>
<p style="margin: 0px 0px 1.571em; padding: 0px;">Add following line (set ROOT to $J):</p>
<pre class="bash" style="border: 1px solid #dddddd; margin: 0px 0px 1.692em; padding: 0.615em 0.846em; overflow: auto; font-family: Consolas,'Andale Mono',Courier,'Courier New'; background-color: #eeeeee; clear: both; font-size: 0.929em; line-height: 1.385em;"><span style="margin: 0px; padding: 0px; color: #007800;">ROOT=</span>/httpdjail</pre>
<p style="margin: 0px 0px 1.571em; padding: 0px;">Find stop() that read as follows:</p>
<pre class="bash" style="border: 1px solid #dddddd; margin: 0px 0px 1.692em; padding: 0.615em 0.846em; overflow: auto; font-family: Consolas,'Andale Mono',Courier,'Courier New'; background-color: #eeeeee; clear: both; font-size: 0.929em; line-height: 1.385em;">stop<span style="margin: 0px; padding: 0px; font-weight: bold; color: #7a0874;">(</span><span style="margin: 0px; padding: 0px; font-weight: bold; color: #7a0874;">)</span> <span style="margin: 0px; padding: 0px; font-weight: bold; color: #7a0874;">{</span>
        <span style="margin: 0px; padding: 0px; font-weight: bold; color: #7a0874;">echo</span> -n $<span style="margin: 0px; padding: 0px; color: #ff0000;">"Stopping $prog: "</span>
        killproc -d <span style="margin: 0px; padding: 0px; color: #000000;">10</span> <span style="margin: 0px; padding: 0px; color: #007800;">$httpd</span>
        <span style="margin: 0px; padding: 0px; color: #007800;">RETVAL=</span>$?
        <span style="margin: 0px; padding: 0px; font-weight: bold; color: #7a0874;">echo</span>
        <span style="margin: 0px; padding: 0px; font-weight: bold; color: #7a0874;">[</span> <span style="margin: 0px; padding: 0px; color: #007800;">$RETVAL</span> = <span style="margin: 0px; padding: 0px; color: #000000;">0</span> <span style="margin: 0px; padding: 0px; font-weight: bold; color: #7a0874;">]</span> &amp;&amp; <span style="margin: 0px; padding: 0px; font-weight: bold; color: #c20cb9;">rm</span> -f <span style="margin: 0px; padding: 0px; color: #007800;">$<span style="margin: 0px; padding: 0px; font-weight: bold; color: #7a0874;">{</span><span style="margin: 0px; padding: 0px; font-weight: bold; color: #c20cb9;">lockfile</span><span style="margin: 0px; padding: 0px; font-weight: bold; color: #7a0874;">}</span></span> <span style="margin: 0px; padding: 0px; color: #007800;">$<span style="margin: 0px; padding: 0px; font-weight: bold; color: #7a0874;">{</span>pidfile<span style="margin: 0px; padding: 0px; font-weight: bold; color: #7a0874;">}</span></span>
<span style="margin: 0px; padding: 0px; font-weight: bold; color: #7a0874;">}</span></pre>
<p style="margin: 0px 0px 1.571em; padding: 0px;">Replace it as follows (you need to link /var/run/httpd.pid to $J/var/run/httpd.pid; so that stop operation works):</p>
<pre class="bash" style="border: 1px solid #dddddd; margin: 0px 0px 1.692em; padding: 0.615em 0.846em; overflow: auto; font-family: Consolas,'Andale Mono',Courier,'Courier New'; background-color: #eeeeee; clear: both; font-size: 0.929em; line-height: 1.385em;">stop<span style="margin: 0px; padding: 0px; font-weight: bold; color: #7a0874;">(</span><span style="margin: 0px; padding: 0px; font-weight: bold; color: #7a0874;">)</span> <span style="margin: 0px; padding: 0px; font-weight: bold; color: #7a0874;">{</span>
        /bin/<span style="margin: 0px; padding: 0px; font-weight: bold; color: #c20cb9;">ln</span> -s <span style="margin: 0px; padding: 0px; color: #007800;">$ROOT</span>/var/run/httpd.pid /var/run/httpd.pid
        <span style="margin: 0px; padding: 0px; font-weight: bold; color: #7a0874;">echo</span> -n $<span style="margin: 0px; padding: 0px; color: #ff0000;">"Stopping $prog: "</span>
        killproc -d <span style="margin: 0px; padding: 0px; color: #000000;">10</span> <span style="margin: 0px; padding: 0px; color: #007800;">$httpd</span>
        <span style="margin: 0px; padding: 0px; color: #007800;">RETVAL=</span>$?
        <span style="margin: 0px; padding: 0px; font-weight: bold; color: #7a0874;">echo</span>
        <span style="margin: 0px; padding: 0px; font-weight: bold; color: #7a0874;">[</span> <span style="margin: 0px; padding: 0px; color: #007800;">$RETVAL</span> = <span style="margin: 0px; padding: 0px; color: #000000;">0</span> <span style="margin: 0px; padding: 0px; font-weight: bold; color: #7a0874;">]</span> &amp;&amp; <span style="margin: 0px; padding: 0px; font-weight: bold; color: #c20cb9;">rm</span> -f <span style="margin: 0px; padding: 0px; color: #007800;">$<span style="margin: 0px; padding: 0px; font-weight: bold; color: #7a0874;">{</span><span style="margin: 0px; padding: 0px; font-weight: bold; color: #c20cb9;">lockfile</span><span style="margin: 0px; padding: 0px; font-weight: bold; color: #7a0874;">}</span></span> <span style="margin: 0px; padding: 0px; color: #007800;">$<span style="margin: 0px; padding: 0px; font-weight: bold; color: #7a0874;">{</span>pidfile<span style="margin: 0px; padding: 0px; font-weight: bold; color: #7a0874;">}</span></span>
<span style="margin: 0px; padding: 0px; font-weight: bold; color: #7a0874;">}</span></pre>
<p style="margin: 0px 0px 1.571em; padding: 0px;">Save and close the file. Set<span class="Apple-converted-space"> </span><a style="margin: 0px; padding: 0px; color: #006699; text-decoration: underline;" href="http://www.cyberciti.biz/tips/linux-password-trick.html" target="_blank">immutable permission on /etc/init.d/httpd</a><span class="Apple-converted-space"> </span>so that file cannot be modified, updated by yum, deleted or renamed, no link can be created to this file and no data can be written to the file. Only the superuser or a process possessing the CAP_LINUX_IMMUTABLE capability can set or clear this attribute:<br style="margin: 0px; padding: 0px;" /><code style="border: 1px solid #dddddd; margin: 0px 0px 1.692em; padding: 0.615em 0.846em; background: #eeeeee none repeat scroll 0px 0px; overflow: auto; font-family: Consolas,'Andale Mono',Courier,'Courier New'; line-height: 1.385em; font-size: 0.929em; display: block;"># chattr +i /etc/init.d/httpd</code></p>
<h3 style="margin: 1.833em 0px 0.611em; padding: 0px; font-size: 1.286em; font-weight: normal; line-height: 1.222em;">How do I start chrooted httpd?</p>
<p style="margin: 0px 0px 1.571em; padding: 0px;">Type the following command:<br style="margin: 0px; padding: 0px;" /><code style="border: 1px solid #dddddd; margin: 0px 0px 1.692em; padding: 0.615em 0.846em; background: #eeeeee none repeat scroll 0px 0px; overflow: auto; font-family: Consolas,'Andale Mono',Courier,'Courier New'; line-height: 1.385em; font-size: 0.929em; display: block;"># /etc/init.d/httpd start</code><br style="margin: 0px; padding: 0px;" />You should not see any error in /var/log/httpd/error_log file:</p>
<pre style="border: 1px solid #dddddd; margin: 0px 0px 1.692em; padding: 0.615em 0.846em; overflow: auto; font-family: Consolas,'Andale Mono',Courier,'Courier New'; background-color: #eeeeee; clear: both; font-size: 0.929em; line-height: 1.385em;">[Sun Dec 21 18:43:09 2008] [notice] core dump file size limit raised to 18446744073709551615 bytes
[Sun Dec 21 18:43:09 2008] [notice] SELinux policy enabled; httpd running as context root:system_r:initrc_t
[Sun Dec 21 18:43:09 2008] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Sun Dec 21 18:43:09 2008] [notice] Digest: generating secret for digest authentication ...
[Sun Dec 21 18:43:09 2008] [notice] Digest: done
[Sun Dec 21 18:43:10 2008] [notice] mod_chroot: changed root to /httpdjail.
[Sun Dec 21 18:43:10 2008] [notice] Apache/2.2.3 (CentOS) configured -- resuming normal operations</pre>
</h3>
<h3 style="margin: 1.833em 0px 0.611em; padding: 0px; font-size: 1.286em; font-weight: normal; line-height: 1.222em;">How do I stop chrooted httpd?</p>
<p style="margin: 0px 0px 1.571em; padding: 0px;"><code style="border: 1px solid #dddddd; margin: 0px 0px 1.692em; padding: 0.615em 0.846em; background: #eeeeee none repeat scroll 0px 0px; overflow: auto; font-family: Consolas,'Andale Mono',Courier,'Courier New'; line-height: 1.385em; font-size: 0.929em; display: block;"># /etc/init.d/httpd stop</code></p>
</h3>
<h3 style="margin: 1.833em 0px 0.611em; padding: 0px; font-size: 1.286em; font-weight: normal; line-height: 1.222em;">How do I restart chrooted httpd?</p>
<p style="margin: 0px 0px 1.571em; padding: 0px;"><code style="border: 1px solid #dddddd; margin: 0px 0px 1.692em; padding: 0.615em 0.846em; background: #eeeeee none repeat scroll 0px 0px; overflow: auto; font-family: Consolas,'Andale Mono',Courier,'Courier New'; line-height: 1.385em; font-size: 0.929em; display: block;"># /etc/init.d/httpd restart</code></p>
<p style="margin: 0px 0px 1.571em; padding: 0px;">Author: <span class="Apple-style-span" style="border-collapse: separate; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-family: 'Times New Roman'; color: #000000;"><span class="Apple-style-span" style="font-size: 10px; font-style: italic; line-height: 18px; font-family: Arial; color: #888888;"><span class="Apple-converted-space"> </span><span class="author vcard fn" style="margin: 0px; padding: 0px; font-style: normal; text-transform: uppercase; letter-spacing: 1px;">VIVEK GITE via <a title="Alpache chroot jail" href="http://www.cyberciti.biz" target="_blank">Cyberciti</a><br />
</span></span></span></h3>
]]></content:encoded>
			<wfw:commentRss>http://linuxblog.ro/red-hat-centos-chroot-apache-2-web-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
