<?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>*.hosting &#187; Uncategorized</title>
	<atom:link href="http://www.stardothosting.com/blog/category/uncategorized/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.stardothosting.com/blog</link>
	<description>Star Dot Hosting : Technology, Security, Virtualization and Cloud Computing</description>
	<lastBuildDate>Wed, 16 May 2012 19:07:40 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Relay Exim mail to google mail in Debian Linux</title>
		<link>http://www.stardothosting.com/blog/2010/05/25/relay-exim-mail-to-google-mail-in-debian-linux/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=relay-exim-mail-to-google-mail-in-debian-linux</link>
		<comments>http://www.stardothosting.com/blog/2010/05/25/relay-exim-mail-to-google-mail-in-debian-linux/#comments</comments>
		<pubDate>Tue, 25 May 2010 20:23:28 +0000</pubDate>
		<dc:creator>Kevin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[exim]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mail administration]]></category>
		<category><![CDATA[systems administration]]></category>

		<guid isPermaLink="false">http://blog.stardothosting.com/?p=332</guid>
		<description><![CDATA[Sometimes its necessary to relay your mail through a third party provider. If your server environment has a dedicated sendmail server (most do), then this scenario is applicable to you. It is ideal to centralize your outgoing mail to one server so that changes, policies and configuration is located in a single place. In this [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2010%2F05%2F25%2Frelay-exim-mail-to-google-mail-in-debian-linux%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2010%2F05%2F25%2Frelay-exim-mail-to-google-mail-in-debian-linux%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Sometimes its necessary to relay your mail through a third party provider. If your server environment has a dedicated sendmail server (most do), then this scenario is applicable to you. It is ideal to centralize your outgoing mail to one server so that changes, policies and configuration is located in a single place.</p>
<p>In this scenario, outgoing mail is relayed to google&#8217;s domain mail in an Exim mail environment. These steps are fairly straightforward and will hopefully help you to utilize google&#8217;s free mail service to send your mail. </p>
<p>Note that google has queuing and mass mail restrictions so if you plan on sending alot of mail this way, you will just get blocked.</p>
<p><strong>
<ul>
<big>Step 1</ul>
<p></strong></big></p>
<p>Run dpkg-reconfigure exim4-config</p>
<p>1. Choose mail sent by smarthost; received via SMTP or fetchmail</p>
<p>2. Type System Mail Name: e.g. company.com</p>
<p>3. Type IP Adresses to listen on for incoming SMTP connections: 127.0.0.1</p>
<p>4. Leave Other destinations for which mail is accepted blank</p>
<p>5. Leave Machines to relay mail for: blank</p>
<p>6. Type Machine handling outgoing mail for this host (smarthost): smtp.gmail.com::587</p>
<p>7. Choose NO, don’t hide local mail name in outgoing mail.</p>
<p>8. Chose NO, don’t keep number of DNS-queries minimal (Dial-on-Demand).</p>
<p>9. Choose mbox</p>
<p>10. Choose NO, split configuration into small files</p>
<p>11. Mail for postmaster. Leaving blank will not cause any problems though it is not recommended</p>
<ul>
<strong><big>Step 2</big></strong></ul>
<p>1. Open the file /etc/exim4/exim4.conf.template<br />
2. Find the line .ifdef DCconfig_smarthost DCconfig_satellite and add the following in that section</p>
<pre>
 send_via_gmail:
 driver = manualroute
 domains = ! +local_domains
 transport = gmail_smtp
 route_list = * smtp.gmail.com
</pre>
<p>If you have any other smarthost defined with “domains = ! +local_domains” remove that smarthost.</p>
<p>3. Find the “begin authenticators”. In that section add the following</p>
<pre>
 gmail_login:
 driver = plaintext
 public_name = LOGIN
 client_send = : yourname@gmail.com : YourGmailPassword
</pre>
<p>Make sure you have no other authenticators with the same public_name (LOGIN). Comment them out if needed (Thanks Jakub for reminding me) </p>
<p>4. Find the comment  “transport/30_exim4-config_remote_smtp_smarthost”. In that section add</p>
<pre>
 gmail_smtp:
 driver = smtp
 port = 587
 hosts_require_auth = $host_address
 hosts_require_tls = $host_address
</pre>
<ul>
<strong><big>Step 3</big></strong></ul>
<p>1. Run update-exim4.conf</p>
<p>2. Do /etc/init.d/exim4 restart</p>
<p>That should be it. You can test by using the command line mail client.</p>
<p>Test :</p>
<pre>
 echo "test" | mail -s "subject" test@email-to-send-to.com
</pre>
<p><a class="a2a_button_digg" href="http://www.addtoany.com/add_to/digg?linkurl=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2010%2F05%2F25%2Frelay-exim-mail-to-google-mail-in-debian-linux%2F&amp;linkname=Relay%20Exim%20mail%20to%20google%20mail%20in%20Debian%20Linux" title="Digg" rel="nofollow" target="_blank"><img src="http://www.stardothosting.com/blog/wp-content/plugins/add-to-any/icons/digg.png" width="16" height="16" alt="Digg"/></a><a class="a2a_button_twitter" href="http://www.addtoany.com/add_to/twitter?linkurl=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2010%2F05%2F25%2Frelay-exim-mail-to-google-mail-in-debian-linux%2F&amp;linkname=Relay%20Exim%20mail%20to%20google%20mail%20in%20Debian%20Linux" title="Twitter" rel="nofollow" target="_blank"><img src="http://www.stardothosting.com/blog/wp-content/plugins/add-to-any/icons/twitter.png" width="16" height="16" alt="Twitter"/></a><a class="a2a_button_reddit" href="http://www.addtoany.com/add_to/reddit?linkurl=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2010%2F05%2F25%2Frelay-exim-mail-to-google-mail-in-debian-linux%2F&amp;linkname=Relay%20Exim%20mail%20to%20google%20mail%20in%20Debian%20Linux" title="Reddit" rel="nofollow" target="_blank"><img src="http://www.stardothosting.com/blog/wp-content/plugins/add-to-any/icons/reddit.png" width="16" height="16" alt="Reddit"/></a><a class="a2a_button_delicious" href="http://www.addtoany.com/add_to/delicious?linkurl=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2010%2F05%2F25%2Frelay-exim-mail-to-google-mail-in-debian-linux%2F&amp;linkname=Relay%20Exim%20mail%20to%20google%20mail%20in%20Debian%20Linux" title="Delicious" rel="nofollow" target="_blank"><img src="http://www.stardothosting.com/blog/wp-content/plugins/add-to-any/icons/delicious.png" width="16" height="16" alt="Delicious"/></a><a class="a2a_button_google_plusone addtoany_special_service" data-annotation="none" data-href="http://www.stardothosting.com/blog/2010/05/25/relay-exim-mail-to-google-mail-in-debian-linux/"></a><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2010%2F05%2F25%2Frelay-exim-mail-to-google-mail-in-debian-linux%2F&amp;title=Relay%20Exim%20mail%20to%20google%20mail%20in%20Debian%20Linux" id="wpa2a_2"><img src="http://www.stardothosting.com/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.stardothosting.com/blog/2010/05/25/relay-exim-mail-to-google-mail-in-debian-linux/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>SSH Key based authentication</title>
		<link>http://www.stardothosting.com/blog/2009/06/02/ssh-key-based-authentication/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=ssh-key-based-authentication</link>
		<comments>http://www.stardothosting.com/blog/2009/06/02/ssh-key-based-authentication/#comments</comments>
		<pubDate>Wed, 03 Jun 2009 00:04:22 +0000</pubDate>
		<dc:creator>Kevin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[authentication]]></category>
		<category><![CDATA[automation]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://blog.stardothosting.com/?p=146</guid>
		<description><![CDATA[Administering a large number of servers is never easy. Sometimes it's necessary to streamline many "menial" tasks across the board. This is especially true when performing simple audits across all your <a href="http://www.linux.org" target="_new">linux</a> and <a href="http://www.freebsd.org" target="_new">unix</a> based <a href="http://www.ibm.com/systems/x/" target="_new">servers</a>. ]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2009%2F06%2F02%2Fssh-key-based-authentication%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2009%2F06%2F02%2Fssh-key-based-authentication%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Administering a large number of servers is never easy. Sometimes it&#8217;s necessary to streamline many &#8220;menial&#8221; tasks across the board. This is especially true when performing simple audits across all your <a href="http://www.linux.org" target="_new">linux</a> and <a href="http://www.freebsd.org" target="_new">unix</a> based <a href="http://www.ibm.com/systems/x/" target="_new">servers</a>. </p>
<p>What makes this process seamless and efficient is to implement <a href="http://www.openssh.com/" target="_new">ssh key authentication</a> to replace <a href="http://www.openldap.org/" target="_new">password based authentication</a>.</p>
<p>When implemented, commands can be executed via <a href="http://tldp.org/LDP/abs/html/" target="_new">scripts</a> in order to execute and gather all the information that&#8217;s required in order to complete your task.</p>
<p>Sound easy? It is!</p>
<p><big><u><b>Public Key Setup</b></u></big></p>
<p>First, confirm that OpenSSH is the SSH software installed on the client system. Key generation may vary under different implementations of SSH. The ssh -V command should print a line beginning with OpenSSH, followed by other details.</p>
<pre>
$ ssh -V
OpenSSH_3.6.1p1+CAN-2003-0693, SSH protocols 1.5/2.0, OpenSSL 0x0090702f
</pre>
<p><big><b><u>Key Generation</big></u></b></p>
<p>A RSA key pair must be generated on the client system. The public portion of this key pair will reside on the servers being connected to, while the private portion needs to remain on a secure local area of the client system, by default in ~/.ssh/id_rsa. The key generation can be done with the ssh-keygen(1) utility.</p>
<pre>
client$ mkdir ~/.ssh
client$ chmod 700 ~/.ssh
client$ ssh-keygen -q -f ~/.ssh/id_rsa -t rsa
Enter passphrase (empty for no passphrase): …
Enter same passphrase again: …
</pre>
<p>Depending on your work environment and the security policies and procedures, you may want to enter a passphrase. This effectively defeats the purpose of this, however. Entering an empty passphrase will allow you to complete a seamless connection.</p>
<p>The file permissions should be locked down to prevent other users from being able to read the key pair data. OpenSSH may also refuse to support public key authentication if the file permissions are too open. These fixes should be done on all systems involved.</p>
<pre>
$ chmod go-w ~/
$ chmod 700 ~/.ssh
$ chmod go-rwx ~/.ssh/*
</pre>
<p><big><b><u>Key Distribution</b></big></u></p>
<p>The public portion of the RSA key pair must be copied to any servers that will be accessed by the client. The public key information to be copied should be located in the ~/.ssh/id_rsa.pub file on the client. Assuming that all of the servers use OpenSSH instead of a different SSH implementation, the public key data must be appended into the ~/.ssh/authorized_keys file on the servers.</p>
<p>first, upload public key from client to server:</p>
<pre>
client$ scp ~/.ssh/id_rsa.pub server.example.org:
</pre>
<p>next, setup the public key on server:</p>
<pre>
server$ mkdir ~/.ssh
server$ chmod 700 ~/.ssh
server$ cat ~/id_rsa.pub >> ~/.ssh/authorized_keys
server$ chmod 600 ~/.ssh/authorized_keys
server$ rm ~/id_rsa.pub
</pre>
<p>Be sure to append new public key data to the authorized_keys file, as multiple public keys may be in use. Each public key entry must be on a different line.</p>
<p>Many different things can prevent public key authentication from working, so be sure to confirm that public key connections to the server work properly. If the following test fails, consult the debugging notes.</p>
<pre>
client$ ssh -o PreferredAuthentications=publickey server.example.org
Enter passphrase for key '/…/.ssh/id_rsa': …
…
server$
</pre>
<p>Key distribution can be automated with module:authkey and CFEngine. This script maps public keys stored in a filesystem repository to specific accounts on various classes of systems, allowing a user key to be replicated to all systems the user has access to.</p>
<p>If exporting the public key to a different group or company, consider removing or changing the optional public key comment field to avoid exposing the default username and hostname. </p>
<p>Easy!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stardothosting.com/blog/2009/06/02/ssh-key-based-authentication/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>How to setup a slave DNS Nameserver with Bind</title>
		<link>http://www.stardothosting.com/blog/2009/05/05/how-to-setup-a-slave-dns-nameserver-with-bind/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=how-to-setup-a-slave-dns-nameserver-with-bind</link>
		<comments>http://www.stardothosting.com/blog/2009/05/05/how-to-setup-a-slave-dns-nameserver-with-bind/#comments</comments>
		<pubDate>Tue, 05 May 2009 20:00:09 +0000</pubDate>
		<dc:creator>Kevin</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[automation]]></category>
		<category><![CDATA[bind]]></category>
		<category><![CDATA[dns]]></category>
		<category><![CDATA[scripting]]></category>
		<category><![CDATA[slave]]></category>

		<guid isPermaLink="false">http://blog.stardothosting.com/?p=98</guid>
		<description><![CDATA[This need for a DNS master/slave implementation where new zone files are transferred between the master nameserver and the slave became apparent as operations grew and geographic DNS redundancy became apparent.]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2009%2F05%2F05%2Fhow-to-setup-a-slave-dns-nameserver-with-bind%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2009%2F05%2F05%2Fhow-to-setup-a-slave-dns-nameserver-with-bind%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>When implementing redundancy as far as <a href="http://en.wikipedia.org/wiki/BIND" target="_new">DNS</a> is concerned, automated is always better. In a <a href="http://www.stardothosting.com/linux-vps-hosting" target="_new">hosting environment</a>, new <a href="http://en.wikipedia.org/wiki/Zone_file" target="_new">zone files</a> are constantly being created.</p>
<p>This need for a DNS <a href="http://tldp.org/HOWTO/DNS-HOWTO.html" target="_new">master</a>/<a href="http://www.zytrax.com/books/dns/ch4/" target="_new">slave</a> implementation where new zone files are transferred between the master nameserver and the slave became apparent as operations grew and geographic DNS redundancy became apparent.</p>
<p>Obviously some <a href="http://www.powerdns.com/" target="_new">commercial dns products</a> provide this type of functionality out-of-the-box, but I will show you how to do this with a simple <A href="http://www.isc.org/products/BIND" target="_new">Bind DNS</a> distribution.</p>
<p>I wrote this tutorial to help you, hopefully, to create an automated DNS slave / zone file transfer environment. Obviously you can create as many slave servers as you feel necessary.</p>
<p><big><strong><u>MASTER Server</big></strong></u></p>
<p>1. Edit /etc/named.conf and add the following to the options section where xx.xx.xx.xx is the ip of your slave server.:</p>
<p><strong></p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">allow-transfer { xx.xx.xx.xx; };</div></div>
<p></strong></p>
<p>2. Create a script with the following, where <strong>somedirectory</strong> is the directory on your SLAVE server to store the slave zones and where <strong>yy.yy.yy.yy</strong> is your MASTER server ip and <strong>somewwwdir</strong> is a directory browsable via http and finally <strong>someslavefile.conf</strong> is the output file to write you slave config:</p>
<p><strong></p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">#!/bin/sh<br />
#<br />
for domain in `/bin/grep ^zone /etc/named.conf |/bin/grep &quot;type master&quot; |/bin/awk '{print $2}' |/bin/awk -F\&quot; '{print $2}'`<br />
<br />
do<br />
<br />
/usr/bin/printf &quot;zone \&quot;${domain}\&quot; { type slave; file \&quot;/var/named/slaves/somedirectory/${domain}.db\&quot;; masters { yy.yy.yy.yy; }; };\n&quot;<br />
<br />
done &gt; /var/www/html/somewwwdir/someslavefile.conf</div></div>
<p></strong></p>
<p>3. Test the script to ensure it is writing out the appropriate format.</p>
<p>4. Run the script as any user with permission to write to an http visible directory via cron.</p>
<p><strong></p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">0 4 * * * /path/to/script &gt; /dev/null 2&gt;&amp;1</div></div>
<p></strong></p>
<p><big><strong><u>SLAVE SERVER</big></strong></u></p>
<p>1. Transfer the rndc.key file from your master server to the slave :</p>
<p><strong></p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">scp MASTERSERVER:/etc/rndc.key /etc/ns1rndc.key</div></div>
<p></strong></p>
<p>2. Edit ns1rndc.key and change the name of the key definition. </p>
<p>3. Edit named.conf and add the following to the options section:</p>
<p><strong></p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">allow-transfer { zz.zz.zz.zz; };</div></div>
<p></strong></p>
<p>4. Append the following to the named.conf file:<br />
<strong></p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">include &quot;/etc/ns1rndc.key&quot;;<br />
include &quot;/path/to/someslavefile.conf&quot;;</div></div>
<p></strong></p>
<p>5. Run the following commands</p>
<p><strong></p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">touch /path/to/someslavefile.conf<br />
mkdir /var/named/slaves/somedirectory/<br />
chown -R named:named /var/named/slaves/somedirectory/<br />
/etc/init.d/named restart</div></div>
<p></strong></p>
<p>6. Create a script:</p>
<p><strong></p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">#!/bin/sh<br />
/usr/bin/wget http://yy.yy.yy.yy/somewwwdir/someslavefile.conf &nbsp;-O /var/named/slaves/someslavefile.conf<br />
/etc/init.d/named restart</div></div>
<p></strong></p>
<p>7. Add to root&#8217;s crontab </p>
<p><strong></p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">0 4 * * * /path/to/script</div></div>
<p></strong></p>
<p>In the second slave script, you see that the transfer is done via wget. This can be replaced by many other more secure methods. If ssh based key authentication is employed, a simple scp or even rsync can be utilized to accomplish the actual zone transfer.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stardothosting.com/blog/2009/05/05/how-to-setup-a-slave-dns-nameserver-with-bind/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Quick tips using FIND , SSH, TAR , PS and GREP Commands</title>
		<link>http://www.stardothosting.com/blog/2009/05/04/quick-tips-using-find-ssh-tar-ps-and-grep-commands/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=quick-tips-using-find-ssh-tar-ps-and-grep-commands</link>
		<comments>http://www.stardothosting.com/blog/2009/05/04/quick-tips-using-find-ssh-tar-ps-and-grep-commands/#comments</comments>
		<pubDate>Mon, 04 May 2009 18:44:49 +0000</pubDate>
		<dc:creator>Kevin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[automation]]></category>
		<category><![CDATA[find]]></category>
		<category><![CDATA[grep]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[ps]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[systems administration]]></category>
		<category><![CDATA[tar]]></category>

		<guid isPermaLink="false">http://blog.stardothosting.com/?p=90</guid>
		<description><![CDATA[Administering hundreds of systems can be tedious. Sometimes scripting repetitive tasks, or replicating tasks across many servers is necessary. ]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2009%2F05%2F04%2Fquick-tips-using-find-ssh-tar-ps-and-grep-commands%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2009%2F05%2F04%2Fquick-tips-using-find-ssh-tar-ps-and-grep-commands%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Administering hundreds of systems can be tedious. Sometimes <a href="http://tldp.org/LDP/abs/html/" target="_new">scripting repetitive tasks</a>, or replicating tasks across many servers is necessary. </p>
<p>Over time, I&#8217;ve jotted down several quick useful notes regarding using various <a href="http://www.linux.org" target="_new">linux</a>/<a href="http://www.freebsd.org" target="_new">unix</a> commands. I&#8217;ve found them very useful when navigating and performing various tasks. I decided to share them with you, so hopefully you will find them a useful reference at the very least!</p>
<p>To find files within a time range and add up the total size of all those files :</p>
<p><strong></p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">find /opt/uploads -mtime -365 -printf &quot;%s\n&quot;|awk '{sum+=$0}END{print sum}'</div></div>
<p></strong></p>
<p>To watch a command&#8217;s progress :</p>
<p><strong></p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">watch -n1 'du -h -c --max-depth=1'</div></div>
<p></strong></p>
<p>Transfer a file / folders, compress it midstrem over the network, uncompress the file on the recieving end:</p>
<p><strong></p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">ssh -l root 00.00.000.000 '(cd /opt/uploads/ &amp;&amp; tar -czf - . -C /opt/uploads)' | tar -xzf -</div></div>
<p></strong></p>
<p>Below will return any XYZ PID that is older than 10 hours.</p>
<p><strong></p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">ps -ef | grep XYZ | awk '{ print $7 &quot;:&quot; $2 }' | awk 'BEGIN { FS =&quot;:&quot; }; {if ($1 &gt; 10) print $4}'</div></div>
<p></strong></p>
<p>Check web logs on www server for specific ip address access:</p>
<p><strong></p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">grep &quot;ip_address&quot; [a-h]*/logs/*access*4 &nbsp; &nbsp; &lt;-- check a-h websites<br />
grep &quot;ip_address&quot; [A-Z,0-9]*/logs/*access*4 &lt;-- check A-Z, 0-9 websites</div></div>
<p></strong></p>
<p>Those are just a few of the useful commands that can be applied to many different functions. I particularly like sending files across the network and compressing them mid stream <img src='http://www.stardothosting.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>The above kind of administration is made even easier when you employ <a href="http://sial.org/howto/openssh/publickey-auth/" target="_new">ssh key based authentication</a> &#8212; your commands can be scripted to execute across many servers in one sitting (just be careful) <img src='http://www.stardothosting.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.stardothosting.com/blog/2009/05/04/quick-tips-using-find-ssh-tar-ps-and-grep-commands/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Welcome to the new Star Dot Hosting Blog!</title>
		<link>http://www.stardothosting.com/blog/2009/04/21/welcome-to-the-new-star-dot-hosting-blog/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=welcome-to-the-new-star-dot-hosting-blog</link>
		<comments>http://www.stardothosting.com/blog/2009/04/21/welcome-to-the-new-star-dot-hosting-blog/#comments</comments>
		<pubDate>Tue, 21 Apr 2009 19:28:31 +0000</pubDate>
		<dc:creator>Kevin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[company announcements]]></category>
		<category><![CDATA[star dot hosting]]></category>
		<category><![CDATA[stardothosting]]></category>
		<category><![CDATA[welcome]]></category>

		<guid isPermaLink="false">http://blog.stardothosting.com/?p=3</guid>
		<description><![CDATA[We at SDH have made the decision to start a technology / hosting related blog. Expect to see more interesting things here soon! - SDH Team]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2009%2F04%2F21%2Fwelcome-to-the-new-star-dot-hosting-blog%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2009%2F04%2F21%2Fwelcome-to-the-new-star-dot-hosting-blog%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>We at SDH have made the decision to start a technology / hosting related blog. Expect to see more interesting things here soon!</p>
<p>- SDH Team</p>
<p><a class="a2a_button_digg" href="http://www.addtoany.com/add_to/digg?linkurl=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2009%2F04%2F21%2Fwelcome-to-the-new-star-dot-hosting-blog%2F&amp;linkname=Welcome%20to%20the%20new%20Star%20Dot%20Hosting%20Blog%21" title="Digg" rel="nofollow" target="_blank"><img src="http://www.stardothosting.com/blog/wp-content/plugins/add-to-any/icons/digg.png" width="16" height="16" alt="Digg"/></a><a class="a2a_button_twitter" href="http://www.addtoany.com/add_to/twitter?linkurl=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2009%2F04%2F21%2Fwelcome-to-the-new-star-dot-hosting-blog%2F&amp;linkname=Welcome%20to%20the%20new%20Star%20Dot%20Hosting%20Blog%21" title="Twitter" rel="nofollow" target="_blank"><img src="http://www.stardothosting.com/blog/wp-content/plugins/add-to-any/icons/twitter.png" width="16" height="16" alt="Twitter"/></a><a class="a2a_button_reddit" href="http://www.addtoany.com/add_to/reddit?linkurl=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2009%2F04%2F21%2Fwelcome-to-the-new-star-dot-hosting-blog%2F&amp;linkname=Welcome%20to%20the%20new%20Star%20Dot%20Hosting%20Blog%21" title="Reddit" rel="nofollow" target="_blank"><img src="http://www.stardothosting.com/blog/wp-content/plugins/add-to-any/icons/reddit.png" width="16" height="16" alt="Reddit"/></a><a class="a2a_button_delicious" href="http://www.addtoany.com/add_to/delicious?linkurl=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2009%2F04%2F21%2Fwelcome-to-the-new-star-dot-hosting-blog%2F&amp;linkname=Welcome%20to%20the%20new%20Star%20Dot%20Hosting%20Blog%21" title="Delicious" rel="nofollow" target="_blank"><img src="http://www.stardothosting.com/blog/wp-content/plugins/add-to-any/icons/delicious.png" width="16" height="16" alt="Delicious"/></a><a class="a2a_button_google_plusone addtoany_special_service" data-annotation="none" data-href="http://www.stardothosting.com/blog/2009/04/21/welcome-to-the-new-star-dot-hosting-blog/"></a><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2009%2F04%2F21%2Fwelcome-to-the-new-star-dot-hosting-blog%2F&amp;title=Welcome%20to%20the%20new%20Star%20Dot%20Hosting%20Blog%21" id="wpa2a_4"><img src="http://www.stardothosting.com/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.stardothosting.com/blog/2009/04/21/welcome-to-the-new-star-dot-hosting-blog/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

