<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/rss2full.xsl" type="text/xsl" media="screen"?><?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/itemcontent.css" type="text/css" media="screen"?><rss 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:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Phil Chen</title>
	
	<link>http://www.philchen.com</link>
	<description>Phil Chen</description>
	<pubDate>Thu, 14 Aug 2008 03:27:27 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
	<language>en</language>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/phil_chen" type="application/rss+xml" /><feedburner:emailServiceId>810718</feedburner:emailServiceId><feedburner:feedburnerHostname>http://www.feedburner.com</feedburner:feedburnerHostname><item>
		<title>How much can a memcached server handle?</title>
		<link>http://feeds.feedburner.com/~r/phil_chen/~3/315168850/</link>
		<comments>http://www.philchen.com/2008/06/18/how-much-can-a-memcached-server-handle/#comments</comments>
		<pubDate>Thu, 19 Jun 2008 05:21:42 +0000</pubDate>
		<dc:creator>phil</dc:creator>
		
		<category><![CDATA[Systems 101]]></category>

		<guid isPermaLink="false">http://www.philchen.com/?p=49</guid>
		<description><![CDATA[  Memcached is a high-performance, distributed memory object caching system. It is used in a wide range of sites such as livejournal.com and facebook.com as a way to alleviate database load helping to speed up sites. Memcached is usually deployed as an adequate subset of servers in relation to your application and database infrastructure. It&#8217;s [...]<script type="text/javascript">SHARETHIS.addEntry({ title: "How much can a memcached server handle?", url: "http://www.philchen.com/2008/06/18/how-much-can-a-memcached-server-handle/" });</script> ]]></description>
			<content:encoded><![CDATA[<p> Memcached is a high-performance, distributed memory object caching system. It is used in a wide range of sites such as livejournal.com and facebook.com as a way to alleviate database load helping to speed up sites. Memcached is usually deployed as an adequate subset of servers in relation to your application and database infrastructure. It&#8217;s a great way to cut down your database calls by caching the requests.<br />
<span id="more-49"></span><br />
The servers are not load balanced in any least connections or response time fashion, but instead using a Hashing/Key Distribution. So in other words it spreads out cache across all the memcached servers not redundantly. A hash table allows the application to locate where cache exists. Utilizing a lazy expiration, cpu is not a factor for expiring items. An item gets requested it checks the expiration time to see if the item is still valid prior to returning it to the client. When adding a new item to the cache, if the cache is full it will look out for expired items to replace before replacing the least used items in the cache. You can read more about it at the memcached <a href="http://www.danga.com/memcached/">site</a>.</p>
<p>Recently I ran into a situation where an object (db conf) that was being called repeatedly via a web application ~100x more then any other cached item was being stored on one of four memcached servers. This item was stored as a flat file originally but had been implemented into a database which is how memcached came into play.</p>
<p>The excitement starts here, the four memcached servers were Dell 1950&#8217;s Dual Core Intel Xeon 2.0 GHz with 8 Gigs of RAM on each running Centos. Version of Memcached was 1.2.1. The particular object being cached ended up on a server as designed, however was being called by the web application a ~100x more then any other cached object and had a 5 minute expire. The particular memcached server with the object ended up taking a whopping 800+megabit/second in traffic, see the below graph:</p>
<p><img src='http://www.philchen.com/upload/memcache800mb.png' alt='memcache800mb' class='aligncenter' /><br />
*The reads and writes are reversed was the way cacti was set up.</p>
<p>The other server vitals at the time were:<br />
CPU = 60%<br />
Memcache Misses = 681 k/s<br />
Memcache Hits = 1.16 M/s<br />
Memcache Requests/sec (get&#038;set) = 1.66 million<br />
Server Load = 1.29</p>
<p>I haven&#8217;t ever had a single server reach passed 300 megabit in traffic first off so that was a new lesson of capacity and threshold. Also when memcached states it is not CPU intensive they really mean it. The server started crapping out meaning not serving requests properly at 780+megabit, so amazingly enough memcached can handle quite a lot of traffic/requests. Our switch port was saturated prior to memcached failing.</p>
<p>So lesson learned BEWARE what you cache when you are using memcached you don&#8217;t want to see the stats I did&#8230; Hope this helps with giving the community a case study of memcached out in the wild.</p>
<p><a href="http://sharethis.com/item?&wp=2.5.1&amp;publisher=86160145-59ad-42e9-adbc-4404784454e2&amp;title=How+much+can+a+memcached+server+handle%3F&amp;url=http%3A%2F%2Fwww.philchen.com%2F2008%2F06%2F18%2Fhow-much-can-a-memcached-server-handle%2F">ShareThis</a></p><img src="http://feeds.feedburner.com/~r/phil_chen/~4/315168850" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.philchen.com/2008/06/18/how-much-can-a-memcached-server-handle/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.philchen.com/2008/06/18/how-much-can-a-memcached-server-handle/</feedburner:origLink></item>
		<item>
		<title>Effects on Performance &amp; Server Resources when using Apache 2.0 mod_status</title>
		<link>http://feeds.feedburner.com/~r/phil_chen/~3/302760314/</link>
		<comments>http://www.philchen.com/2008/06/02/apache-20-mod_status-effects-on-performance-server-resources/#comments</comments>
		<pubDate>Mon, 02 Jun 2008 06:04:56 +0000</pubDate>
		<dc:creator>phil</dc:creator>
		
		<category><![CDATA[Systems 101]]></category>

		<guid isPermaLink="false">http://www.philchen.com/2008/06/02/apache-20-mod_status-effects-on-performance-server-resources/</guid>
		<description><![CDATA[  I find the Apache mod_status module to be very helpful in respect to Apache server performance/usage monitoring and debugging. However I have read books and posts stating a performance hit when the module is enabled particularly with &#8220;ExtendedStatus On&#8221;, so what&#8217;s the real deal? I never hear what the impact is, in a real [...]<script type="text/javascript">SHARETHIS.addEntry({ title: "Effects on Performance &#038; Server Resources when using Apache 2.0 mod_status", url: "http://www.philchen.com/2008/06/02/apache-20-mod_status-effects-on-performance-server-resources/" });</script> ]]></description>
			<content:encoded><![CDATA[<p> I find the Apache mod_status module to be very helpful in respect to Apache server performance/usage monitoring and debugging. However I have read books and posts stating a performance hit when the module is enabled particularly with &#8220;ExtendedStatus On&#8221;, so what&#8217;s the real deal? I never hear what the impact is, in a real world setting.<br />
<span id="more-48"></span></p>
<p>Let&#8217;s outline the benefits first regarding the mod_status module and what it allows you to see (Documented on Apache&#8217;s Site):</p>
<p>1) Number of children serving requests<br />
2) Number of idle children<br />
3) Status of each child, the number of requests that child has performed and the total number of bytes served by child<br />
4) Total number of accesses and byte count served<br />
5) Time the server was started/restarted and the time it has been running for<br />
6) Averages giving the number of requests per second, the number of bytes served per second and the average number of bytes per request<br />
7) Current percentage CPU used by each child and in total by Apache<br />
8 ) Current hosts and requests being processed </p>
<p>*All which can be beautifully graphed using Cacti btw for historical analysis.</p>
<p>I find mod_status most useful for tuning settings when using a prefork configuration, balancing the server resources and application memory usage.</p>
<p>So the downfall of using mod_status is upon every request Apache will perform two calls to gettimeofday. These calls are done so that the status report contains timing information. The theory is that this information is taxing in retrieval and calculation.</p>
<p>So as a limited but real world test using a production server I administer, I discovered only a small impact with or without mod_status enabled.</p>
<p>The test was on a Dell 1950 Dual Core Intel Xeon 2.0 GHz 8 Gigs of RAM Linux with Apache 2.0</p>
<p>I considered server load decrease as the marker for success, in that I compiled Apache with and without mod_status and looked for differences in cpu usage, memory usage, and load stats. The Apache server in question received on average 18 requests per second, mostly API application calls through PHP. And the test lasted a week for each configuration.</p>
<p>I saw no differences even in the slightest in server memory, nor server cpu utilization. I did notice server load was on average .29 with mod_status in extended mode compiled, and average load was .20 without mod_status compiled. So a savings of .09 on average load for a server over the course of 1 week of testing with an average 18 requests per second was seen. Regarding actual http requests I saw no speed increase or decrease.</p>
<p>So my conclusion, is every little bit counts however if you find that you need to tune your Apache servers often given sporadic changes in usage, you may want to enable mod_status with extended status on and reap the benefits of graphing that data using a tool like Cacti for the greater good of tuning other aspects of Apache for a  more significant gain.</p>
<p><a href="http://sharethis.com/item?&wp=2.5.1&amp;publisher=86160145-59ad-42e9-adbc-4404784454e2&amp;title=Effects+on+Performance+%26%23038%3B+Server+Resources+when+using+Apache+2.0+mod_status&amp;url=http%3A%2F%2Fwww.philchen.com%2F2008%2F06%2F02%2Fapache-20-mod_status-effects-on-performance-server-resources%2F">ShareThis</a></p><img src="http://feeds.feedburner.com/~r/phil_chen/~4/302760314" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.philchen.com/2008/06/02/apache-20-mod_status-effects-on-performance-server-resources/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.philchen.com/2008/06/02/apache-20-mod_status-effects-on-performance-server-resources/</feedburner:origLink></item>
		<item>
		<title>Notify me someone is logging into my Linux server</title>
		<link>http://feeds.feedburner.com/~r/phil_chen/~3/289220319/</link>
		<comments>http://www.philchen.com/2008/05/13/notify-me-someone-is-logging-into-my-linux-server/#comments</comments>
		<pubDate>Tue, 13 May 2008 06:16:07 +0000</pubDate>
		<dc:creator>phil</dc:creator>
		
		<category><![CDATA[Systems 101]]></category>

		<guid isPermaLink="false">http://www.philchen.com/2008/05/13/notify-me-someone-is-logging-into-my-linux-server/</guid>
		<description><![CDATA[  If your like me you like to know who is logging into your servers, hopefully this blog entry will help. So the scenerio goes someone has logged into your server through means not legal or ethical at 4 AM and wants to do who knows what. It would be great to get a email [...]<script type="text/javascript">SHARETHIS.addEntry({ title: "Notify me someone is logging into my Linux server", url: "http://www.philchen.com/2008/05/13/notify-me-someone-is-logging-into-my-linux-server/" });</script> ]]></description>
			<content:encoded><![CDATA[<p> If your like me you like to know who is logging into your servers, hopefully this blog entry will help. So the scenerio goes someone has logged into your server through means not legal or ethical at 4 AM and wants to do who knows what. It would be great to get a email notification to your phone and wake up to take care of business. The script below should help:</p>
<p><span id="more-47"></span></p>
<p>mkdir /var/log/logins<br />
chown youruser:youruser /var/log/logins</p>
<p>Create the below script and place it some where permissions 755:</p>
<p>#!/bin/sh<br />
#<br />
#The Below Directory Path is where the script will keep track of logins<br />
BASE=/var/log/logins<br />
#<br />
# The two files below checked for a delta against each other<br />
HISTORY=${BASE}/history<br />
CURRENT=${BASE}/current<br />
#<br />
# Failure Function<br />
fail()<br />
{<br />
echo &#8220;Failed: $*&#8221;<br />
exit 1<br />
}<br />
#<br />
# Function to clean output from the last command<br />
clean_last()<br />
{<br />
/usr/bin/last | sed &#8216;{<br />
 /^reboot /d<br />
/^$/d<br />
/^wtmp begins /d<br />
}&#8217;<br />
}<br />
MYGROUP=`id -gn`<br />
MYIDENT=`id -un`<br />
#<br />
# Checking the env or error<br />
[ -d ${BASE} ] || mkdir -p ${BASE}<br />
[ -d ${BASE} ] || fail could not create ${BASE}<br />
[ -G ${BASE} ] || fail ${BASE} not owned by ${MYGROUP}<br />
[ -O ${BASE} ] || fail ${BASE} not owned by ${MYIDENT}<br />
#<br />
# Store current info<br />
clean_last >${CURRENT}<br />
# Is there a history file?<br />
if [ -f ${HISTORY} ]<br />
then<br />
#<br />
if ! `cmp &#8211;silent $CURRENT $HISTORY`<br />
then<br />
# Yes mail someone<br />
#<br />
diff $HISTORY $CURRENT |mail youremail@whatever.com -s &#8220;Login report&#8221;<br />
fi<br />
fi<br />
#<br />
# Make current history<br />
#<br />
mv ${CURRENT} ${HISTORY}<br />
[ $? -eq 0 ] || fail mv ${CURRENT} ${HISTORY}<br />
exit 0</p>
<p>#END OF SCRIPT</p>
<p>Create a crontab for your user to run the script:</p>
<p>*/5 * * * * /path/to/my/script/checklogin.sh</p>
<p>This should do it, gives a little more comfort, but I still recommend your typical safe guards IPTABLES, SNORT, etc&#8230; best practices.</p>
<p><a href="http://sharethis.com/item?&wp=2.5.1&amp;publisher=86160145-59ad-42e9-adbc-4404784454e2&amp;title=Notify+me+someone+is+logging+into+my+Linux+server&amp;url=http%3A%2F%2Fwww.philchen.com%2F2008%2F05%2F13%2Fnotify-me-someone-is-logging-into-my-linux-server%2F">ShareThis</a></p><img src="http://feeds.feedburner.com/~r/phil_chen/~4/289220319" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.philchen.com/2008/05/13/notify-me-someone-is-logging-into-my-linux-server/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.philchen.com/2008/05/13/notify-me-someone-is-logging-into-my-linux-server/</feedburner:origLink></item>
		<item>
		<title>How to use the PERL Blowfish Encryption Module with Padding Capabilities</title>
		<link>http://feeds.feedburner.com/~r/phil_chen/~3/148619700/</link>
		<comments>http://www.philchen.com/2007/08/26/how-to-use-a-perl-blowfish-encryption-module-with-padding/#comments</comments>
		<pubDate>Mon, 27 Aug 2007 03:07:54 +0000</pubDate>
		<dc:creator>phil</dc:creator>
		
		<category><![CDATA[Development 101]]></category>

		<guid isPermaLink="false">http://www.philchen.com/2007/08/26/how-to-use-a-perl-blowfish-encryption-module-with-padding/</guid>
		<description><![CDATA[  If you have a scenerio when encryption is necessary for your data, aÂ perl scriptÂ utilizing the Crypt::Blowfish module to get the job done may be your answer. The code is pretty straight foward however it has an additional padding section which helps you negotiate data not matching your designated encryption key size.

The first script encrypts [...]<script type="text/javascript">SHARETHIS.addEntry({ title: "How to use the PERL Blowfish Encryption Module with Padding Capabilities", url: "http://www.philchen.com/2007/08/26/how-to-use-a-perl-blowfish-encryption-module-with-padding/" });</script> ]]></description>
			<content:encoded><![CDATA[<p> If you have a scenerio when encryption is necessary for your data, aÂ perl scriptÂ utilizing the Crypt::Blowfish module to get the job done may be your answer. The code is pretty straight foward however it has an additional padding section which helps you negotiate data not matching your designated encryption key size.<br />
<span id="more-45"></span></p>
<p>The first script encrypts and pads data from a plaintext.txt file using Crypt::Blowfish into a ciphertext.txt file. The second script decrypts the cipher and writes it to a file.</p>
<p><strong>blowfish.pl<br />
</strong><br />
#!/usr/bin/perl<br />
use Crypt::Blowfish;<br />
$key = &#8216;12345678123456781234567812345678&#8242;;<br />
$cipher = Crypt::Blowfish-&gt;new($key);<br />
open (PLAINTEXT, &#8220;plaintext.txt&#8221;);<br />
while (read(PLAINTEXT, $block, 8)) {<br />
$lenÂ Â  = length $block;<br />
$size += $len;<br />
# Add padding if necessary<br />
$block .= &#8220;\000&#8243;x(8-$len) if $len &lt; 8;<br />
$ciphertext .= $cipher-&gt;encrypt($block);<br />
}<br />
# Record the size of the plaintext, so that the recipient knows how much padding to remove.<br />
open (CIPHERTEXT, &#8220;&gt;ciphertext.txt&#8221;);<br />
print CIPHERTEXT &#8220;$size\n&#8221;;<br />
print CIPHERTEXT $ciphertext;</p>
<p><strong>decryptblowfish.pl</p>
<p></strong>#!/usr/bin/perl<br />
use Crypt::Blowfish;<br />
$key = &#8216;12345678123456781234567812345678&#8242;;<br />
$cipher = Crypt::Blowfish-&gt;new($key);<br />
open (CIPHERTEXT, &#8220;ciphertext.txt&#8221;);<br />
$size = &lt;CIPHERTEXT&gt;;<br />
while (read(CIPHERTEXT, $ct, 8)) {<br />
$pt .= $cipher-&gt;decrypt($ct);<br />
Â }<br />
# Write only $size bytes of the output; ignore padding.<br />
open (PLAINTEXT, &#8220;&gt;decrypted.txt&#8221;);<br />
print PLAINTEXT substr($pt, 0, $size);</p>
<p><a href="http://sharethis.com/item?&wp=2.5.1&amp;publisher=86160145-59ad-42e9-adbc-4404784454e2&amp;title=How+to+use+the+PERL+Blowfish+Encryption+Module+with+Padding+Capabilities&amp;url=http%3A%2F%2Fwww.philchen.com%2F2007%2F08%2F26%2Fhow-to-use-a-perl-blowfish-encryption-module-with-padding%2F">ShareThis</a></p><img src="http://feeds.feedburner.com/~r/phil_chen/~4/148619700" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.philchen.com/2007/08/26/how-to-use-a-perl-blowfish-encryption-module-with-padding/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.philchen.com/2007/08/26/how-to-use-a-perl-blowfish-encryption-module-with-padding/</feedburner:origLink></item>
		<item>
		<title>Helpful BASH Shell Command Prompts</title>
		<link>http://feeds.feedburner.com/~r/phil_chen/~3/138381251/</link>
		<comments>http://www.philchen.com/2007/07/28/helpful-bash-shell-prompts/#comments</comments>
		<pubDate>Sat, 28 Jul 2007 23:57:30 +0000</pubDate>
		<dc:creator>phil</dc:creator>
		
		<category><![CDATA[Systems 101]]></category>

		<guid isPermaLink="false">http://www.philchen.com/2007/07/28/helpful-bash-shell-prompts/</guid>
		<description><![CDATA[  Here are some helpful tips on altering your BASH command prompt.Â InfoÂ in your command prompt can improve your work productivity and also prevent you from doing the wrong thing at the wrong place.Â 

Add one of the below entries into your .bashrc file
vi ~/.bashrc
then activate your changes by sourcing it
source Â ~/.bashrc
1) To display the username, short [...]<script type="text/javascript">SHARETHIS.addEntry({ title: "Helpful BASH Shell Command Prompts", url: "http://www.philchen.com/2007/07/28/helpful-bash-shell-prompts/" });</script> ]]></description>
			<content:encoded><![CDATA[<p> Here are some helpful tips on altering your BASH command prompt.Â InfoÂ in your command prompt can improve your work productivity and also prevent you from doing the wrong thing at the wrong place.Â <br />
<span id="more-43"></span><br />
<strong>Add one of the below entries into your .bashrc file</strong></p>
<p>vi ~/.bashrc</p>
<p><strong>then activate your changes by sourcing it</strong></p>
<p>source Â ~/.bashrc</p>
<p><strong>1) To display the username, short version ofÂ hostname, and the current working directoryÂ (light blue)</strong></p>
<p>export PS1=&#8217;\[\033[1;34m\][\u@\h:\w]\$\[\033[0m\]&#8216;</p>
<p><strong>Output:<br />
</strong><br />
[phil@server1:/usr/local/bin]$</p>
<p><strong>2) To display username, short version of hostname, date, time, and the current working directory</strong></p>
<p>export PS1=&#8217;[\u@\h \d \A] \w \$ &#8216;</p>
<p><strong>Output:</strong></p>
<p>[phil@server1 Sat Jul 28 15:44] /usr/local/lib $</p>
<p><strong>3) To display new line, username, short version hostname, base PTY, shell level, history number, new line, andÂ the current working directory</strong></p>
<p>export PS1=&#8217;\n[\u@\h \l:$SHLVL:\!]\n$PWD\$ &#8216;</p>
<p><strong>Output:<br />
</strong><br />
[phil@server1 0:1:123]<br />
/usr/local/bin$</p>
<p><strong>4) To display, username, short version hostname, number of jobs in the background a new line and working path</strong></p>
<p>export PS1=&#8217;\n[\u@\h jobs:\j]\n$PWD\$ &#8216;</p>
<p><strong>Output:</strong></p>
<p>[phil@server1 jobs:0]<br />
/usr/local/bin$</p>
<p><a href="http://sharethis.com/item?&wp=2.5.1&amp;publisher=86160145-59ad-42e9-adbc-4404784454e2&amp;title=Helpful+BASH+Shell+Command+Prompts&amp;url=http%3A%2F%2Fwww.philchen.com%2F2007%2F07%2F28%2Fhelpful-bash-shell-prompts%2F">ShareThis</a></p><img src="http://feeds.feedburner.com/~r/phil_chen/~4/138381251" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.philchen.com/2007/07/28/helpful-bash-shell-prompts/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.philchen.com/2007/07/28/helpful-bash-shell-prompts/</feedburner:origLink></item>
		<item>
		<title>How to Enable Passwordless Authentication with SSH</title>
		<link>http://feeds.feedburner.com/~r/phil_chen/~3/138377009/</link>
		<comments>http://www.philchen.com/2007/07/28/how-to-enable-passwordless-authentication-with-ssh/#comments</comments>
		<pubDate>Sat, 28 Jul 2007 22:12:51 +0000</pubDate>
		<dc:creator>phil</dc:creator>
		
		<category><![CDATA[Systems 101]]></category>

		<guid isPermaLink="false">http://www.philchen.com/2007/07/28/how-to-enable-passwordless-authentication-with-ssh/</guid>
		<description><![CDATA[  Often times you have automated scripts that require access to multiple machines from a single source and need to do so without having to deal with ssh password prompts. And in other instances you may have a bastian host (strong point) security model which you would like to have passwordless communication from. Below are [...]<script type="text/javascript">SHARETHIS.addEntry({ title: "How to Enable Passwordless Authentication with SSH", url: "http://www.philchen.com/2007/07/28/how-to-enable-passwordless-authentication-with-ssh/" });</script> ]]></description>
			<content:encoded><![CDATA[<p> Often times you have automated scripts that require access to multiple machines from a single source and need to do so without having to deal with ssh password prompts. And in other instances you may have a bastian host (strong point) security model which you would like to have passwordless communication from. Below are 10 steps to setting up passwordless authentication with SSH in Linux.<br />
<span id="more-42"></span><br />
<strong>Step 1:<br />
</strong>(*note server1 is the source server and server2 will be the destination server)</p>
<p>server1# mkdir ~/.ssh</p>
<p><strong>Step 2:</strong></p>
<p>server1# cd ~/.ssh</p>
<p><strong>Step 3:</strong></p>
<p>server1# ssh-keygen -t rsa</p>
<p><em>Generating public/private rsa key pair.<br />
Enter file in which to save the key (&#8221;your_local_home&#8221;/.ssh/id_rsa):<br />
Enter passphrase (empty for no passphrase):<br />
Enter same passphrase again:<br />
Your identification has been saved in id_rsa.<br />
Your public key has been saved in id_rsa.pub.<br />
The key fingerprint is:<br />
18:6a:e3:78:ab:2d:0c:8e:f9:67:f7:30:32:44:77:34 phil@server1</em></p>
<p><strong>Step 4:</strong></p>
<p>server1# scp ~/.ssh/id_rsa.pub phil@server2.philchen.com:/home/phil/id_rsa.server1.pub</p>
<p><strong>Step 5:</strong></p>
<p>server1# ssh phil@server2.philchen.com<br />
Password:</p>
<p><strong>Step 6:</strong></p>
<p>server2# mkdir .ssh</p>
<p><strong>Step 7:</strong></p>
<p>server2# chmod 700 .ssh</p>
<p><strong>Step 8:</strong></p>
<p>server2# cat id_rsa.server1.pub &gt;&gt; .ssh/authorized_keys</p>
<p><strong>Step 9:</strong></p>
<p>server2# chmod 644 .ssh/authorzied_keys</p>
<p><strong>Step 10:</strong></p>
<p>server2# exit<br />
server1# ssh phil@server2.philchen.com</p>
<p>*Note repeat steps 4-10 for all target servers you would like passwordless access from server1</p>
<p>* FYI Ensure your /home/user directory has the permission 755 also!</p>
<p>You should be all set!</p>
<p><a href="http://sharethis.com/item?&wp=2.5.1&amp;publisher=86160145-59ad-42e9-adbc-4404784454e2&amp;title=How+to+Enable+Passwordless+Authentication+with+SSH&amp;url=http%3A%2F%2Fwww.philchen.com%2F2007%2F07%2F28%2Fhow-to-enable-passwordless-authentication-with-ssh%2F">ShareThis</a></p><img src="http://feeds.feedburner.com/~r/phil_chen/~4/138377009" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.philchen.com/2007/07/28/how-to-enable-passwordless-authentication-with-ssh/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.philchen.com/2007/07/28/how-to-enable-passwordless-authentication-with-ssh/</feedburner:origLink></item>
		<item>
		<title>Configuring MCrypt Support For Mod_PHP</title>
		<link>http://feeds.feedburner.com/~r/phil_chen/~3/124008314/</link>
		<comments>http://www.philchen.com/2007/06/11/configuring-mcrypt-support-for-mod_php/#comments</comments>
		<pubDate>Mon, 11 Jun 2007 19:48:43 +0000</pubDate>
		<dc:creator>phil</dc:creator>
		
		<category><![CDATA[Systems 101]]></category>

		<guid isPermaLink="false">http://www.philchen.com/2007/06/11/configuring-mcrypt-support-for-mod_php/</guid>
		<description><![CDATA[  MCrypt is a replacement for older crypt() package and crypt(1) command with extensions. It allows developers encryption functions, specifically allowing users to encrypt files or data streams.
Configuring MCrypt support for Mod_PHP can be a pain so hopefully this article will help!

The below was tested on a Centos  4.4  64 Bit server.
Package Dependencies:

libmcrypt-2.5.8.tar.gz
mhash-0.9.9
mcrypt-2.6.4
php-5.2.1.tar.gz
Installation [...]<script type="text/javascript">SHARETHIS.addEntry({ title: "Configuring MCrypt Support For Mod_PHP", url: "http://www.philchen.com/2007/06/11/configuring-mcrypt-support-for-mod_php/" });</script> ]]></description>
			<content:encoded><![CDATA[<p> MCrypt is a replacement for older crypt() package and crypt(1) command with extensions. It allows developers encryption functions, specifically allowing users to encrypt files or data streams.</p>
<p>Configuring MCrypt support for Mod_PHP can be a pain so hopefully this article will help!<br />
<span id="more-41"></span><br />
The below was tested on a Centos  4.4  64 Bit server.</p>
<p><strong>Package Dependencies:<br />
</strong><br />
libmcrypt-2.5.8.tar.gz<br />
mhash-0.9.9<br />
mcrypt-2.6.4<br />
php-5.2.1.tar.gz</p>
<p><strong>Installation Notes:</strong></p>
<p><strong>libmcrypt:<br />
</strong><br />
gunzip -c libmcrypt-2.5.8.tar.gz | tar xf -<br />
cd libmcrypt-xxx<br />
./configure &#8211;disable-posix-threads<br />
make<br />
make check  (note:  &#8216;make check&#8217; is optional)<br />
make install<br />
added /usr/local/lib to ld.so.conf<br />
ldconfig or LD_LIBRARY_PATH=/usr/local/lib<br />
(Below is important)<br />
cd libmcrypt-2.5.8/libltdl<br />
./configure &#8211;enable-ltdl-install<br />
make<br />
make install</p>
<p><strong>mhash:<br />
</strong><br />
ldconfig<br />
gunzip -c mhash-0.9.9.tar.gz | tar xf -<br />
cd mhash-xxx<br />
./configure<br />
make<br />
make check   (note:  &#8216;make check&#8217; is optional)<br />
make install</p>
<p><strong>mcrypt:<br />
</strong><br />
ldconfig<br />
gunzip -c mcrypt-2.6.4.tar.gz | tar xf -<br />
cd mcrypt<br />
./configure<br />
make<br />
make check   (note:  &#8216;make check&#8217; is optional)<br />
make install</p>
<p><strong>PHP:<br />
</strong><br />
gunzip -c php-5.2.1.tar.gz | tar xf -<br />
./configure &#8211;with-apxs2=/usr/sbin/apxs  &#8211;with-jpeg-dir=lib64<br />
&#8211;BLAH &#8211;BLAH &#8211;BLAH &#8211;with-mcrypt=/path/to/mcrypt-2.6.4<br />
(*NOTE the path of &#8211;with-mcrypt= install directory source code)<br />
make<br />
make install</p>
<p>This should get you up and running to use mcrypt!</p>
<p><a href="http://sharethis.com/item?&wp=2.5.1&amp;publisher=86160145-59ad-42e9-adbc-4404784454e2&amp;title=Configuring+MCrypt+Support+For+Mod_PHP&amp;url=http%3A%2F%2Fwww.philchen.com%2F2007%2F06%2F11%2Fconfiguring-mcrypt-support-for-mod_php%2F">ShareThis</a></p><img src="http://feeds.feedburner.com/~r/phil_chen/~4/124008314" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.philchen.com/2007/06/11/configuring-mcrypt-support-for-mod_php/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.philchen.com/2007/06/11/configuring-mcrypt-support-for-mod_php/</feedburner:origLink></item>
		<item>
		<title>Quick and Dirty How To Write an Init Script</title>
		<link>http://feeds.feedburner.com/~r/phil_chen/~3/122186507/</link>
		<comments>http://www.philchen.com/2007/06/04/quick-and-dirty-how-to-write-and-init-script/#comments</comments>
		<pubDate>Mon, 04 Jun 2007 23:44:35 +0000</pubDate>
		<dc:creator>phil</dc:creator>
		
		<category><![CDATA[Systems 101]]></category>

		<guid isPermaLink="false">http://www.philchen.com/2007/06/04/quick-and-dirty-how-to-write-and-init-script/</guid>
		<description><![CDATA[  Often times you may have an application that needs to be boot strapped or started automatically via an Init script. Below is a quick and dirty sample Init script to help you get on your way. Also the the article will cover chkconfig options to start the script at the correct run level.

The script [...]<script type="text/javascript">SHARETHIS.addEntry({ title: "Quick and Dirty How To Write an Init Script", url: "http://www.philchen.com/2007/06/04/quick-and-dirty-how-to-write-and-init-script/" });</script> ]]></description>
			<content:encoded><![CDATA[<p> Often times you may have an application that needs to be boot strapped or started automatically via an Init script. Below is a quick and dirty sample Init script to help you get on your way. Also the the article will cover chkconfig options to start the script at the correct run level.<br />
<span id="more-40"></span><br />
The script will reside in /etc/init.d/BLAH</p>
<p>########################################################<br />
#!/bin/sh<br />
# SAMPLE BASIC INIT SCRIPT<br />
#<br />
# Below is the chkconfig syntax for auto startup at different run levels<br />
# Note runlevel 1 2 and 3, 69 is the Start order and 68 is the Stop order<br />
# Make sure these are unique by looking into /etc/rc.d/*<br />
# Also below is the description which is necessary.<br />
#<br />
# chkconfig: 123 69 68<br />
# description: Description of the Service<br />
#<br />
# Below is the source function library<br />
#<br />
. /etc/init.d/functions<br />
#<br />
if [ -f /etc/sysconfig/BLAH ]; then<br />
. /etc/sysconfig/BLAH<br />
fi<br />
#<br />
# Below is the Script Goodness controlling the service<br />
#<br />
case &#8220;$1&#8243; in<br />
start)<br />
echo -n &#8220;Start service BLAH&#8221;<br />
/usr/sbin/BLAH start<br />
;;<br />
stop)<br />
echo -n &#8220;Stop service BLAH&#8221;<br />
/usr/sbin/BLAH stop<br />
;;<br />
restart)<br />
echo -n &#8220;Restart service BLAH&#8221;<br />
/usr/sbin/BLAH restart<br />
;;<br />
*)<br />
echo &#8220;Usage: $0 {start|stop|restart}&#8221;<br />
exit 1<br />
;;<br />
esac<br />
######################################################</p>
<p>Now to run chkconfig commands:</p>
<p>bash-3.00$ chkconfig BLAH &#8211;add</p>
<p>bash-3.00$ chkconfig BLAH on</p>
<p>The above will read the Init script and add and enable the script at the proper run level<br />
specified in the script. Appending the start command on boot.</p>
<p>You could also do the below to be more specific in which run level to enable:</p>
<p>bash-3.00$  chkconfig &#8211;level 123 BLAH on (to turn on at run level 1 2 3)</p>
<p>or</p>
<p>bash-3.00$ chkconfig &#8211;level 123 BLAH off (to turn off at run level 1 2 3)</p>
<p>To list all run:</p>
<p>bash-3.00$ chkconfig &#8211;list</p>
<p>This should be a quick and dirty to get you going.</p>
<p><a href="http://sharethis.com/item?&wp=2.5.1&amp;publisher=86160145-59ad-42e9-adbc-4404784454e2&amp;title=Quick+and+Dirty+How+To+Write+an+Init+Script&amp;url=http%3A%2F%2Fwww.philchen.com%2F2007%2F06%2F04%2Fquick-and-dirty-how-to-write-and-init-script%2F">ShareThis</a></p><img src="http://feeds.feedburner.com/~r/phil_chen/~4/122186507" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.philchen.com/2007/06/04/quick-and-dirty-how-to-write-and-init-script/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.philchen.com/2007/06/04/quick-and-dirty-how-to-write-and-init-script/</feedburner:origLink></item>
		<item>
		<title>String Substitution in PERL vs SED Removing Disk I/O Factor</title>
		<link>http://feeds.feedburner.com/~r/phil_chen/~3/120358633/</link>
		<comments>http://www.philchen.com/2007/05/28/string-substitution-in-perl-vs-sed-removing-disk-io-factor/#comments</comments>
		<pubDate>Mon, 28 May 2007 22:59:25 +0000</pubDate>
		<dc:creator>phil</dc:creator>
		
		<category><![CDATA[Systems 101]]></category>

		<guid isPermaLink="false">http://www.philchen.com/2007/05/28/string-substitution-in-perl-vs-sed-removing-disk-io-factor/</guid>
		<description><![CDATA[  A lot ofÂ systems administrators will use SED for string substitution, when they should try using PERL. When doing string substitutions with SEDÂ the string substitutions write to a seperate file, then the file is copied over the target file. ThisÂ second file that is createdÂ utilizes Disk I/O, another issueÂ you can run into are file permissionsÂ if your [...]<script type="text/javascript">SHARETHIS.addEntry({ title: "String Substitution in PERL vs SED Removing Disk I/O Factor", url: "http://www.philchen.com/2007/05/28/string-substitution-in-perl-vs-sed-removing-disk-io-factor/" });</script> ]]></description>
			<content:encoded><![CDATA[<p> A lot ofÂ systems administrators will use SED for string substitution, when they should try using PERL. When doing string substitutions with SEDÂ the string substitutions write to a seperate file, then the file is copied over the target file. ThisÂ second file that is createdÂ utilizes Disk I/O, another issueÂ you can run into are file permissionsÂ if your umask doesn&#8217;t match the permissions of the target file. With PERL you do not have any of these issues since its effects are directly onto the target file with no usage of secondary files therefore not Disk I/O.<br />
<span id="more-34"></span></p>
<p>To run string substitution globally to the target file you can do the following:</p>
<p>perl -pi -e &#8217;s{original string}{replacement string}g&#8217; targetfile</p>
<p>To run string substitution globally to the multiple files in the directory you can do the following:</p>
<p>perl -pi -e &#8217;s{original string}{replacement string}g&#8217; *</p>
<p><a href="http://sharethis.com/item?&wp=2.5.1&amp;publisher=86160145-59ad-42e9-adbc-4404784454e2&amp;title=String+Substitution+in+PERL+vs+SED+Removing+Disk+I%2FO+Factor&amp;url=http%3A%2F%2Fwww.philchen.com%2F2007%2F05%2F28%2Fstring-substitution-in-perl-vs-sed-removing-disk-io-factor%2F">ShareThis</a></p><img src="http://feeds.feedburner.com/~r/phil_chen/~4/120358633" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.philchen.com/2007/05/28/string-substitution-in-perl-vs-sed-removing-disk-io-factor/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.philchen.com/2007/05/28/string-substitution-in-perl-vs-sed-removing-disk-io-factor/</feedburner:origLink></item>
		<item>
		<title>Using VI To Edit Two Files In A Split Screen</title>
		<link>http://feeds.feedburner.com/~r/phil_chen/~3/108923658/</link>
		<comments>http://www.philchen.com/2007/04/13/using-vi-to-edit-two-files-in-a-split-screen/#comments</comments>
		<pubDate>Sat, 14 Apr 2007 00:27:56 +0000</pubDate>
		<dc:creator>phil</dc:creator>
		
		<category><![CDATA[Systems 101]]></category>

		<guid isPermaLink="false">http://www.philchen.com/2007/04/13/using-vi-to-edit-two-files-in-a-split-screen/</guid>
		<description><![CDATA[  Sometimes you need to edit a new or existing file while looking at a separate file using VI. This can be very useful and a powerful time saver. Fortunately you can do this using some simple commands.

First go ahead and edit a file with   VI
shellprompt$ vi test-1.txt
while in VI  enter the [...]<script type="text/javascript">SHARETHIS.addEntry({ title: "Using VI To Edit Two Files In A Split Screen", url: "http://www.philchen.com/2007/04/13/using-vi-to-edit-two-files-in-a-split-screen/" });</script> ]]></description>
			<content:encoded><![CDATA[<p> Sometimes you need to edit a new or existing file while looking at a separate file using VI. This can be very useful and a powerful time saver. Fortunately you can do this using some simple commands.<br />
<span id="more-32"></span><br />
First go ahead and edit a file with   VI</p>
<p>shellprompt$ vi test-1.txt</p>
<p>while in VI  enter the following</p>
<p>:new</p>
<p>This will open a new split screen session, in order to navigate between the two windows in VI do the following</p>
<p>&lt;ctrl-w&gt;<br />
j</p>
<p>Or</p>
<p>&lt;ctrl-w&gt;<br />
k</p>
<p>Using the first will move you to the lower window and using the latter will move you to the upper window.</p>
<p>To make one of the windows full screen and out of the dual screen mode use the following</p>
<p>:only</p>
<p>*Important Side Notes</p>
<p>If you used :new and opened up a new window session it will not have a name so you cannot save it without entering the following</p>
<p>:wq whatevername.txt</p>
<p>Also if you want to open a file in split screen mode that is not new and exists you can enter the following</p>
<p>:new /path/to/whateverfile</p>
<p>Happy Editing!</p>
<p><a href="http://sharethis.com/item?&wp=2.5.1&amp;publisher=86160145-59ad-42e9-adbc-4404784454e2&amp;title=Using+VI+To+Edit+Two+Files+In+A+Split+Screen&amp;url=http%3A%2F%2Fwww.philchen.com%2F2007%2F04%2F13%2Fusing-vi-to-edit-two-files-in-a-split-screen%2F">ShareThis</a></p><img src="http://feeds.feedburner.com/~r/phil_chen/~4/108923658" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.philchen.com/2007/04/13/using-vi-to-edit-two-files-in-a-split-screen/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.philchen.com/2007/04/13/using-vi-to-edit-two-files-in-a-split-screen/</feedburner:origLink></item>
	</channel>
</rss>
