<?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>Spind.net Blog &#187; SuEXEC</title>
	<atom:link href="http://blog.spind.net/tag/suexec/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.spind.net</link>
	<description>Stories from the trenches of System Administration</description>
	<lastBuildDate>Mon, 19 Dec 2011 09:21:50 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Custom SuEXEC for Apache &#8211; the easy way</title>
		<link>http://blog.spind.net/2009/04/15/custom-suexec-for-apache-the-easy-way/</link>
		<comments>http://blog.spind.net/2009/04/15/custom-suexec-for-apache-the-easy-way/#comments</comments>
		<pubDate>Wed, 15 Apr 2009 14:33:43 +0000</pubDate>
		<dc:creator>hc</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[SuEXEC]]></category>

		<guid isPermaLink="false">http://blog.spind.net/?p=124</guid>
		<description><![CDATA[I&#8217;m a security freak, and prefer to switch to individual users, when running scripts on different sites. There are numerous advantages to this, including being able to write to your web directory, without leaving a huge security hole open for root-kits on other hosted sites on the server. To do this, I&#8217;ve decided to use [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m a security freak, and prefer to switch to individual users, when running scripts on different sites. There are numerous advantages to this, including being able to write to your web directory, without leaving a huge security hole open for root-kits on other hosted sites on the server.</p>
<p>To do this, I&#8217;ve decided to use the Apache <tt>suexec</tt> option for all my scripts. I won&#8217;t go into specific details about the setup here, but present a pretty solution to an annoying problem that arises when using <tt>suexec</tt> and applying software updates for the Apache server.</p>
<p>If your web files are located in <tt>/var/www</tt>, you won&#8217;t need this. For security reasons, <tt>suexec</tt> is compiled with various configuration options that can&#8217;t be changed runtime &#8211; the &#8220;safe&#8221; location of scripts is one of them. If you &#8211; like me &#8211; have your web files located somewhere else, you&#8217;ll need to recompile <tt>suexec</tt> and re-install it every time you upgrade Apache. If you decide to get the entire source code tree for Apache, just for this, you&#8217;ll find yourself in a mess that could easily be avoided.</p>
<p>Here is my solution: Since the <tt>suexec</tt> source files themselves rarely change, I picked out exactly the files needed to compile the <tt>suexec</tt> binary and simplified the Makefile. This way, I&#8217;ve got a very small directory with the files required to build my <tt>suexec</tt> with my own configuration options, without messing with the rest of the Apache source code. As long as I remember to run <tt>make install</tt> after updating Apache, it&#8217;s all good.</p>
<p>First of all, you need to set up a directory for the <tt>suexec</tt> files:</p>
<div class="codebox">
$ cd /usr/src<br />
$ mkdir suexec<br />
$ cd suexec<br />
$ wget http://svn.apache.org/repos/asf/httpd/httpd/branches/2.2.x/support/suexec.c<br />
$ wget http://svn.apache.org/repos/asf/httpd/httpd/branches/2.2.x/support/suexec.h
</div>
<p>Now make the changes you need to <tt>suexec.h</tt> and write a suitable Makefile:</p>
<div class="codebox">
suexec: suexec.h suexec.c<br />
&nbsp; &nbsp; gcc suexec.c -o suexec -I /usr/include/apr-1/ -I /usr/include/httpd/<br />
<br />
clean:<br />
&nbsp; &nbsp; rm -fv suexec.o suexec<br />
<br />
install: suexec<br />
&nbsp; &nbsp; cp suexec /usr/sbin/suexec<br />
&nbsp; &nbsp; chmod 4775 /usr/sbin/suexec
</div>
<p>You&#8217;ll need the <tt>apr-devel</tt> and <tt>httpd-devel</tt> packages for this to work. Remember that you need to indent with tabs in makefiles. Run <tt>make install</tt> to install:</p>
<div class="codebox">
$ make install<br />
gcc suexec.c -o suexec -I /usr/include/apr-1/ -I /usr/include/httpd/<br />
cp suexec /usr/sbin/suexec<br />
chmod 4775 /usr/sbin/suexec
</div>
<p>If you&#8217;re running <tt>php-cgi</tt> and getting http error 500, your <tt>suexec</tt> probably needs to be re-installed. Remember to check the <tt>suexec</tt> logfile.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.spind.net/2009/04/15/custom-suexec-for-apache-the-easy-way/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

