<?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/"
	xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule"
>
<channel>
	<title>G-Loaded Journal &#187; Servers</title>
	<atom:link href="http://www.g-loaded.eu/tag/servers/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.g-loaded.eu</link>
	<description>An open-source software and technology related journal</description>
	<lastBuildDate>Mon, 05 Dec 2011 19:55:24 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
		<item>
		<title>Running supervisor 3 on CentOS 5</title>
		<link>http://www.g-loaded.eu/2011/05/12/running-supervisor-3-on-centos-5/</link>
		<comments>http://www.g-loaded.eu/2011/05/12/running-supervisor-3-on-centos-5/#comments</comments>
		<pubDate>Thu, 12 May 2011 04:56:52 +0000</pubDate>
		<dc:creator>George Notaras</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Administration]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[RHEL]]></category>
		<category><![CDATA[RPM]]></category>
		<category><![CDATA[Servers]]></category>
		<guid isPermaLink="false">http://www.g-loaded.eu/?p=2263</guid>
		<description><![CDATA[It&#8217;s been a long time since the last time I checked the available software for managing long running processes. Software in this particular area has evolved and, after some research and testing on a virtual machine, I tried to install supervisord in a CentOS 5.6 box. Unfortunately, no RPM package exists for the latest 3.X [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s been a long time since the last time I checked the available software for managing long running processes. Software in this particular area has evolved and, after some research and testing on a virtual machine, I tried to install <a href="http://supervisord.org/">supervisord</a> in a CentOS 5.6 box. Unfortunately, no RPM package exists for the latest 3.X version, so I decided to go through the procedure to rebuild the <em>supervisor RPM</em> from the Fedora development tree, since v3.X has some really cool features I cannot do without.<br />
<span id="more-2263"></span><br />
If you haven&#8217;t built an RPM package before, you will need to go through a simple procedure in order to <a href="http://www.g-loaded.eu/2006/04/05/how-to-build-rpm-packages-on-fedora/">prepare an RPM building environment</a>. It is highly recommended that you build your packages in a separate box, dedicated to this kind of work, and also use a typical user and not <em>root</em> for building. So, let&#8217;s get the source RPM of <strong>supervisord</strong> from a Fedora Rawhide mirror:</p>
<pre class="console">
wget ftp://ftp.cc.uoc.gr/mirrors/linux/fedora/linux/development/rawhide/source/SRPMS/supervisor-3.0-0.4.a10.fc16.src.rpm
</pre>
<p>The simplest way to build an RPM for our CentOS release is to use the <code>--rebuild</code> option of <code>rpmbuild</code>:</p>
<pre class="console">
rpmbuild --rebuild supervisor-3.0-0.4.a10.fc16.src.rpm
</pre>
<p>Wait a few seconds for it to finish and then your binary RPM package will be in <code>~/&lt;your_building_env&gt;/RPMS/...</code>. </p>
<p>To satisfy dependencies, you will also need the package <strong>python-meld3</strong>. So, download and rebuild it:</p>
<pre class="console">
wget ftp://ftp.cc.uoc.gr/mirrors/linux/fedora/linux/development/rawhide/source/SRPMS/python-meld3-0.6.7-4.fc16.src.rpm
rpmbuild --rebuild python-meld3-0.6.7-4.fc16.src.rpm
</pre>
<p>Having built RPM packages for <strong>supervisor</strong> and <strong>python-meld3</strong>, you can now transfer them to a testing box and install them:</p>
<pre class="console">
yum localinstall /path/to/supervisor.rpm /path/to/python-meld3
yum install python-elementtree
</pre>
<p>We also installed <strong>elementtree</strong> as this is a dependency missing from the supervisor spec file (note to self: file a bug report).</p>
<p>Finally, try to start supervisord:</p>
<pre class="console">
/etc/init.d/supervisord start
</pre>
<p>Surprisingly, it complains about the missing elementtree!</p>
<pre class="codesnp">
Starting supervisord: Traceback (most recent call last):
  File "/usr/bin/supervisord", line 5, in ?
    from pkg_resources import load_entry_point
  File "/usr/lib/python2.4/site-packages/pkg_resources.py", line 2479, in ?
    working_set.require(__requires__)
  File "/usr/lib/python2.4/site-packages/pkg_resources.py", line 585, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib/python2.4/site-packages/pkg_resources.py", line 483, in resolve
    raise DistributionNotFound(req)  # XXX put more info here
pkg_resources.DistributionNotFound: elementtree
</pre>
<p>Checking the requirements file at: <code>/usr/lib/python2.4/site-packages/supervisor-3.0a10-py2.4.egg-info/requires.txt</code> there are no special version requirements:</p>
<pre class="codesnp">
meld3 >= 0.6.5
elementtree
[iterparse]
cElementTree >= 1.0.2
</pre>
<p>After some investigation on the supervisor-users mailing list, I found a message that <a href="http://lists.supervisord.org/pipermail/supervisor-users/2007-October/000106.html">indicated</a> that <em>setuptools.setup()</em> should be used instead of <em>distutils.core.setup()</em> in the <strong>setup.py</strong> script.</p>
<p>So, the dependency resolution depends on the way the package has been installed! I didn&#8217;t even bother to patch setup.py&#8230; Knowing that the dependencies are correctly installed, I commented out the <code>elementtree</code> line and also the <code>meld3</code> line as this caused the same error.</p>
<p>So, my <code>/usr/lib/python2.4/site-packages/supervisor-3.0a10-py2.4.egg-info/requires.txt</code> file looks like this:</p>
<pre class="codesnp">
#meld3 >= 0.6.5
#elementtree
[iterparse]
cElementTree >= 1.0.2
</pre>
<p>Now supervisor starts without errors:</p>
<pre class="console">
# /etc/init.d/supervisord start
Starting supervisord:                                      [  OK  ]
# cat /var/log/supervisor/supervisord.log
2011-05-12 02:56:08,221 CRIT Supervisor running as root (no user in config file)
2011-05-12 02:56:08,267 INFO RPC interface 'supervisor' initialized
2011-05-12 02:56:08,267 CRIT Server 'unix_http_server' running without any HTTP authentication checking
2011-05-12 02:56:08,271 INFO daemonizing the supervisord process
2011-05-12 02:56:08,272 INFO supervisord started with pid 21337
</pre>
<p>This is what it takes to run <strong>supervisord 3</strong> in CentOS 5 or RHEL 5. If you have any comments and suggestions, please let me know in the comments below.</p>
<div class="cc-block"><em><a href="http://www.g-loaded.eu/2011/05/12/running-supervisor-3-on-centos-5/">Running supervisor 3 on CentOS 5</a></em>, unless otherwise expressly stated, is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License</a>. Terms and conditions beyond the scope of this license may be available at <a href="http://www.g-loaded.eu/about/disclaimer-and-license/">www.g-loaded.eu</a>.</div>
<h4>Related Articles</h4>
<ul><li><a href="http://www.g-loaded.eu/2009/12/18/high-cpu-usage-centos-guest-virtualbox-vmware/" rel="bookmark">High CPU usage while running CentOS as guest on Virtualbox or VMware</a></li>
<li><a href="http://www.g-loaded.eu/2009/04/07/sticking-with-centos-rpmforge-and-yum-priorities-for-now/" rel="bookmark">Sticking with CentOS, RPMforge and yum-priorities for now</a></li>
<li><a href="http://www.g-loaded.eu/2009/04/09/yum-priorities-configuration-for-a-centos-desktop/" rel="bookmark">YUM-Priorities Configuration for a CentOS Desktop</a></li>
<li><a href="http://www.g-loaded.eu/2011/02/28/awaiting-centos-6/" rel="bookmark">Awaiting CentOS 6</a></li>
<li><a href="http://www.g-loaded.eu/2006/11/20/my-running-dog/" rel="bookmark">My running dog</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.g-loaded.eu/2011/05/12/running-supervisor-3-on-centos-5/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>Caching Nameserver using dnsmasq</title>
		<link>http://www.g-loaded.eu/2010/09/18/caching-nameserver-using-dnsmasq/</link>
		<comments>http://www.g-loaded.eu/2010/09/18/caching-nameserver-using-dnsmasq/#comments</comments>
		<pubDate>Fri, 17 Sep 2010 21:44:25 +0000</pubDate>
		<dc:creator>George Notaras</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Cache]]></category>
		<category><![CDATA[Desktop]]></category>
		<category><![CDATA[DNS]]></category>
		<category><![CDATA[HOWTO]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[Servers]]></category>
		<category><![CDATA[Service]]></category>
		<guid isPermaLink="false">http://www.g-loaded.eu/?p=1907</guid>
		<description><![CDATA[dnsmasq is a lightweight, open-source DNS forwarder and DHCP server. In this article we go through how to prepare the system in order to run dnsmasq and also how to configure the latter as a caching-only DNS server. A configuration file is also provided as a drop-in replacement for the default dnsmasq.conf that ships with [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.thekelleys.org.uk/dnsmasq/doc.html">dnsmasq</a> is a lightweight, open-source DNS forwarder and DHCP server. In this article we go through how to prepare the system in order to run <em>dnsmasq</em> and also how to configure the latter as a <strong>caching-only</strong> <abbr title="Domain Name System">DNS</abbr> server. A configuration file is also provided as a drop-in replacement for the default <code>dnsmasq.conf</code> that ships with your system. dnsmasq is available in most Linux distributions. This article was written while using CentOS, so it is safe to say that it also fully covers RHEL, Fedora and generally the whole Red Hat family of operating systems and possibly Novell&#8217;s SLES and OpenSUSE. Small modifications of the invoked commands may be needed for Debian, Ubuntu and other systems.<br />
<span id="more-1907"></span></p>
<h4>Is a caching nameserver really important?</h4>
<p>There is some controversy about the real benefits of using a caching name server in a system, either desktop or server. In this article we keep controversy out of the discussion and focus on the performance improvement the caching of DNS information can offer to a system while performing specific tasks. For instance, a caching nameserver allows a web browser to acquire DNS information from the local DNS cache, provided that this information has already been cached, without the need to access any public DNS servers, which results in faster web browsing. Similarly, in a server environment, services like spam filters often need to perform many DNS queries for the same hostnames. The latency of the communication with the remote nameserver may add up to the total time of email processing.</p>
<h4>BIND vs dnsmasq</h4>
<p><em>BIND</em> is the flagship of DNS servers with large deployments around the globe. I have used BIND for many years as  a <strong>caching nameserver</strong>, even on my desktop, until I realized it is overkill to use BIND this way. There are lighter solutions, even all-in-one software like <strong>dnsmasq</strong>, that seem to be more suitable for setting up local DNS caching.</p>
<h4>System preparation</h4>
<p>So, let&#8217;s get started with the system preparation before going into the details of the dnsmasq configuration.</p>
<p>First of all, we need to install dnsmasq:</p>
<pre class="console">yum install dnsmasq</pre>
<p>dnsmasq, when run as <code>root</code>, is designed to <em>drop privileges</em> and run as an unprivileged user. By default, this user is <code>nobody</code>. We use a dedicated system user to run dnsmasq.</p>
<p>Run the following commands as <code>root</code> to create such an unprivileged system user and group named <em>dnsmasq</em>:</p>
<pre class="console">
groupadd -r dnsmasq
useradd -r -g dnsmasq dnsmasq
</pre>
<p>The above should be enough.</p>
<h4>Configuration</h4>
<p>All dnsmasq configuration options go into <code>/etc/dnsmasq.conf</code>. Here we write this file from scratch, so if you need to keep a copy of the original that ships with your distribution, do so with:</p>
<pre class="console">
cp /etc/dnsmasq.conf /etc/dnsmasq.conf.orig
</pre>
<p>Now, let&#8217;s get started with adding our own dnsmasq configuration in <code>/etc/dnsmasq.conf</code>.</p>
<p>First of all, we set some options regarding the <strong>basic server operation</strong> like the interface and port on which it should bind, the unprivileged user that should run the service and a <abbr title="Process ID">PID</abbr> file:</p>
<pre class="codesnp">
listen-address=127.0.0.1
port=53
bind-interfaces
user=dnsmasq
group=dnsmasq
pid-file=/var/run/dnsmasq.pid
</pre>
<p>The <strong>bind-interfaces</strong> directive instructs dnsmasq to bind only to the network interface specified in the <strong>listen-address</strong> directive.</p>
<p>Next comes <strong>logging</strong>.</p>
<p>By default, dnsmasq sends its log messages to the <em>DAEMON</em> syslog facility (<em>LOCAL0</em> when operating in debug mode). We go with the defaults here, but keep in mind that a separate log file can be set as it is shown in the configuration snippet below (currently commented out):</p>
<pre class="codesnp">
#log-facility=/var/log/dnsmasq.log
#log-queries
</pre>
<p>Logging to file requires some extra configuration for proper log rotation. For more information, please read <a href="#LoggingToFile">Appendix II</a>.</p>
<p>Finally, we set the options that configure dnsmasq&#8217;s <strong>name resolution</strong> and <strong>caching</strong> operations.</p>
<p>The following directives prevent dnsmasq from forwarding plain names (without any dots) or addresses in the non-routed address space to the parent nameservers.</p>
<pre class="codesnp">
domain-needed
bogus-priv
</pre>
<p>The <strong>no-hosts</strong> directive also instructs dnsmasq not to read any hostnames from <code>/etc/hosts</code>. In most systems, <code>/etc/hosts</code> is queried before a DNS service is used by the system for name lookups. So, all plain name to private IP mappings should normally be added in <code>/etc/hosts</code>. If this is not what you want, then take a look at the <em>expand-hosts</em> and <em>domain</em> directives.</p>
<pre class="codesnp">
no-hosts
</pre>
<p>Set the maximum number of <strong>concurrent DNS queries</strong>. The default value is 150. Adjust to your needs.</p>
<pre class="codesnp">
dns-forward-max=150
</pre>
<p>Set the <strong>size</strong> of the dnsmasq cache. The default is to keep 150 hostnames. By setting the cache size to 0 disables the feature (this is not what we really want). Again, adjust this value according to your needs.</p>
<pre class="codesnp">
cache-size=1000
</pre>
<p>The following directive controls whether negative caching should be enabled or not. Negative caching allows dnsmasq to remember &#8220;<em>no such domain</em>&#8221; answers from the parent nameservers, so it does not query for the same non-existent hostnames again and again. This is probably useful for spam filters or MTA services. By default, negative caching is enabled. To disable, un-comment the following directive.</p>
<pre class="codesnp">
#no-negcache
</pre>
<p>The <strong>neg-ttl</strong> directive sets a default <abbr title="Time-To-Live">TTL</abbr> value to add to negative replies from the parent nameservers, in case these replies do not contain TTL information. If neg-ttl is not set and a negative reply from a parent DNS server does not contain TTL information, then dnsmasq will not cache the reply. Here we set the default TTL to 3600 seconds. Again, adjust to your specific needs.</p>
<pre class="codesnp">
neg-ttl=3600
</pre>
<p>Here we use a separate file where dnsmasq reads the IPs of the parent nameservers from. The syntax is the same as in <code>/etc/resolv.conf</code>. We do this to facilitate the manipulation of the parent nameservers that should be used by dnsmasq by using, for example, an external script. The filename we use here is <code>resolv.dnsmasq</code>, but this can be changed to your liking. We also set the <strong>no-poll</strong> directive here to prevent dnsmasq from polling the &#8216;resolv&#8217; file for changes.</p>
<pre class="codesnp">
resolv-file=/etc/resolv.dnsmasq
no-poll
</pre>
<p>A full configuration file containing all the above configuration, which can can be used as a drop-in replacement of the default <code>/etc/dnsmasq.conf</code>, can be found in <a href="#FullConfigurationFile">Appendix I</a>.</p>
<h4>Upstream Nameservers</h4>
<p>We have used a separate file to store the IPs of the parent nameservers; that is <code>/etc/resolv.dnsmasq</code>. Using the same syntax as in <code>/etc/resolv.conf</code> add the nameserver IP addresses in resolv.dnsmasq. For example:</p>
<pre class="codesnp">
nameserver 192.168.0.252
nameserver 192.168.0.253
nameserver 192.168.0.254
</pre>
<p>Note that we still need to make a change in <code>/etc/resolv.conf</code> before the system starts using dnsmasq for domain name lookups. Read on&#8230;</p>
<h4>Starting dnsmasq</h4>
<p>In order to start dnsmasq, run as root:</p>
<pre class="console">
/etc/init.d/dnsmasq start
</pre>
<p>Check the syslog or the dnsmasq logfile (if used) for any error messages.</p>
<p>If everything seems to be OK, set the dnsmasq service to start on boot:</p>
<pre class="console">
chkconfig dnsmasq on
</pre>
<p>This command might be Red-Hat specific, so consult your distribution&#8217;s documentation about how to set services to start on boot.</p>
<h4>Switch name resolution to dnsmasq</h4>
<p>What we have done so far is set up the dnsmasq service. For hostnames that do not exist in <code>/etc/hosts</code> the system still uses the nameserver inside <code>/etc/resolv.conf</code> for name resolution.</p>
<p>To start using dnsmasq, edit <code>/etc/resolv.conf</code>, remove all nameservers and add only the IP of our dnsmasq service:</p>
<pre class="codesnp">
nameserver 127.0.0.1
</pre>
<p>From now on, the system will use dnsmasq for domain name resolution. You can un-comment the <strong>log-queries</strong> option in order to confirm the dnsmasq operation.</p>
<h4 id="FullConfigurationFile">Appendix I &#8211; Full configuration file</h4>
<p>This is the complete configuration file containing the configuration that has been discussed in this article. Note that it can be used as is to replace the default <code>/etc/dnsmasq.conf</code>.</p>
<pre class="codesnp">
#
# Configuration file for dnsmasq acting as a caching nameserver.
#
# Format is one option per line, legal options are the same
# as the long options legal on the command line. See
# "/usr/sbin/dnsmasq --help" or "man 8 dnsmasq" for details.
#
# Updated versions of this configuration file may be available at:
#
#   http://www.g-loaded.eu/2010/09/18/caching-nameserver-using-dnsmasq/
#
#
# Basic server configuration
#
listen-address=127.0.0.1
port=53
bind-interfaces
user=dnsmasq
group=dnsmasq
pid-file=/var/run/dnsmasq.pid
#
# Logging
#
#log-facility=/var/log/dnsmasq.log
#log-queries
#
# Name resolution options
#
domain-needed
bogus-priv
no-hosts
dns-forward-max=150
cache-size=1000
#no-negcache
neg-ttl=3600
resolv-file=/etc/resolv.dnsmasq
no-poll
</pre>
<p>This file is meant to be used both on servers and desktops.</p>
<h4 id="LoggingToFile" >Appendix II &#8211; Logging to file</h4>
<p>Before dnsmasq starts logging to file it is required to set the path to the logfile in the <strong>log-facility</strong> option inside <code>/etc/dnsmasq.conf</code>.</p>
<pre class="codesnp">
log-facility=/var/log/dnsmasq.log
</pre>
<p>To ensure proper rotation of the log file you should use the following logrotate configuration:</p>
<pre class="codesnp">
/var/log/dnsmasq.log {
    monthly
    missingok
    notifempty
    delaycompress
    sharedscripts
    postrotate
        [ ! -f /var/run/dnsmasq.pid ] || kill -USR2 `cat /var/run/dnsmasq.pid`
    endscript
    create 0640 dnsmasq dnsmasq
}
</pre>
<p>Save the above configuration in <code>/etc/logrotate.d/dnsmasq</code>. Also, adjust the log filename or the path to the PID file in case you have used custom names, but make sure you do not change the <strong>USR2</strong> signal that is sent to the dnsmasq process in the post-rotation script.</p>
<h4>Final Thoughts</h4>
<p><strong>dnsmasq</strong> is a very lightweight service. Therefore, you can run it on any system, either server or desktop without any noticeable impact on system resources. In this guide we used it as an internal system service bound to the loopback interface, without permitting direct access from the outside. This along with the fact that dnsmasq is mature software that has been around for several years makes our setup rather secure.</p>
<p>Several people might argue that the performance improvement a local caching nameserver offers in terms of name lookup speed is insignificant. This might be true in some cases, but there are times that this performance improvement is noticeable, especially when the quality of the network connectivity between the current machine and the upstream nameserver is an issue, or when the upstream name server is overloaded. On the other hand, it is almost certain that a local caching DNS server can in no way make name resolution slower, unless perhaps a huge cache is being used. Generally, I find keeping such a service operational a good idea.</p>
<p>In this article we discussed about one of the dnsmasq features: DNS caching. dnsmasq is a lot more than just that. Check the whole feature set in the <a href="http://www.thekelleys.org.uk/dnsmasq/doc.html">dnsmasq homepage</a>. Perhaps, in the future, more guides covering other features of this software are published. Until then, enjoy local DNS caching!!!</p>
<div class="cc-block"><em><a href="http://www.g-loaded.eu/2010/09/18/caching-nameserver-using-dnsmasq/">Caching Nameserver using dnsmasq</a></em>, unless otherwise expressly stated, is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License</a>. Terms and conditions beyond the scope of this license may be available at <a href="http://www.g-loaded.eu/about/disclaimer-and-license/">www.g-loaded.eu</a>.</div>
<h4>Related Articles</h4>
<ul><li><a href="http://www.g-loaded.eu/2008/12/02/set-up-an-anonymous-ftp-server-with-vsftpd-in-less-than-a-minute/" rel="bookmark">Set up an anonymous FTP server with vsftpd in less than a minute</a></li>
<li><a href="http://www.g-loaded.eu/2006/09/25/how-to-integrate-seaudit-report-in-logwatch/" rel="bookmark">How to integrate seaudit-report in logwatch</a></li>
<li><a href="http://www.g-loaded.eu/2005/11/05/assign-virtual-ips-to-your-nic/" rel="bookmark">Assign Virtual IPs to your NIC</a></li>
<li><a href="http://www.g-loaded.eu/2007/09/15/use-wget-or-curl-to-download-from-rapidshare-premium/" rel="bookmark">Use wget or curl to download from RapidShare Premium</a></li>
<li><a href="http://www.g-loaded.eu/2007/08/10/ssl-enabled-name-based-apache-virtual-hosts-with-mod_gnutls/" rel="bookmark">SSL-enabled Name-based Apache Virtual Hosts with mod_gnutls</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.g-loaded.eu/2010/09/18/caching-nameserver-using-dnsmasq/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>Script for Apache Error Report</title>
		<link>http://www.g-loaded.eu/2010/03/28/script-apache-error-report/</link>
		<comments>http://www.g-loaded.eu/2010/03/28/script-apache-error-report/#comments</comments>
		<pubDate>Sun, 28 Mar 2010 17:26:47 +0000</pubDate>
		<dc:creator>George Notaras</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Administration]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Cron]]></category>
		<category><![CDATA[Report]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[Servers]]></category>
		<category><![CDATA[Snippet]]></category>
		<guid isPermaLink="false">http://www.g-loaded.eu/?p=1648</guid>
		<description><![CDATA[The last incident with the php-cgi errors as a result of a bad PHP script made me re-evaluate the daily reports I receive from the server. I realized that a report about the httpd errors that have occured during the previous day, including all virtualhosts, is more important than I had initially thought. Such a [...]]]></description>
			<content:encoded><![CDATA[<p>The last incident with the <a href="http://www.g-loaded.eu/2010/03/28/issues-with-the-feeds-are-now-resolved/">php-cgi errors</a> as a result of a bad PHP script made me re-evaluate the daily reports I receive from the server. I realized that a report about the <em>httpd errors</em> that have occured during the previous day, including all virtualhosts, is more important than I had initially thought. Such a report would have brought the problem to my attention much earlier and could also point me to the right direction while I was trying to figure out what was the cause of it. Fortunately, I found a nice error report generator for this purpose.<br />
<span id="more-1648"></span><br />
The script is called <a href="http://www.librelogiciel.com/software/ScanErrLog/action_Presentation">scanerrlog</a> and has some quite nice features. I highly recommend you check it out. In order to run it you will also need an extra Python module, <a href="http://www.librelogiciel.com/software/jaxml/action_Presentation">jaxml</a>. Download both packages and extract <strong>scanerrlog.py</strong> and <strong>jaxml.py</strong> to the same directory. Then you can call <code>scanerrlog.py</code> using the following cronjob.</p>
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#! /usr/bin/env bash</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># Error Report for httpd</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># Requires:</span>
<span style="color: #666666; font-style: italic;">#   - scanerrlog - http://www.librelogiciel.com/software/ScanErrLog/action_Presentation</span>
<span style="color: #666666; font-style: italic;">#   - jaxml - http://www.librelogiciel.com/software/jaxml/action_Presentation</span>
<span style="color: #666666; font-style: italic;">#</span>
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>httpd<span style="color: #000000; font-weight: bold;">/</span>error_log \
    <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>vhosts<span style="color: #000000; font-weight: bold;">/*/</span>log<span style="color: #000000; font-weight: bold;">/</span>error_log \
    <span style="color: #000000; font-weight: bold;">|</span> python <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>scanerrlog.py <span style="color: #660033;">-f</span> text \
    <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>mail <span style="color: #660033;">-s</span> <span style="color: #ff0000;">&quot;<span style="color: #780078;">`hostname`</span> - Apache Error Report&quot;</span> root<span style="color: #000000; font-weight: bold;">@</span>localhost
&nbsp;
<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">0</span></pre></div></div>
<p>Some notes:</p>
<ol>
<li>Make sure that this cronjob runs before <strong>log rotation</strong> takes place.</li>
<li>The above shell script concatenates the <strong>error_log</strong> files from the main web server and all <em>virtualhosts</em>. Edit the paths to reflect your server configuration and virtualhost layout.</li>
<li>Edit the path to <code>scanerrlog.py</code>.</li>
</ol>
<p>Scanerrlog has some quite nice features that let you further customize the report. Make sure you read the help message.</p>
<div class="cc-block"><em><a href="http://www.g-loaded.eu/2010/03/28/script-apache-error-report/">Script for Apache Error Report</a></em>, unless otherwise expressly stated, is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License</a>. Terms and conditions beyond the scope of this license may be available at <a href="http://www.g-loaded.eu/about/disclaimer-and-license/">www.g-loaded.eu</a>.</div>
<h4>Related Articles</h4>
<ul><li><a href="http://www.g-loaded.eu/2006/12/20/selinux-audit-reports-script/" rel="bookmark">SELinux audit reports script</a></li>
<li><a href="http://www.g-loaded.eu/2009/10/05/strange-mod_dav_svn-error/" rel="bookmark">Strange mod_dav_svn error</a></li>
<li><a href="http://www.g-loaded.eu/2011/11/28/speed-up-apache-by-including-htaccess-files-into-httpd-conf/" rel="bookmark">Speed up Apache by including htaccess files into httpd.conf</a></li>
<li><a href="http://www.g-loaded.eu/2007/08/10/ssl-enabled-name-based-apache-virtual-hosts-with-mod_gnutls/" rel="bookmark">SSL-enabled Name-based Apache Virtual Hosts with mod_gnutls</a></li>
<li><a href="http://www.g-loaded.eu/2006/09/25/how-to-integrate-seaudit-report-in-logwatch/" rel="bookmark">How to integrate seaudit-report in logwatch</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.g-loaded.eu/2010/03/28/script-apache-error-report/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>Issues with the feeds are now resolved</title>
		<link>http://www.g-loaded.eu/2010/03/28/issues-with-the-feeds-are-now-resolved/</link>
		<comments>http://www.g-loaded.eu/2010/03/28/issues-with-the-feeds-are-now-resolved/#comments</comments>
		<pubDate>Sun, 28 Mar 2010 06:06:46 +0000</pubDate>
		<dc:creator>George Notaras</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Administration]]></category>
		<category><![CDATA[Errors]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Servers]]></category>
		<category><![CDATA[Snippet]]></category>
		<category><![CDATA[System]]></category>
		<category><![CDATA[Web Applications]]></category>
		<category><![CDATA[Wordpress]]></category>
		<guid isPermaLink="false">http://www.g-loaded.eu/?p=1634</guid>
		<description><![CDATA[This is just a quick notice that during the last five days there was a problem with the website feeds. The web server returned a 500 Internal Server Error to almost all requests for /feed/ URLs. Also, there was a big increase of the server&#8217;s CPU load behind the scenes, which was caused by php-cgi [...]]]></description>
			<content:encoded><![CDATA[<p>This is just a quick notice that during the last five days there was a problem with the website feeds. The web server returned a <em>500 Internal Server Error</em> to almost all requests for <code>/feed/</code> URLs. Also, there was a big increase of the server&#8217;s <strong>CPU load</strong> behind the scenes, which was caused by <em>php-cgi</em> processes. It turned out that a custom plugin (unpublished) I had written for WordPress in the past was the cause of all the trouble, but, before coming to that conclusion, the fact that the problems had started without me doing anything on the blog during the last weeks together with a series of other random observations led me do a thorough examination of the whole server just in case.<br />
<span id="more-1634"></span><br />
So, after spending two days in front of a Linux terminal, I came to the conclusion that the following code had been problematic from the beginning and it was like a time-bomb for which the time had come to cause issues to the web site and the server that hosted it.</p>
<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> rsse_add_related_posts<span style="color: #009900;">&#40;</span><span style="color: #000088;">$PostBody</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>rsse_verify_feed<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #b1b100;">return</span> <span style="color: #000088;">$PostBody</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">function_exists</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'yarpp_related'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$PostBody</span> <span style="color: #339933;">.=</span> yarpp_related<span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'post'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">,</span><span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'rss'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #b1b100;">return</span> <span style="color: #000088;">$PostBody</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
add_filter<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'the_content'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'rsse_add_related_posts'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">252</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>
<p>This code used a function of another plugin to attach a &#8216;<em>related posts</em>&#8216; section at the end of the full content of each feed entry. As soon as I commented out the above filter and started attaching the related-posts section to the feed content through the <a href="http://mitcho.com/code/yarpp/">YARPP</a> plugin&#8217;s administration interface, everything was normal again. No more php-cgi processes timing-out or over-consuming the CPU cycles.</p>
<p>The following graph shows clearly the problematic period:</p>
<div id="attachment_1639" class="wp-caption aligncenter" style="width: 650px"><a href="http://www.g-loaded.eu/wp-content/uploads/phpcgi-cpu-time.png"><img src="http://www.g-loaded.eu/wp-content/uploads/phpcgi-cpu-time.png" alt="php-cgi processes consuming the CPU" title="phpcgi-cpu-time" width="640" class="size-full wp-image-1639" /></a><p class="wp-caption-text">php-cgi processes consuming the CPU</p></div>
<p>The httpd error_log included many errors like the following:</p>
<pre class="codesnp">
[...]
Allowed memory size of 33554432 bytes exhausted (tried to allocate 18893 bytes)
[...]
mod_fcgid: process ... exit(communication error), terminated by calling exit(), return code: 1
[...]
[warn] (104)Connection reset by peer: mod_fcgid: read data from fastcgi server error.
[...]
[warn] mod_fcgid: stderr: PHP Fatal error:  Allowed memory size of 33554432 bytes exhausted (tried to allocate 4864 bytes)
[...]
Premature end of script headers: index.php
[...]
</pre>
<p>Note that these errors might appear in several occasions.</p>
<p>In my case, finding that faulty piece of code was a huge relief, I can tell you.</p>
<div class="cc-block"><em><a href="http://www.g-loaded.eu/2010/03/28/issues-with-the-feeds-are-now-resolved/">Issues with the feeds are now resolved</a></em>, unless otherwise expressly stated, is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License</a>. Terms and conditions beyond the scope of this license may be available at <a href="http://www.g-loaded.eu/about/disclaimer-and-license/">www.g-loaded.eu</a>.</div>
<h4>Related Articles</h4>
<ul><li><a href="http://www.g-loaded.eu/2007/01/12/wordpress-206-feed-issues-resolved/" rel="bookmark">WordPress 2.0.6 &#8211; Feed Issues Resolved</a></li>
<li><a href="http://www.g-loaded.eu/2009/11/19/g-loaded-feeds/" rel="bookmark">G-Loaded Feeds</a></li>
<li><a href="http://www.g-loaded.eu/2009/10/08/redmine-deployment-delayed/" rel="bookmark">Redmine deployment delayed</a></li>
<li><a href="http://www.g-loaded.eu/2007/07/12/issue-addressed-author-feeds-deliver-full-content/" rel="bookmark">Issue addressed: Author feeds deliver full content</a></li>
<li><a href="http://www.g-loaded.eu/2008/10/17/status-of-content-availability-via-feeds/" rel="bookmark">Status of content availability via feeds</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.g-loaded.eu/2010/03/28/issues-with-the-feeds-are-now-resolved/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>Redmine deployment delayed</title>
		<link>http://www.g-loaded.eu/2009/10/08/redmine-deployment-delayed/</link>
		<comments>http://www.g-loaded.eu/2009/10/08/redmine-deployment-delayed/#comments</comments>
		<pubDate>Thu, 08 Oct 2009 04:21:50 +0000</pubDate>
		<dc:creator>George Notaras</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Web Applications]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[CodeTRAX]]></category>
		<category><![CDATA[Redmine]]></category>
		<category><![CDATA[Servers]]></category>
		<guid isPermaLink="false">http://www.g-loaded.eu/?p=1269</guid>
		<description><![CDATA[I am afraid the deployment of Redmine on CodeTRAX.org will be delayed some more. This is because I am skeptical about using mod_fcgid to run two different kinds of web applications on the same web server. This software is pretty much incomplete when it comes to defining classes of applications and setting limits, like the [...]]]></description>
			<content:encoded><![CDATA[<p>I am afraid the deployment of <a href="http://www.redmine.org/">Redmine</a> on CodeTRAX.org will be delayed some more. This is because I am skeptical about using <a href="http://httpd.apache.org/mod_fcgid/">mod_fcgid</a> to run two different kinds of web applications on the same web server. This software is pretty much incomplete when it comes to defining <strong>classes of applications</strong> and setting <strong>limits</strong>, like the maximum number of <strong>fastcgi processes</strong> and the <strong>spawning rate</strong> of new processes, for each application class. What&#8217;s a process manager if you can&#8217;t define classes of processes? I also now realize the lack of a standalone, feature-rich and well-documented <strong>fastcgi process manager</strong>.</p>
<p>I use mod_fcgid to run <a href="http://php.net">PHP</a> in fastcgi mode, but I cannot let it run the same amount of Redmine instances as it will bring the server to its knees. Redmine is not a blog. It&#8217;s a whole project hosting platform. Each instance will require about 45MB of RAM. I have already experimented with another <a href="http://httpd.apache.org">Apache</a> module that can manage Rails applications, but this will require some extra testing and this is exactly what I am going to do in the following days.</p>
<p>The most unfortunate thing is that I have removed the old platform and, for a couple of weeks now, CodeTRAX serves a <em>503 Service Unavailable</em> error document, which I consider bad for the website. I hope I find the time to fix this soon.</p>
<div class="cc-block"><em><a href="http://www.g-loaded.eu/2009/10/08/redmine-deployment-delayed/">Redmine deployment delayed</a></em>, unless otherwise expressly stated, is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License</a>. Terms and conditions beyond the scope of this license may be available at <a href="http://www.g-loaded.eu/about/disclaimer-and-license/">www.g-loaded.eu</a>.</div>
<h4>Related Articles</h4>
<ul><li><a href="http://www.g-loaded.eu/2009/10/15/redmine-deployment-meets-social-media/" rel="bookmark">Redmine deployment meets social media</a></li>
<li><a href="http://www.g-loaded.eu/2009/09/21/redmine/" rel="bookmark">Redmine</a></li>
<li><a href="http://www.g-loaded.eu/2010/04/14/some-preliminary-redmine-customizations/" rel="bookmark">Some Preliminary Redmine Customizations</a></li>
<li><a href="http://www.g-loaded.eu/2008/11/28/delayed-shutdown-initscript/" rel="bookmark">delayed-shutdown initscript</a></li>
<li><a href="http://www.g-loaded.eu/2010/03/28/issues-with-the-feeds-are-now-resolved/" rel="bookmark">Issues with the feeds are now resolved</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.g-loaded.eu/2009/10/08/redmine-deployment-delayed/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>How to change the Timezone</title>
		<link>http://www.g-loaded.eu/2009/10/07/how-to-change-the-timezone/</link>
		<comments>http://www.g-loaded.eu/2009/10/07/how-to-change-the-timezone/#comments</comments>
		<pubDate>Wed, 07 Oct 2009 13:44:03 +0000</pubDate>
		<dc:creator>George Notaras</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Administration]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[Fedora]]></category>
		<category><![CDATA[Scientific Linux]]></category>
		<category><![CDATA[Servers]]></category>
		<category><![CDATA[Service]]></category>
		<category><![CDATA[System]]></category>
		<guid isPermaLink="false">http://www.g-loaded.eu/?p=1183</guid>
		<description><![CDATA[Usually, the only time I make a change to the timezone setting of the operating system is during the installation time. But it may happen that a change to that setting is necessary. There are several ways to do this, but, as usual, there is only one Right Way&#8482; to set the timezone info in [...]]]></description>
			<content:encoded><![CDATA[<p>Usually, the only time I make a change to the <strong>timezone</strong> setting of the operating system is during the installation time. But it may happen that a change to that setting is necessary. There are several ways to do this, but, as usual, there is only one <em>Right Way</em>&trade; to set the timezone info in your <strong>Linux</strong> distribution. I investigated it for a while and I think I have figured out how to do it right using <strong>command-line</strong> utilities on <a href="http://fedoraproject.org">Fedora</a> and all RHEL rebuilds (<a href="http://centos.org">CentOS</a>, <a href="http://www.scientificlinux.org/">Scientific Linux</a>, etc). I am quite certain that many people miss this piece of information, so I describe it in detail right below.<br />
<span id="more-1183"></span></p>
<h4>Configuration</h4>
<p>The procedure must be performed by <strong>root</strong>.</p>
<p>First of all, you need to edit the <em>/etc/sysconfig/clock</em> file:</p>
<pre class="codesnp">
ZONE="Etc/GMT"
UTC=true
</pre>
<p>Please, read the notes below for more information about the settings above.</p>
<p>Then run the <strong>tzdata-update</strong> utility. This copies the correct zonefile to <em>/etc/localtime</em>:</p>
<pre class="console">
/usr/sbin/tzdata-update
</pre>
<p>Finally, update the system time by either running <strong>ntpd</strong> or the <strong>ntpdate</strong> utility. Both are part of the <code>ntp</code> RPM package, so if this is not installed, just use &#8220;<code>yum install ntp</code>&#8221; to get it installed.</p>
<pre class="console">
/usr/sbin/ntpdate -b pool.ntp.org
</pre>
<p>This will make sure your time is correct.</p>
<p>You can set a <strong>cronjob</strong> to update the system&#8217;s time using ntpdate, like this:</p>
<pre class="codesnp">
#
# Update the system time
#
55 23 * * * root /usr/sbin/ntpdate -4 -b pool.ntp.org 2>&#038;1 >> /var/log/ntpdate.log
</pre>
<h4>Notes</h4>
<p>Here are some notes about the configuration of the timezone:</p>
<ol>
<li>You can find the valid timezones by changing to the <code>/usr/share/zoneinfo/</code> directory. From there, any <em>relative path</em> to a timezone file is a valid timezone. For example, &#8220;<em>Etc/GMT</em>&#8220;, &#8220;<em>Europe/Athens</em>&#8220;, &#8220;<em>America/New_York</em>&#8221; et cetera.</li>
<li><strong>GMT</strong> and <strong>UTC</strong> time are practically the same and they both refer to the <a href="http://en.wikipedia.org/wiki/Greenwich_Mean_Time">Greenwich Mean Time</a>, so setting the timezone to &#8220;<em>Etc/UTC</em>&#8221; or &#8220;<em>Etc/GMT</em>&#8221; is practically the same.</li>
<li>In <code>/etc/sysconfig/clock</code> you can set whether the <strong>hardware clock</strong> is set to <strong>UTC/GMT</strong> time or to <strong>Local Time</strong>. I am not sure in what way the hardware clock gets involved is the time of the Operating System. But, anyway, if you know how the hardware clock is configured, set this accordingly to true or false. Usually, if I set the OS to use GMT time, I also set this to true regardless of the actual hardware clock configuration. More info on this is still needed.</li>
<li>In <code>/etc/sysconfig/clock</code> you may see the options <strong>ARC=false</strong> and <strong>SRM=false</strong>. These change the way the &#8220;epoch&#8221; is assumed by the console on Alpha systems and have no effect if you do not use such a platform. Delete them or leave as is, unless you know you need to set one of them to true.</li>
<li>In order to set the correct timezone, you could just create a <strong>symlink</strong> at <code>/etc/localtime</code> pointing to the correct timezone file in <code>/usr/share/zoneinfo/</code>. Then again, this would render the system configuration file <code>/etc/sysconfig/clock</code> (and thus all other applications that use it) useless and ineffective, so this method is generally <strong>not recommended</strong>.</li>
</ol>
<h4>Final thoughts</h4>
<p>Setting your server to use the correct time is very important. Generally, I hate it when I see web sites or other services having incorrect time. This reveals the web server or the web application administrator&#8217;s laziness or inability to properly configure the time. I hope this guide will help get rid of this issue.</p>
<div class="cc-block"><em><a href="http://www.g-loaded.eu/2009/10/07/how-to-change-the-timezone/">How to change the Timezone</a></em>, unless otherwise expressly stated, is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License</a>. Terms and conditions beyond the scope of this license may be available at <a href="http://www.g-loaded.eu/about/disclaimer-and-license/">www.g-loaded.eu</a>.</div>
<h4>Related Articles</h4>
<ul><li><a href="http://www.g-loaded.eu/2008/11/27/maxminds-geoip-dat-gz-location-change/" rel="bookmark">Maxmind&#8217;s GeoIP.dat.gz location change</a></li>
<li><a href="http://www.g-loaded.eu/2005/09/30/change-console-font-in-fedora/" rel="bookmark">Change console font in Fedora</a></li>
<li><a href="http://www.g-loaded.eu/2005/11/05/assign-virtual-ips-to-your-nic/" rel="bookmark">Assign Virtual IPs to your NIC</a></li>
<li><a href="http://www.g-loaded.eu/2008/05/12/how-to-disable-ipv6-in-fedora-and-centos/" rel="bookmark">How to Disable IPv6 in Fedora and CentOS</a></li>
<li><a href="http://www.g-loaded.eu/2010/11/01/change-expiration-date-gpg-key/" rel="bookmark">How to change the expiration date of a GPG key</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.g-loaded.eu/2009/10/07/how-to-change-the-timezone/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>Fedora Server vs CentOS</title>
		<link>http://www.g-loaded.eu/2009/10/05/fedora-server-vs-centos/</link>
		<comments>http://www.g-loaded.eu/2009/10/05/fedora-server-vs-centos/#comments</comments>
		<pubDate>Mon, 05 Oct 2009 19:52:02 +0000</pubDate>
		<dc:creator>George Notaras</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[Fedora]]></category>
		<category><![CDATA[Servers]]></category>
		<guid isPermaLink="false">http://www.g-loaded.eu/?p=1225</guid>
		<description><![CDATA[End of era for my Fedora based server after almost five years of service. The box now runs CentOS. I had this box at home and it was the only Fedora Server I ever maintained at home or elsewhere. I should state from the beginning that it was only Fedora&#8217;s short life-cycle that practically forced [...]]]></description>
			<content:encoded><![CDATA[<p>End of era for my <a href="http://fedoraproject.org/">Fedora</a> based server after almost five years of service. The box now runs <a href="http://centos.org/">CentOS</a>. I had this box at home and it was the only <strong>Fedora Server</strong> I ever maintained at home or elsewhere. I should state from the beginning that it was only Fedora&#8217;s short <em>life-cycle</em> that practically forced me to switch. Other than that, I&#8217;ve never encountered a single issue with its <strong>performance</strong>, <strong>stability</strong> or <strong>security</strong>, even if I had been upgrading through yum since Fedora Core 3 (upgrading through yum is probably still an officially unsupported feature).<br />
<span id="more-1225"></span><br />
You have probably read several times on this website about the stability issues I had faced on my <strong>Fedora Desktop</strong>. All those issues were entirely related to <em>graphical applications</em> and are common among all Linux distributions that are used as desktop operating systems. There is a huge <em>gap in quality</em> between the software that is used to run a WWW, SMTP, FTP, et cetera server and the software that is used on Linux desktops. Anyway, I won&#8217;t go into the details of this topic in the current post. I would like to say only this: If Fedora&#8217;s <em>short life-cycle</em> and the <em>frequent updates</em> are not a problem to you, then Fedora automatically becomes a very strong candidate for your server.</p>
<p>Having used <strong>Red Hat Linux</strong>, <strong>CentOS</strong> and <strong>Fedora</strong> over time I have finally come to several conclusions about each of them (well RHL has reached EOL). Below, I try to summarize the advantages and downsides of each of the last two distributions both as an operating system for a server and as a project to which you might want to contribute (since you use it on your boxes):</p>
<h4>CentOS</h4>
<p>Advantages:</p>
<ul>
<li>Almost guaranteed <strong>stability</strong>. The distribution includes old but proven versions of software which are very unlikely to have serious <em>security</em> or <em>blocker</em> bugs. &#8220;<em>Almost</em>&#8221; is used because you get true <strong>guaranteed</strong> stability only by using <em>Red Hat Enterprise Linux</em> (RHEL), which is available under contract by Red Hat Inc.</li>
<li>The CentOS or better the <a href="http://www.redhat.com/security/updates/errata/">RHEL Life-Cycle</a> is <strong>7 years</strong>.</li>
</ul>
<p>Disadvantages:</p>
<ul>
<li>The included software on the base repositories does not fully cover the needs of a <em>modern server</em>. Using software from <strong>3rd party repositories</strong> has become a common practice among CentOS users. There are some well-known repositories, but it may happen that you have to use a package from a repository that is not so popular or (many times) completely unknown. Using software from 3rd party repositories renders your installation less secure.</li>
<li>If a <strong>bug</strong> is not security-related, it may take several months (sometimes more than a year) to get fixed. Although the sources are the same with RHEL, except for the artwork, logos and release notes, CentOS has its own bug tracking system, which is completely unrelated to the Red Hat bug tracking system, meaning that they do not monitor or notify each other for bug submissions and fixes, despite the fact that the two OSes are almost alike. In practice, this is worse than it sounds. Things *could* be better.</li>
<li>The organization of the <em>community</em> behind CentOS is not very clear. Even if you want to contribute some time and effort you will have to accept some things &#8220;as is&#8221;. In general, it is nowhere near the organization and openness of the Fedora community.</li>
<li>CentOS does not differ from the vast majority of Linux distributions when it comes to your relationship as a contributor to the project, which is mostly governed by &#8220;bro&#8221; rules and practices.</li>
</ul>
<h4>Fedora</h4>
<p>Advantages:</p>
<ul>
<li><strong>Software availability</strong>. The project&#8217;s repositories contain a huge amount of packages, which have been built with common, well-documented packaging guidelines. Almost any software a modern server may require can be found in the main RPM repository. Only in rear occasions you will need a 3rd party repo.</li>
<li>A well-organized <strong>community</strong> around the project. All procedures are open and well-documented.</li>
<li>Professional procedures and practices govern your relationship to the project as a contributor.</li>
<li>Bugs are resolved rather quickly, especially blocker bugs.</li>
</ul>
<p>Disadvantages:</p>
<ul>
<li><a href="http://fedoraproject.org/wiki/LifeCycle">Short life-cycle</a> of about 13 months.</li>
<li>Theoritically, <strong>less stable</strong> versions of software than CentOS or RHEL. Even the server software is updated too often. Despite of the high quality of the server software, the frequent updates makes it &#8220;feel&#8221; less stable. From my own experience though, I&#8217;d say that, if CentOS gets an &#8220;<strong>100% Stable</strong>&#8221; label, a Fedora Server gets a <strong>99.5%</strong>. Personally, although I had set up several services on the box, I never had any stability issues, but that does not necessarily mean that they do not exist.</li>
</ul>
<p>As you can see, both distributions have their downsides. Now that I have written all the above, I think that there is a gap between the two OSes, which could be filled by a 3rd operating system. A system that would be more modern than CentOS, but less &#8220;cutting edge&#8221; than Fedora, and which would have a life-cycle of about 3-4 years. That would be very interesting.</p>
<p>Personally, I have successfully used both operating systems as servers for several years. I cannot make up my mind and decide which one better meets a server&#8217;s requirements. As I have previously mentioned, I decided to fully switch to CentOS because of the significantly longer life-cycle.</p>
<div class="cc-block"><em><a href="http://www.g-loaded.eu/2009/10/05/fedora-server-vs-centos/">Fedora Server vs CentOS</a></em>, unless otherwise expressly stated, is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License</a>. Terms and conditions beyond the scope of this license may be available at <a href="http://www.g-loaded.eu/about/disclaimer-and-license/">www.g-loaded.eu</a>.</div>
<h4>Related Articles</h4>
<ul><li><a href="http://www.g-loaded.eu/2009/04/07/sticking-with-centos-rpmforge-and-yum-priorities-for-now/" rel="bookmark">Sticking with CentOS, RPMforge and yum-priorities for now</a></li>
<li><a href="http://www.g-loaded.eu/2008/12/11/centos-debian-freebsd-opensolaris/" rel="bookmark">CentOS, Debian, FreeBSD, OpenSolaris</a></li>
<li><a href="http://www.g-loaded.eu/2009/04/01/centos-community-enterprise-operating-system/" rel="bookmark">CentOS &#8211; Community ENTerprise Operating System</a></li>
<li><a href="http://www.g-loaded.eu/2008/12/10/almost-saying-goodbye-to-innovation/" rel="bookmark">Almost saying goodbye to innovation</a></li>
<li><a href="http://www.g-loaded.eu/2008/05/12/how-to-disable-ipv6-in-fedora-and-centos/" rel="bookmark">How to Disable IPv6 in Fedora and CentOS</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.g-loaded.eu/2009/10/05/fedora-server-vs-centos/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>CentOS &#8211; Community ENTerprise Operating System</title>
		<link>http://www.g-loaded.eu/2009/04/01/centos-community-enterprise-operating-system/</link>
		<comments>http://www.g-loaded.eu/2009/04/01/centos-community-enterprise-operating-system/#comments</comments>
		<pubDate>Wed, 01 Apr 2009 15:01:59 +0000</pubDate>
		<dc:creator>George Notaras</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[Desktop]]></category>
		<category><![CDATA[Servers]]></category>
		<guid isPermaLink="false">http://www.g-loaded.eu/?p=1002</guid>
		<description><![CDATA[CentOS 5.3 for the i386 and x86_64 architectures has been released today. I usually do not reproduce such announcements, but this CentOS release is somehow special to me. During the last 7-8 years, I have used Red Hat Linux, some early CentOS releases and Fedora on my home server. In the beginning, this server existed [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://centos.org/">CentOS</a> 5.3 for the i386 and x86_64 architectures has been <a href="http://lists.centos.org/pipermail/centos-announce/2009-April/015711.html">released</a> today. I usually do not reproduce such announcements, but this CentOS release is somehow special to me.<br />
<span id="more-1002"></span><br />
During the last 7-8 years, I have used <em>Red Hat Linux</em>, some early <em>CentOS</em> releases and <em>Fedora</em> on my home server. In the beginning, this server existed just for fun running over a 56kbps line (I was probably its only user at that time). Later on, having upgraded the internet line, I decided to host G-Loaded on it. Fedora has been running on that server for the last 3.5 years. I never had any real issues with it, except perhaps for some major system upgrades using yum. Other than that, it has been stable as a rock. However, one drawback of using Fedora as a server is its limited life span. Well, when you play around the server all day, that&#8217;s hardly a problem. But, when spare time becomes really limited, this becomes a big issue and a good reason to switch back to an operating system that is intended to be used on servers. During the next weeks I will gradually replicate the Fedora server&#8217;s configuration on a virtual machine running CentOS and, when I judge that all things run smoothly, I will perform the migration of the real server to CentOS.</p>
<p>On the other hand, about 4+ years ago I had switched from Microsoft Windows to Fedora for my desktop needs. My experience with Fedora as a desktop so far has shown that this operating system does not actually help me meet my goals as far as the desktop computer is concerned. Fedora is one of those OSes where all the development and testing takes place. Its own goal is to be innovative and provide the user with the latest technologies. But, this inevitably makes it a rather buggy operating system. Things that work today may be broken tomorrow. I have tried really hard to get used to this unpredictable way of computing, but I cannot do it any more. So, I have decided to switch back to something more stable and predictable.</p>
<p>Two of the candidates for my desktop are <strong>CentOS</strong> and <strong>Windows Vista</strong>. I chose those two because I know them very well. My decision is not driven by my intention to contribute back to the community <strong>through this particular use</strong> of one of the aforementioned operating systems. If that was the goal, I would stay with Fedora or migrate to Ubuntu, OpenSuse, Gentoo or any other Linux distribution that represents the so called &#8220;cutting edge&#8221;. I need a desktop operating system that is reliable, stable, predictable and easy to use. As far as CentOS is concerned, this comes at the cost of using older versions of software (by default), for instance it ships with OpenOffice 2.3 (it is easy to upgrade though). In the case of Windows, stability, reliability and predictability have to be bought and also the &#8220;<em>license to use</em>&#8221; is bound to the hardware. Well, nothing is really free in this world. Everybody has to make choices.</p>
<p>Strictly <strong>judging by the use of a particular operating system as a desktop</strong>, one thing I would like to put some emphasis on is that a CentOS user does not differ much from a Windows user. Both choose a predictable system and pay the necessary cost (whatever it might be) in order to accomplish their goals. Moreover, since both of those OSes have already been extensively tested by others, the users&#8217; primary goal is not to contribute back to the community in the form of bug-hunting or beta-testing, which is probably one of the most important parts of the software development process. Of course, both CentOS and Windows have bugs, but it would be a joke to compare the type and the number of problems that arise in these OSes to the issues a Fedora/Ubuntu/OpenSuse/Gentoo etc user has to face.</p>
<p>If any user of a conservative Linux distribution (Debian-testing included) feels insulted by being compared to a Windows user, I apologize. It was not my intention to insult you or make you feel uncomfortable in any way. A user of a conservative Linux distribution may contribute to the FOSS development by other means, but <strong>what I try to analyse here are the criteria upon which the choice of an operating system is made and what that choice practically means</strong>.</p>
<p>But, that is enough with this topic.</p>
<p>What this post is about is my <strong>announcement that I officially migrate to CentOS for both the server and the desktop</strong>. I am also considering migrating to Windows Vista as far as my desktop is concerned, but this will depend on how my desktop experience with CentOS will be. Time permitting I will be closely following the development of Fedora through virtualization and, as usual, report any issues I encounter.</p>
<div class="cc-block"><em><a href="http://www.g-loaded.eu/2009/04/01/centos-community-enterprise-operating-system/">CentOS &#8211; Community ENTerprise Operating System</a></em>, unless otherwise expressly stated, is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License</a>. Terms and conditions beyond the scope of this license may be available at <a href="http://www.g-loaded.eu/about/disclaimer-and-license/">www.g-loaded.eu</a>.</div>
<h4>Related Articles</h4>
<ul><li><a href="http://www.g-loaded.eu/2008/12/10/almost-saying-goodbye-to-innovation/" rel="bookmark">Almost saying goodbye to innovation</a></li>
<li><a href="http://www.g-loaded.eu/2009/10/05/fedora-server-vs-centos/" rel="bookmark">Fedora Server vs CentOS</a></li>
<li><a href="http://www.g-loaded.eu/2008/12/11/centos-debian-freebsd-opensolaris/" rel="bookmark">CentOS, Debian, FreeBSD, OpenSolaris</a></li>
<li><a href="http://www.g-loaded.eu/2009/04/07/sticking-with-centos-rpmforge-and-yum-priorities-for-now/" rel="bookmark">Sticking with CentOS, RPMforge and yum-priorities for now</a></li>
<li><a href="http://www.g-loaded.eu/2011/05/12/running-supervisor-3-on-centos-5/" rel="bookmark">Running supervisor 3 on CentOS 5</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.g-loaded.eu/2009/04/01/centos-community-enterprise-operating-system/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>Using the mod_dav_svn SVNParentPath directive with multiple authz files</title>
		<link>http://www.g-loaded.eu/2008/12/18/using-the-mod_dav_svn-svnparentpath-directive-with-multiple-authz-files/</link>
		<comments>http://www.g-loaded.eu/2008/12/18/using-the-mod_dav_svn-svnparentpath-directive-with-multiple-authz-files/#comments</comments>
		<pubDate>Thu, 18 Dec 2008 03:02:50 +0000</pubDate>
		<dc:creator>George Notaras</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Servers]]></category>
		<category><![CDATA[Subversion]]></category>
		<guid isPermaLink="false">http://www.g-loaded.eu/?p=805</guid>
		<description><![CDATA[I&#8217;ve been using the mod_dav_svn module for Apache, part of the subversion distribution package, in order to make several SVN repositories available over the HTTP protocol for quite some time now. More specifically, I use a multi-repository setup under the same virtualhost by using the SVNParentPath directive of mod_dav_svn. Also, the authorization policy is enforced [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been using the <strong>mod_dav_svn</strong> module for <a href="http://httpd.apache.org/">Apache</a>, part of the <a href="http://subversion.tigris.org/">subversion</a> distribution package, in order to make several <em>SVN repositories</em> available over the HTTP protocol for quite some time now. More specifically, I use a <em>multi-repository</em> setup under the same virtualhost by using the <code>SVNParentPath</code> directive of <em>mod_dav_svn</em>. Also, the <strong>authorization policy</strong> is enforced by <strong>mod_authz_svn</strong> by using one general <em>authz</em> file (<code>AuthzSVNAccessFile</code>) containing the <em>policy rules</em>. In case the user is not authorized to access the resource, basic HTTP authentication is used to finally grant or deny access to the user. Everything works as expected, but let&#8217;s see if this is practical too&#8230;<br />
<span id="more-805"></span><br />
It is obvious that using such a setup, all <a href="http://subversion.tigris.org/">subversion</a> repositories share the same authz file. This is fine in most circumstances, but it presumes that one person or a small team of administrators will practically be able to manage the authorization policy inside the authz file, unless you grant read/write access to everyone, which is not very likely. And this is where problems begin to arise. What happens if there are 1000 development teams and thousands of requests to the admin team asking for modifications on the authz file? This is almost chaos. On the other hand, suppose that each SVN repository belongs to a development team which wishes to manage its repo&#8217;s authorization policy itself. What can be done in such a case? Unfortunately, nothing that will not require some coding. mod_authz_svn cannot handle multiple authorization files when a multi-repository configuration (<code>SVNParentPath</code>) is used.</p>
<p>One way to resolve the issue mentioned above is to inject our own authorization code into the relevant phase of the HTTP request processing. What this authorization code is going to do is to dynamically construct the path to the requested repository&#8217;s authz file, parse the authz file, determine the level of access the user may get in accordance to the HTTP request type and, finally, return an OK or an error code back to Apache.</p>
<p>Tonight I&#8217;ve spent several hours on this. Although, the appropriate approach would be to patch mod_authz_svn, I am not that excited about such an approach as I would need several days of hard work to modify an existing apache module. Instead, I have almost finished an <strong>authorization handler</strong> and an <strong>authz file parser</strong> (only basic syntax is supported), both written in python, which can be used by apache with the help of <a href="http://www.modpython.org/">mod_python</a>.</p>
<p>This is not finished yet. As you might have assumed I need this piece of code for <a href="http://www.codetrax.org/projects/project-codetrax">Project CodeTRAX</a>. Although, I had decided not to release anything related to that project until it is finished, I might make an exception and release this piece of python code in order to get some valuable feedback about if and how secure it is.</p>
<div class="cc-block"><em><a href="http://www.g-loaded.eu/2008/12/18/using-the-mod_dav_svn-svnparentpath-directive-with-multiple-authz-files/">Using the mod_dav_svn SVNParentPath directive with multiple authz files</a></em>, unless otherwise expressly stated, is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License</a>. Terms and conditions beyond the scope of this license may be available at <a href="http://www.g-loaded.eu/about/disclaimer-and-license/">www.g-loaded.eu</a>.</div>
<h4>Related Articles</h4>
<ul><li><a href="http://www.g-loaded.eu/2009/10/05/strange-mod_dav_svn-error/" rel="bookmark">Strange mod_dav_svn error</a></li>
<li><a href="http://www.g-loaded.eu/2005/10/03/search-a-string-in-multiple-files/" rel="bookmark">Search for a string in multiple files</a></li>
<li><a href="http://www.g-loaded.eu/2010/04/12/a-change-of-plans-regarding-a-web-based-vcs-manager/" rel="bookmark">A change of plans regarding a web-based VCS manager</a></li>
<li><a href="http://www.g-loaded.eu/2007/12/01/veritar-verify-checksums-of-files-within-a-tar-archive/" rel="bookmark">VeriTAR &#8211; Verify checksums of files within a TAR archive</a></li>
<li><a href="http://www.g-loaded.eu/2010/10/04/rsapiget-download-rapidshare-api/" rel="bookmark">rsapiget downloads files using the new Rapidshare API</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.g-loaded.eu/2008/12/18/using-the-mod_dav_svn-svnparentpath-directive-with-multiple-authz-files/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>Making a directory writable by the webserver</title>
		<link>http://www.g-loaded.eu/2008/12/09/making-a-directory-writable-by-the-webserver/</link>
		<comments>http://www.g-loaded.eu/2008/12/09/making-a-directory-writable-by-the-webserver/#comments</comments>
		<pubDate>Tue, 09 Dec 2008 13:21:02 +0000</pubDate>
		<dc:creator>George Notaras</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Administration]]></category>
		<category><![CDATA[Filesystem]]></category>
		<category><![CDATA[Servers]]></category>
		<category><![CDATA[Web Applications]]></category>
		<guid isPermaLink="false">http://www.g-loaded.eu/?p=751</guid>
		<description><![CDATA[I&#8217;ve used the phrase &#8220;writable by the webserver&#8221; numerous times throughout this blog, without ever bothering to explain in detail what this means. Yesterday, I received an email asking me exactly that, so I decided to finally write a post about it and use it as a reference whenever I use the aforementioned phrase. I&#8217;ll [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve used the phrase &#8220;<em>writable by the webserver</em>&#8221; numerous times throughout this blog, without ever bothering to explain in detail what this means. Yesterday, I received an email asking me exactly that, so I decided to finally write a post about it and use it as a reference whenever I use the aforementioned phrase. I&#8217;ll use <a href="http://httpd.apache.org/">Apache</a> as an example webserver and a filesystem with <a href="http://assela.pathirana.net/UNIX_file_system_permissions_tutorial">Unix-like permissions</a>. I&#8217;ll also try to keep the article as short as possible.<br />
<span id="more-751"></span><br />
First of all, the webserver, Apache in our case, is a program running in the <em>background</em>. Apache is originally started by user <strong>root</strong>. We will call this initial process the &#8220;<strong>root-process</strong>&#8220;. The &#8220;root-process&#8221; launches several <strong>child processes</strong> which handle the client requests. For security reasons, <em>the child processes are not run by user &#8220;root&#8221;</em> but as a user with minimal privileges. Usually this user is named <code>apache</code> or <code>www-data</code> etc. To find out how this is called in your system, issue the following command:</p>
<pre class="console">
$ ps -ef | grep httpd | grep -v grep
root      1926     1  0 Dec03 ?        00:00:55 /usr/sbin/httpd.worker
apache    2608  1926  0 14:31 ?        00:00:06 /usr/sbin/httpd.worker
apache   22192  1926  0 01:05 ?        00:00:02 /usr/sbin/httpd.worker
</pre>
<p>So, in my case the child processes are run by user &#8220;<code>apache</code>&#8220;. This could also be determined by the user and group directives inside Apache&#8217;s configuration file, <code>/etc/httpd/conf/httpd.conf</code>:</p>
<pre class="codesnp">
User apache
Group apache
</pre>
<p>So, in order to <strong>make a directory writable by the webserver</strong> we have to set the directory&#8217;s owner or group to Apache&#8217;s owner or group and enable the write permission for it. Usually, we set the directory to belong to the Apache group (<code>apache</code> or <code>www-data</code> or whatever user is used to launch the child processes) and enable the write permission for the group.</p>
<pre class="console">
chgrp apache /path/to/mydir
chmod g+w /path/to/mydir
</pre>
<p>In many cases, usually in <em>shared hosting environments</em>, it is not possible to change the ownership of files and directories. In those cases you could just set the write permission for everyone (others):</p>
<pre class="console">
chmod o+w /path/to/mydir
</pre>
<p>Which method is more <strong>secure</strong> depends on how <code>/path/to/mydir</code> is accessed.</p>
<p>If it is accessed through the web server with an HTTP request it does not really matter which of the above methods has been used in order to make <code>/path/to/mydir</code> writable by the web server, because, in any case, the web server will be able to write to <code>/path/to/mydir</code>.</p>
<p>If the directory is accessed by other means, for instance by another local program which is run by an untrusted local user, then, obviously, the first method is more secure.</p>
<p>I guess this explains how to make a directory or file writable by the web server process.</p>
<div class="cc-block"><em><a href="http://www.g-loaded.eu/2008/12/09/making-a-directory-writable-by-the-webserver/">Making a directory writable by the webserver</a></em>, unless otherwise expressly stated, is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License</a>. Terms and conditions beyond the scope of this license may be available at <a href="http://www.g-loaded.eu/about/disclaimer-and-license/">www.g-loaded.eu</a>.</div>
<h4>Related Articles</h4>
<ul><li><a href="http://www.g-loaded.eu/2009/10/08/redmine-deployment-delayed/" rel="bookmark">Redmine deployment delayed</a></li>
<li><a href="http://www.g-loaded.eu/2007/02/21/htaccess-cheat-sheet/" rel="bookmark">.htaccess Cheat Sheet</a></li>
<li><a href="http://www.g-loaded.eu/2010/03/28/issues-with-the-feeds-are-now-resolved/" rel="bookmark">Issues with the feeds are now resolved</a></li>
<li><a href="http://www.g-loaded.eu/2007/08/06/file-and-directory-diff-in-color-in-midnight-commander/" rel="bookmark">File and Directory diff in color in Midnight Commander</a></li>
<li><a href="http://www.g-loaded.eu/2010/03/28/script-apache-error-report/" rel="bookmark">Script for Apache Error Report</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.g-loaded.eu/2008/12/09/making-a-directory-writable-by-the-webserver/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	</item>
	</channel>
</rss>

