<?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>1-800-HOSTING Blog &#187; linux</title>
	<atom:link href="http://blog.800hosting.com/tag/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.800hosting.com</link>
	<description>Inside 1-800-HOSTING</description>
	<lastBuildDate>Mon, 19 Jul 2010 21:04:46 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>PHP Script Tips and Resources</title>
		<link>http://blog.800hosting.com/2010/02/php-script-tips-and-resources/</link>
		<comments>http://blog.800hosting.com/2010/02/php-script-tips-and-resources/#comments</comments>
		<pubDate>Mon, 01 Feb 2010 17:30:41 +0000</pubDate>
		<dc:creator>David Tooke</dc:creator>
				<category><![CDATA[Fun Stuff]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[drupal]]></category>
		<category><![CDATA[free php scripts]]></category>
		<category><![CDATA[google crawler]]></category>
		<category><![CDATA[googlebot]]></category>
		<category><![CDATA[joomla]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[osCommerce]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[website]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://blog.800hosting.com/?p=1205</guid>
		<description><![CDATA[ PHP is a language absolutely made for websites. PHP code can be inserted into an html page to enable dynamic creation. Many content management systems like Drupal, Joomla, and osCommerce  use PHP together with MySQL to build webpages.
You can use PHP to detect crawling activity, rotate images/banners, and process forms. Here is an example [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://static.php.net/www.php.net/images/php.gif" alt="php" /> PHP is a language absolutely made for websites. <a title="php" href="http://php.net/" target="_blank">PHP</a> code can be inserted into an html page to enable dynamic creation. Many content management systems like Drupal, Joomla, and osCommerce  use PHP together with MySQL to build webpages.<span id="more-1205"></span></p>
<p>You can use PHP to detect crawling activity, rotate images/banners, and process forms. Here is an example of code that will email you whenever Google crawler Googlebot visits your page by detecting the useragent. You could expand the code to include other crawlers, add date and time stamp, and validate the IP to exclude impostors. I left that stuff out for simplicity and because you can  get that info from your webstats/logs. Just copy and paste this code in your web page to try it out. Note that the page may have to end with .php file extension to work, it depends on how your web server is setup.</p>
<blockquote><p>&lt;?<br />
if(eregi(&#8220;Googlebot&#8221;,$_SERVER['HTTP_USER_AGENT'])){</p>
<p>//put your email address below<br />
$address=youname@yourdomain.com;<br />
$subject=&#8221;Google visited &#8220;.$_SERVER[’HTTP_HOST’];<br />
$message=&#8221;Googlebot visited today.&#8221;;<br />
mail($address, $subject, $message);<br />
}<br />
?&gt;</p></blockquote>
<p>Here is an example of how to display  random images in a web page, it will pick one of the three banners each time the page loads. You could easily add more cases here or change the img src line to make this a random text function.</p>
<blockquote><p>&lt;?<br />
$randomimage = Rand (1,3) ;</p>
<p>//put your image name at bannerx<br />
switch ($randomimage)<br />
{<br />
case 1:<br />
&#8220;banner1&#8243;;<br />
break;</p>
<p>case 2:<br />
&#8220;banner2&#8243;;<br />
break;</p>
<p>case 3:<br />
&#8220;banner3&#8243;;<br />
break;<br />
}</p>
<p>echo &#8216;&lt;img src=&#8221;&#8216;$randomimage.&#8217;&#8221; border=0&gt;&#8217;;</p>
<p>?&gt;</p></blockquote>
<p>Another cool thing you can do is filter form data to by blocking bad words, banning ip addresses, and setting a timer with a cookie. There is nothing worse than having your website form spammed. You can get the visitor&#8217;s IP address with a built in php function and then check it against a list of bad IP addresses you have stored in a list called an <em>array</em>. You can modify this to include words by replacing the IP addresses with words. This is useful if there is a relatively small number of abusers. In the case of larger numbers, blocking at the server level using <a title="iptables wikipedia definition" href="http://en.wikipedia.org/wiki/Iptables" target="_blank">iptables</a> or a firewall may work better for you.</p>
<p>Here is the code for blocking IPs and you can add more IPs to the array if needed:</p>
<blockquote><p>&lt;?<br />
$banned_ip_addresses = array(&#8216;4.2.5.5&#8242;, &#8216;64.43.67.19&#8242;, &#8216;207.22.32.152&#8242;);</p>
<p>if(in_array($_SERVER['REMOTE_ADDR'], $banned_ip_addresses))<br />
{<br />
echo &#8220;You are banned.&#8221;;<br />
} else {<br />
continue with form processing&#8230;<br />
}</p></blockquote>
<p>If you are having problems with abusive surfers filling out your forms with constantly changing ip addresses, you can stop them by adding a cookie. A cookie is a small piece of code sent to the user&#8217;s pc to identify them.  Note that not all browsers will accept cookies, but most will. Once the cookie is set, you check for the existence of it in your form processing. Here is an example:</p>
<blockquote><p>//this sets time to 7200 seconds, 2 hours<br />
&lt;?<br />
setcookie(&#8220;userx&#8221;, &#8220;cookie1&#8243;, time()+7200);<br />
?&gt;</p>
<p>Then add the code below to find out if this person has been on your page before:</p>
<p>&lt;?<br />
if (isset($_COOKIE1["userx"])){<br />
echo &#8220;You have already filled out this form recently&#8221;;</p>
<p>} else {<br />
continue with form processing&#8230;<br />
}<br />
?&gt;</p></blockquote>
<p>There is a plethora of PHP support websites on the Internet. My longtime favorite is  <a title="php freaks forum" href="http://www.phpfreaks.com/forums/" target="_blank">PHP Freaks Forum</a> where you can post  technical questions and read responses. Another good one is the <a title="digital point php forum" href="http://forums.digitalpoint.com/forumdisplay.php?f=37" target="_blank">Digital Point PHP Forum</a>. If you are looking for scripts then visit <a title="hotscripts" href="http://www.hotscripts.com/category/php/scripts-programs/" target="_blank">Hotscripts</a>, where you will find many, some free and some paid. Also check out <a title="free scripts directory" href="http://gscripts.net/" target="_blank">Free Scripts Directory</a>,  <a title="script repository" href="http://www.sitescripts.com/PHP/" target="_blank">Script Repository</a>, and <a title="php resource index" href="http://php.resourceindex.com/Complete_Scripts/" target="_blank">PHP Resource Index</a>. They have scripts for: counters, auctions, voting, calculators, searching, support ticketing, etc.</p>
<p>PHP works fine on both Linux and Windows systems. If you have a Linux box then chances are good that it is already installed; if not, visit <a title="php" href="http://php.net/" target="_blank">php.net</a> to download it. PHP is not standard on Windows but it can be installed. If you need technical support we can help you with installing or upgrading.</p>
<p>PHP is very powerful. In an upcoming post I will explain how to speed it up using accelerators, pull data from a database, write it to a webpage, and add functionality using extensions.</p>
<h3  class="related_post_title">Related Posts</h3><ul class="related_post"><li><a href="http://blog.800hosting.com/2009/12/drupal-free-website-building-tool/" title="Drupal &#8211; Free Website Building Tool">Drupal &#8211; Free Website Building Tool</a></li><li><a href="http://blog.800hosting.com/2009/05/linux-shell-insights-volume-2/" title="Linux Shell Insights: Volume 2">Linux Shell Insights: Volume 2</a></li><li><a href="http://blog.800hosting.com/2009/05/linux-shell-insights-volume-1/" title="Linux Shell Insights: Volume 1">Linux Shell Insights: Volume 1</a></li><li><a href="http://blog.800hosting.com/2010/01/mysql-version-6-preview/" title="MySQL Version 6 Preview">MySQL Version 6 Preview</a></li><li><a href="http://blog.800hosting.com/2009/12/a-little-security-goes-a-loooong-way/" title="A Little Security Goes a LOOOONG Way">A Little Security Goes a LOOOONG Way</a></li><li><a href="http://blog.800hosting.com/2009/11/linux-tip-setting-up-key-based-authentication/" title="Linux Tip: Setting up key-based authentication.">Linux Tip: Setting up key-based authentication.</a></li><li><a href="http://blog.800hosting.com/2009/06/do-i-need-a-dedicated-database-server/" title="Do I need a dedicated database server?">Do I need a dedicated database server?</a></li><li><a href="http://blog.800hosting.com/2009/06/new-laptop-with-windows-vista/" title="New Laptop with Windows Vista">New Laptop with Windows Vista</a></li><li><a href="http://blog.800hosting.com/2009/06/memory_cache_in_linux/" title="Linux: Low memory &#8211; feature or a bug?">Linux: Low memory &#8211; feature or a bug?</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://blog.800hosting.com/2010/02/php-script-tips-and-resources/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A Little Security Goes a LOOOONG Way</title>
		<link>http://blog.800hosting.com/2009/12/a-little-security-goes-a-loooong-way/</link>
		<comments>http://blog.800hosting.com/2009/12/a-little-security-goes-a-loooong-way/#comments</comments>
		<pubDate>Thu, 03 Dec 2009 16:46:09 +0000</pubDate>
		<dc:creator>Ben Fogt</dc:creator>
				<category><![CDATA[Fun Stuff]]></category>
		<category><![CDATA[firewall]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[Windows Home Server]]></category>

		<guid isPermaLink="false">http://blog.800hosting.com/?p=849</guid>
		<description><![CDATA[Security is only as secure as your weakest link. It&#8217;s tough to imagine and believe, but in this business you just have to suck it up and believe it. You can have 50 hardware and software firewalls, but if you have 3 year old exploitable php email form code, you&#8217;re as good as a DMZ [...]]]></description>
			<content:encoded><![CDATA[<p>Security is only as secure as your weakest link. It&#8217;s tough to imagine and believe, but in this business you just have to suck it up and believe it. You can have 50 hardware and software firewalls, but if you have 3 year old exploitable php email form code, you&#8217;re as good as a DMZ server with no password. People go to school for security. There is no doubt that it&#8217;s a complex realm, but truth be told, it doesn&#8217;t have to be. <span id="more-849"></span>We&#8217;ve all read &#8220;Secure Your Password&#8221; or Change Port&#8221; but I don&#8217;t think people really take it for what it&#8217;s worth. If you are like my parents and hate the idea of passwords and using them, let me be the first to tell you, you are in the wrong business. We have caught a lot of our customers with simple passwords and unfortunately it is after they have received three abuse complaints about IRC hack attempts. A few minor changes really will help and go a <em>long way!</em></p>
<p>Don&#8217;t take it lightly when you see reminders to use a more complex password. I&#8217;m not saying you should use a 50 alpha numeric password, but a nice 8-digit password with at least one Uppercase, Number, and Symbol. If you&#8217;re not creative enough, there are plenty of random password generators out there. Brute forcing passwords is an old, but still used hack attempt these days and isn&#8217;t even the most popular way hackers get into servers.</p>
<p>The biggest step you can take to help protect your server is changing your default RDP/SSH ports, even your FTP and other program ports. I think a lot of admins don&#8217;t do this because they fear it&#8217;s a complex step. It&#8217;s not! For windows, it&#8217;s as simple as using regedit (OOOO SCARY!!, calm down and just be careful) Do the following for windows 2003:</p>
<p><em>Start-&gt;Run-&gt; type regedit</em></p>
<p><em>Navigate to </em><em>HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp</em></p>
<p><em>In the right Pane, look for PortNumber</em></p>
<p><em>Simply change the port number to whatever you want. Usually I keep my birth date in my port number changes. e.g. 3371 (Not my real birth date, but you get the point.)</em></p>
<p><em>When you reconnect to the server just make sure you append the port number. e.g. xx.xx.xxx.xxx:3371</em><em><br />
</em></p>
<p>In Linux, it&#8217;s even simpler. All you need to do is edit the sshd_config. To do this you do the following:</p>
<p><em>Use your favorite text editor and edit /etc/ssh/sshd_config</em></p>
<p><em>At the very top of the config is your current port 22</em></p>
<p><em>#Port 22<br />
#Protocol 2,1<br />
Protocol 2<br />
#AddressFamily any<br />
#ListenAddress 0.0.0.0<br />
#ListenAddress ::</em></p>
<p><em>Simply uncomment by removing the &#8216;#&#8217; and choose a new port. Idea, let&#8217;s go with the birth date method. e.g. 2271. So it will now look like:</em></p>
<p><em>Port 2271<br />
#Protocol 2,1<br />
Protocol 2<br />
#AddressFamily any<br />
#ListenAddress 0.0.0.0<br />
#ListenAddress ::</em></p>
<p><em>Now all you have to do is restart ssh (this process is different depending on your distro, just google restart ssh) To connect from another client using the new IP, do:</em></p>
<p><em>ssh -p 2271 root@xx.xx.xxx.xxx</em></p>
<p>Lastly, using a firewall really does help. The built in windows firewall works. It&#8217;s simple, basic and easy to use. Just make sure before you enable it to add your new RDP port. If you forget, you know <a title="1-800-HOSTING support contact" href="mailto:support@800hosting.com" target="_blank">where to reach us</a>. The same goes with IPTABLES in Linux.</p>
<p>You might be surprised, but the majority of successful hack attempts are done through poor or outdated code. It&#8217;s the long lived battle of the programmer v. web-dude, but belief in what I said above will mean nothing if your code is vulnerable. The same goes with using your windows server to surf the web. <strong>DO NOT SURF THE INTERNET WITH YOUR WINDOWS SERVER</strong>. You are asking for trouble by doing so. Remote desktop has a file transfer program built into it for a reason.</p>
<p>In short,</p>
<p>-Use a more complex password</p>
<p>-Change your default ports</p>
<p>-Add a firewall</p>
<p>-Don&#8217;t use your server like a workstation to browse the web and download files.</p>
<p>Hope this helps.</p>
<h3  class="related_post_title">Related Posts</h3><ul class="related_post"><li><a href="http://blog.800hosting.com/2010/02/php-script-tips-and-resources/" title="PHP Script Tips and Resources">PHP Script Tips and Resources</a></li><li><a href="http://blog.800hosting.com/2009/12/drupal-free-website-building-tool/" title="Drupal &#8211; Free Website Building Tool">Drupal &#8211; Free Website Building Tool</a></li><li><a href="http://blog.800hosting.com/2009/11/linux-tip-setting-up-key-based-authentication/" title="Linux Tip: Setting up key-based authentication.">Linux Tip: Setting up key-based authentication.</a></li><li><a href="http://blog.800hosting.com/2009/06/memory_cache_in_linux/" title="Linux: Low memory &#8211; feature or a bug?">Linux: Low memory &#8211; feature or a bug?</a></li><li><a href="http://blog.800hosting.com/2009/05/linux-shell-insights-volume-2/" title="Linux Shell Insights: Volume 2">Linux Shell Insights: Volume 2</a></li><li><a href="http://blog.800hosting.com/2009/05/linux-shell-insights-volume-1/" title="Linux Shell Insights: Volume 1">Linux Shell Insights: Volume 1</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://blog.800hosting.com/2009/12/a-little-security-goes-a-loooong-way/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Drupal &#8211; Free Website Building Tool</title>
		<link>http://blog.800hosting.com/2009/12/drupal-free-website-building-tool/</link>
		<comments>http://blog.800hosting.com/2009/12/drupal-free-website-building-tool/#comments</comments>
		<pubDate>Tue, 01 Dec 2009 17:56:08 +0000</pubDate>
		<dc:creator>David Tooke</dc:creator>
				<category><![CDATA[Company]]></category>
		<category><![CDATA[Industry]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[1-800-HOSTING]]></category>
		<category><![CDATA[content management]]></category>
		<category><![CDATA[drupal]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[open source]]></category>

		<guid isPermaLink="false">http://blog.800hosting.com/?p=950</guid>
		<description><![CDATA[The Drupal content management system is software that makes it easy to build a great looking website. With Drupal, you can create pages using templates and easily add content using the admin control panel. In my opinion, it is a good choice for all types of sites such as blogs, portals, corporate or government sites.
Drupal [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.800hosting.com/2009/12/drupal-free-website-building-tool/"><img class="alignright size-full wp-image-963" title="drupal-logo" src="http://blog.800hosting.com/wp-content/uploads/2009/12/drupal-logo.jpg" alt="drupal-logo" width="91" height="105" /></a>The <a title="Drupal" href="http://drupal.org/" target="_blank">Drupal </a>content management system is software that makes it easy to build a great looking website. With Drupal, you can create pages using templates and easily add content using the admin control panel. In my opinion, it is a good choice for all types of sites such as blogs, portals, corporate or government sites.<span id="more-950"></span></p>
<p>Drupal is based on a system of templates where you can use the built-in ones or make your own. It has some cool features built in such as chat forums, rss, video and podcasting options. Currently, there are thousands of websites using Drupal such as <a title="Spread Firefox" href="http://www.spreadfirefox.com/" target="_blank">Spread Firefox</a>, <a title="The White House" href="http://www.whitehouse.gov/" target="_blank">The White house</a>, and <a title="The Onion" href="http://www.theonion.com/content/index" target="_blank">The Onion</a>. There are many more listed on <a title="Drupal Sites" href="http://www.drupalsites.net/" target="_blank">Drupal Sites</a>. Drupal is an open source software package licensed under the GNU GPL and runs great on a Linux server with Apache, PHP, and MySQL. We here at 1-800-Hosting are Drupal friendly and can help with installation as well as well hosting technical support like unix file permissions, phpinfo(), mod_security, php file size and memory limits.</p>
<p>The best thing I like about Drupal is that it can be extended with <a title="drupal modules" href="http://drupalmodules.com/" target="_blank">third party modules</a> in order to add functions. You can add search, instant messenger, cron, voting, image browsing, slideshow, google analytics, e-commerce, and chat room. If you&#8217;re looking for an easy way to get a website up and running without the hassles of back-end development, take a look at Drupal. It can make building a site a little easier without getting lost in the interweb fray.</p>
<h3  class="related_post_title">Related Posts</h3><ul class="related_post"><li><a href="http://blog.800hosting.com/2010/02/php-script-tips-and-resources/" title="PHP Script Tips and Resources">PHP Script Tips and Resources</a></li><li><a href="http://blog.800hosting.com/2009/05/linux-shell-insights-volume-2/" title="Linux Shell Insights: Volume 2">Linux Shell Insights: Volume 2</a></li><li><a href="http://blog.800hosting.com/2009/05/linux-shell-insights-volume-1/" title="Linux Shell Insights: Volume 1">Linux Shell Insights: Volume 1</a></li><li><a href="http://blog.800hosting.com/2010/01/employee-appreciation-and-the-lost-art-of-the-road-trip/" title="Employee Appreciation and the Lost Art of the Road Trip">Employee Appreciation and the Lost Art of the Road Trip</a></li><li><a href="http://blog.800hosting.com/2010/01/a-resolution-to-keep-resolutions/" title="A Resolution to Keep Resolutions">A Resolution to Keep Resolutions</a></li><li><a href="http://blog.800hosting.com/2009/12/happy-holidays/" title="Happy Holidays!">Happy Holidays!</a></li><li><a href="http://blog.800hosting.com/2009/12/a-little-security-goes-a-loooong-way/" title="A Little Security Goes a LOOOONG Way">A Little Security Goes a LOOOONG Way</a></li><li><a href="http://blog.800hosting.com/2009/12/using-mac-as-a-work-pc-the-first-6-months/" title="Using Mac as a Work PC, the First 6 Months">Using Mac as a Work PC, the First 6 Months</a></li><li><a href="http://blog.800hosting.com/2009/11/hosted-microsoft-exchange/" title="Hosted Microsoft Exchange?">Hosted Microsoft Exchange?</a></li><li><a href="http://blog.800hosting.com/2009/11/linux-tip-setting-up-key-based-authentication/" title="Linux Tip: Setting up key-based authentication.">Linux Tip: Setting up key-based authentication.</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://blog.800hosting.com/2009/12/drupal-free-website-building-tool/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux Tip: Setting up key-based authentication.</title>
		<link>http://blog.800hosting.com/2009/11/linux-tip-setting-up-key-based-authentication/</link>
		<comments>http://blog.800hosting.com/2009/11/linux-tip-setting-up-key-based-authentication/#comments</comments>
		<pubDate>Wed, 11 Nov 2009 21:05:06 +0000</pubDate>
		<dc:creator>Jonathan Kelley</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[key-based ssh authentication]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[linux how-to]]></category>
		<category><![CDATA[linux tips]]></category>

		<guid isPermaLink="false">http://blog.800hosting.com/?p=865</guid>
		<description><![CDATA[In this post I&#8217;ll explain how to use key-based SSH authentication in Linux.
This can be used either for non-password based authentication for scripts or other utilities, or for extra security when paired with a pass phrase key.
We&#8217;ll need to generate a key-pair, a public-key and a private-key. The public-key will be placed on the server, [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.800hosting.com/2009/11/linux-tip-setting-up-key-based-authentication"><img class="size-full wp-image-877 alignright" title="linux-penguin" src="http://blog.800hosting.com/wp-content/uploads/2009/11/linux-penguin.jpg" alt="linux-penguin" width="125" height="148" /></a>In this post I&#8217;ll explain how to use key-based SSH authentication in Linux.</p>
<p>This can be used either for non-password based authentication for scripts or other utilities, or for extra security when paired with a pass phrase key.<span id="more-865"></span></p>
<p>We&#8217;ll need to generate a key-pair, a public-key and a private-key. The public-key will be placed on the server, and you will log in with your private-key. You will need to enter a passphrase for security (or leave blank for password-less auth.)</p>
<p>First generate the key:</p>
<blockquote><p>ssh-keygen -t rsa -b 1024 -C &#8220;your-email-address&#8221;</p></blockquote>
<p>This will create a 1024 bit key using RSA in your current directory. You will need to transfer it to the server you wish to authenticate with by some means, you can use SCP if you have an SCP client like this:</p>
<blockquote><p>scp -p id_rsa.pub user@server:~/</p></blockquote>
<p>Then log in to the remote server, and put the file in the authorized_keys for the user you want to authenticate with.</p>
<blockquote><p>mkdir ~/.ssh<br />
chmod 700 ~/.ssh<br />
cat ~/id_rsa.pub &gt;&gt; ~/.ssh/authorized_keys<br />
chmod 600 ~/.ssh/authorized_keys<br />
mv id_rsa.pub ~/.ssh</p></blockquote>
<p>Sometimes you may have to delete the public key file on the local machine to be able to log in, e.g.</p>
<blockquote><p>rm rsa.pub</p></blockquote>
<p>Once you&#8217;re done, try to log in to the remote host, and if everything was done right, you should be in!</p>
<h3  class="related_post_title">Related Posts</h3><ul class="related_post"><li><a href="http://blog.800hosting.com/2010/02/php-script-tips-and-resources/" title="PHP Script Tips and Resources">PHP Script Tips and Resources</a></li><li><a href="http://blog.800hosting.com/2009/12/a-little-security-goes-a-loooong-way/" title="A Little Security Goes a LOOOONG Way">A Little Security Goes a LOOOONG Way</a></li><li><a href="http://blog.800hosting.com/2009/12/drupal-free-website-building-tool/" title="Drupal &#8211; Free Website Building Tool">Drupal &#8211; Free Website Building Tool</a></li><li><a href="http://blog.800hosting.com/2009/06/memory_cache_in_linux/" title="Linux: Low memory &#8211; feature or a bug?">Linux: Low memory &#8211; feature or a bug?</a></li><li><a href="http://blog.800hosting.com/2009/05/linux-shell-insights-volume-2/" title="Linux Shell Insights: Volume 2">Linux Shell Insights: Volume 2</a></li><li><a href="http://blog.800hosting.com/2009/05/linux-shell-insights-volume-1/" title="Linux Shell Insights: Volume 1">Linux Shell Insights: Volume 1</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://blog.800hosting.com/2009/11/linux-tip-setting-up-key-based-authentication/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux: Low memory &#8211; feature or a bug?</title>
		<link>http://blog.800hosting.com/2009/06/memory_cache_in_linux/</link>
		<comments>http://blog.800hosting.com/2009/06/memory_cache_in_linux/#comments</comments>
		<pubDate>Tue, 09 Jun 2009 19:27:53 +0000</pubDate>
		<dc:creator>Jonathan Kelley</dc:creator>
				<category><![CDATA[Fun Stuff]]></category>
		<category><![CDATA[Industry]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[administration]]></category>
		<category><![CDATA[buffers]]></category>
		<category><![CDATA[cache]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[memory]]></category>

		<guid isPermaLink="false">http://blog.800hosting.com/?p=630</guid>
		<description><![CDATA[Linux actually handles RAM differently than Windows, and this can cause confusion to an administrator in charge of a system. Customers sometimes contact us with worries of low ram, memory leaks and other problems wondering why their system is constantly low on RAM. Case in point: A dedicated customer once ordered two RAM upgrades before [...]]]></description>
			<content:encoded><![CDATA[<p>Linux actually handles RAM differently than Windows, and this can cause confusion to an administrator in charge of a system. Customers sometimes contact us with worries of low ram, memory leaks and other problems wondering why their system is constantly low on RAM. Case in point: A dedicated customer once ordered two RAM upgrades before opening up to us about his concern with memory leaks. We were finally able to share with him that he had plenty!<span id="more-630"></span></p>
<p>Imagine, Apache has been having some strange issues with faults and sigterms mentioned in log files. Today your boss is upset because it happened during a live product demo and the site went down while some major investors were checking it out. You&#8217;ve been tasked not-so-lightly with finding out why. You try some things, then check the memory usage.</p>
<div style=" font-family: Courier New; background-color: black; border: medium double grey; color: white">[root@why-so-plagued-for-ram.local ~]# free -m<br />
total       used       free<br />
Mem:          3289       3126        162<br />
-/+ buffers/cache:        567       <strong><span style="text-decoration: underline;"><span style="color: lightgreen;">2721</span></span></strong><br />
Swap:         1027          0       1027</div>
<p>You may think you&#8217;ve pinned the problem! Merely 162 megabytes of RAM available can certainly cause problems. Come mid-day, that will be exhausted! However, a closer inspection shows you have <span style="color: darkgreen;"><strong>2721</strong></span> megabytes free memory. See the -/+ buffers/cache part? That&#8217;s cached memory, that is actually available usable system memory. You&#8217;ve got plenty!</p>
<p><strong>What is -/+ buffers/cache?</strong></p>
<p>Linux uses buffers/cache for disk caching (possibly other functions as well) to help your overall system performance. This makes I/O operations and other functions the kernel uses go quicker. The kernel figures if there&#8217;s RAM to use, why not use it? (Why not?)</p>
<p>If a program were to start that needs the memory, the buffer is dynamically re-sized to exclude the memory needed by the application. It&#8217;s harmless, interferes with programs in no way, and helps your system do other operations faster via the speed of your memory. What&#8217;s not to love?</p>
<p>As for those Apache issues, hopefully you&#8217;ll figure them out before your boss has another incident! At least you&#8217;ve solved the issue with the memory. It&#8217;s not a bug, leak, or coding issue: it&#8217;s a feature.</p>
<p>I&#8217;d like to credit Vidar at <a href="http://www.linuxatemyram.com/">Linux Ate My Ram!</a> for addressing this issue for the internet community at large, and for being the inspiration of this posting. [He has also written <a href="http://www.linuxatemyram.com/play.html">source code</a> to prove this theory should anyone want to experiment.]</p>
<h3  class="related_post_title">Related Posts</h3><ul class="related_post"><li><a href="http://blog.800hosting.com/2010/02/php-script-tips-and-resources/" title="PHP Script Tips and Resources">PHP Script Tips and Resources</a></li><li><a href="http://blog.800hosting.com/2009/12/a-little-security-goes-a-loooong-way/" title="A Little Security Goes a LOOOONG Way">A Little Security Goes a LOOOONG Way</a></li><li><a href="http://blog.800hosting.com/2009/12/drupal-free-website-building-tool/" title="Drupal &#8211; Free Website Building Tool">Drupal &#8211; Free Website Building Tool</a></li><li><a href="http://blog.800hosting.com/2009/11/linux-tip-setting-up-key-based-authentication/" title="Linux Tip: Setting up key-based authentication.">Linux Tip: Setting up key-based authentication.</a></li><li><a href="http://blog.800hosting.com/2009/05/linux-shell-insights-volume-2/" title="Linux Shell Insights: Volume 2">Linux Shell Insights: Volume 2</a></li><li><a href="http://blog.800hosting.com/2009/05/linux-shell-insights-volume-1/" title="Linux Shell Insights: Volume 1">Linux Shell Insights: Volume 1</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://blog.800hosting.com/2009/06/memory_cache_in_linux/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Linux Shell Insights: Volume 2</title>
		<link>http://blog.800hosting.com/2009/05/linux-shell-insights-volume-2/</link>
		<comments>http://blog.800hosting.com/2009/05/linux-shell-insights-volume-2/#comments</comments>
		<pubDate>Tue, 26 May 2009 23:40:14 +0000</pubDate>
		<dc:creator>Jonathan Kelley</dc:creator>
				<category><![CDATA[Fun Stuff]]></category>
		<category><![CDATA[Industry]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[1-800-HOSTING]]></category>
		<category><![CDATA[cli]]></category>
		<category><![CDATA[commands]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[tricks]]></category>

		<guid isPermaLink="false">http://blog.800hosting.com/?p=548</guid>
		<description><![CDATA[My last volume Linux Shell Insights: Volume 1 had some talk on the social plane about it so here&#8217;s Volume 2. Enjoy.
Here are a few more one-liners. I also call for the assistance of our audience; if anyone has more reliable or efficient methods to accomplish the ends in this article, get involved and comment!

Obtain [...]]]></description>
			<content:encoded><![CDATA[<p>My last volume <a href="http://blog.800hosting.com/2009/05/linux-shell-insights-volume-1/">Linux Shell Insights: Volume 1</a> had some talk on the social plane about it so here&#8217;s Volume 2. Enjoy.</p>
<p>Here are a few more one-liners. I also call for the assistance of our audience; if anyone has more reliable or efficient methods to accomplish the ends in this article, get involved and comment!<span id="more-548"></span></p>
<ol>
<li><strong>Obtain your internet IP</strong><br />
There are two ways to do this (both below.) This can be useful in bash scripts that require your IP address. It&#8217;s useful in a dynamic IP environment when handling dynamic DNS in some fashion; though can be useful in a variety of scripts in which NAT may exist making eth0 unreliable for this information.</p>
<div style="overflow: auto; font-family: Courier New; background-color: black; border: medium double grey; color: white">shell# wget -O &#8211; -q checkip.dyndns.org | grep -o &#8220;[[:digit:].]+&#8221;</div>
<p>You can also use curl if it&#8217;s your tool-of-choice.</p>
<div style="overflow: auto; font-family: Courier New; background-color: black; border: medium double grey; color: white">shell# curl -s http://checkip.dydns.org/ | grep -o &#8220;[[:digit:].]+&#8221;</div>
<p>If you&#8217;ve got a static IP that is directly connected to the internet; it&#8217;s best to just scrape the information out of ifconfig.</p>
<div style="white-space: pre-wrap; word-wrap: break-word; overflow: auto; font-family: Courier New; background-color: black; border: medium double grey; color: white">shell# /sbin/ifconfig eth0 | grep inet | grep -o &#8220;[[:digit:].]+&#8221; | head -n 1</div>
</li>
<li><strong>Get Distribution Information/Version</strong><br />
From time to time we get support tickets or calls asking &#8220;What distribution of Linux am I running?&#8221;. Here&#8217;s a way to ascertain this under most modern Linux distributions we offer.</p>
<p>Most Linux distributions follow the &#8220;<a href="http://en.wikipedia.org/wiki/Linux_Standard_Base">Linux Standard Base</a>&#8221; and have a file in /etc matching *release. You can take a look by running:</p>
<div style="overflow: auto; font-family: Courier New; background-color: black; border: medium double grey; color: white">shell# cat /etc/*release</div>
<p>This does the same thing if you find it easier to remember.</p>
<div style="overflow: auto; font-family: Courier New; background-color: black; border: medium double grey; color: white">shell# lsb_release &#8211;all</div>
<p>NOTE: You may have to cat the file /etc/debian_version on some Debian releases.</li>
<li><strong>Shortcut to list all system users</strong><br />
I stumbled upon this one by a typo once where you can get a peek of system users. This shouldn&#8217;t be considered authoritative, as /etc/passwd is your daddy; but it&#8217;s quick to verify the spelling of that strange developer who insists on the username supercalifragilistic_expialidocious.<br />
Tested on: Debian, Redhat</p>
<div style="overflow: auto; font-family: Courier New; background-color: black; border: medium double grey; color: white">shell# ~(HIT TAB TWICE HERE)</div>
</li>
<li><strong>Lost Plesk Password</strong><br />
Here&#8217;s one of those gems that we keep close to our chest, but I&#8217;m willing to reveal it to you. If you misplace your Plesk Admin password, on UNIX it stores it in /etc/psa/.psa.shadow. This is a read-only file, changing the password here does not change it for Plesk. It&#8217;s a good way to jot your memory if you forget though.</p>
<div style="overflow: auto; font-family: Courier New; background-color: black; border: medium double grey; color: white">shell# cat /etc/psa/.psa.shadow</div>
</li>
</ol>
<p>Continue to keep an eye out for my next list!</p>
<h3  class="related_post_title">Related Posts</h3><ul class="related_post"><li><a href="http://blog.800hosting.com/2009/05/linux-shell-insights-volume-1/" title="Linux Shell Insights: Volume 1">Linux Shell Insights: Volume 1</a></li><li><a href="http://blog.800hosting.com/2010/02/php-script-tips-and-resources/" title="PHP Script Tips and Resources">PHP Script Tips and Resources</a></li><li><a href="http://blog.800hosting.com/2009/12/drupal-free-website-building-tool/" title="Drupal &#8211; Free Website Building Tool">Drupal &#8211; Free Website Building Tool</a></li><li><a href="http://blog.800hosting.com/2010/01/employee-appreciation-and-the-lost-art-of-the-road-trip/" title="Employee Appreciation and the Lost Art of the Road Trip">Employee Appreciation and the Lost Art of the Road Trip</a></li><li><a href="http://blog.800hosting.com/2010/01/a-resolution-to-keep-resolutions/" title="A Resolution to Keep Resolutions">A Resolution to Keep Resolutions</a></li><li><a href="http://blog.800hosting.com/2009/12/happy-holidays/" title="Happy Holidays!">Happy Holidays!</a></li><li><a href="http://blog.800hosting.com/2009/12/a-little-security-goes-a-loooong-way/" title="A Little Security Goes a LOOOONG Way">A Little Security Goes a LOOOONG Way</a></li><li><a href="http://blog.800hosting.com/2009/12/using-mac-as-a-work-pc-the-first-6-months/" title="Using Mac as a Work PC, the First 6 Months">Using Mac as a Work PC, the First 6 Months</a></li><li><a href="http://blog.800hosting.com/2009/11/hosted-microsoft-exchange/" title="Hosted Microsoft Exchange?">Hosted Microsoft Exchange?</a></li><li><a href="http://blog.800hosting.com/2009/11/linux-tip-setting-up-key-based-authentication/" title="Linux Tip: Setting up key-based authentication.">Linux Tip: Setting up key-based authentication.</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://blog.800hosting.com/2009/05/linux-shell-insights-volume-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux Shell Insights: Volume 1</title>
		<link>http://blog.800hosting.com/2009/05/linux-shell-insights-volume-1/</link>
		<comments>http://blog.800hosting.com/2009/05/linux-shell-insights-volume-1/#comments</comments>
		<pubDate>Wed, 06 May 2009 20:57:43 +0000</pubDate>
		<dc:creator>Jonathan Kelley</dc:creator>
				<category><![CDATA[Fun Stuff]]></category>
		<category><![CDATA[Industry]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[1-800-HOSTING]]></category>
		<category><![CDATA[cli]]></category>
		<category><![CDATA[commands]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[tricks]]></category>

		<guid isPermaLink="false">http://blog.800hosting.com/?p=433</guid>
		<description><![CDATA[Hello readers,
I thought I&#8217;d share some intriguing and useful one-liners that could make your life easier on the Linux/Unix shell environment. I hope to offer a regular multi-part series for those who are fans of the Linux platform.

View Physical Console via SSH
This will view the console (and makes assumption that the console is an 80 [...]]]></description>
			<content:encoded><![CDATA[<p>Hello readers,</p>
<p>I thought I&#8217;d share some intriguing and useful one-liners that could make your life easier on the Linux/Unix shell environment. I hope to offer a regular multi-part series for those who are fans of the Linux platform.<span id="more-433"></span></p>
<ol>
<li><strong>View Physical Console via SSH</strong><br />
This will view the console (and makes assumption that the console is an 80 character screen.) It&#8217;s helpful to scrape error messages that are printed to the local console. Great for when you don&#8217;t have physical access to the server and need to see the terminal; we also find it useful here by eliminating unnecessary trips to the data center floor.</p>
<p><span style="auto: visible; font-family: Courier New; background-color: black; border: medium double grey; color: white">shell# sudo cat /dev/vcs1 | fold -w 80</span></li>
<li><strong>Remove multiple RPM packages by a defined pattern</strong><br />
This is useful for remove all packages that are part of a common suite. This example would uninstall any package in the system with &#8216;php&#8217; in the name. (Disclaimer: Check what packages contain the string prior to running this. Unpredictable results could remove system critical packages! I&#8217;d suggest this for advanced shell users only.)</p>
<p><span style="auto: visible; font-family: Courier New; background-color: black; border: medium double grey; color: white">shell# yum erase `yum list installed | grep &#8216;php&#8217;`</span></li>
<li><strong>Reduce a file to zero bytes</strong><br />
I&#8217;m sure every administrator has needed to zero out a log file taking too much space; or clear a users mail spool. Many commands involve piping /dev/null to the file or similar. The following command is probably the easiest and quickest way that many users overlook.</p>
<p><span style="auto: visible; font-family: Courier New; background-color: black; border: medium double grey; color: white">shell# &gt; file_to_wipe.txt</span></li>
<li><strong>Look at the strings stored in RAM</strong><br />
This one is more for fun; though it could be used for security auditing. This command will access the system RAM and reveal text strings stored in memory. Don&#8217;t worry, this file is read-only by the kernel. You can usually find interesting data stored in memory with this command.</p>
<p><span style="auto: visible; font-family: Courier New; background-color: black; border: medium double grey; color: white">shell# sudo dd if=/dev/mem | cat | strings</span></li>
</ol>
<p>That&#8217;s it for now; more in this series coming soon.</p>
<h3  class="related_post_title">Related Posts</h3><ul class="related_post"><li><a href="http://blog.800hosting.com/2009/05/linux-shell-insights-volume-2/" title="Linux Shell Insights: Volume 2">Linux Shell Insights: Volume 2</a></li><li><a href="http://blog.800hosting.com/2010/02/php-script-tips-and-resources/" title="PHP Script Tips and Resources">PHP Script Tips and Resources</a></li><li><a href="http://blog.800hosting.com/2009/12/drupal-free-website-building-tool/" title="Drupal &#8211; Free Website Building Tool">Drupal &#8211; Free Website Building Tool</a></li><li><a href="http://blog.800hosting.com/2010/01/employee-appreciation-and-the-lost-art-of-the-road-trip/" title="Employee Appreciation and the Lost Art of the Road Trip">Employee Appreciation and the Lost Art of the Road Trip</a></li><li><a href="http://blog.800hosting.com/2010/01/a-resolution-to-keep-resolutions/" title="A Resolution to Keep Resolutions">A Resolution to Keep Resolutions</a></li><li><a href="http://blog.800hosting.com/2009/12/happy-holidays/" title="Happy Holidays!">Happy Holidays!</a></li><li><a href="http://blog.800hosting.com/2009/12/a-little-security-goes-a-loooong-way/" title="A Little Security Goes a LOOOONG Way">A Little Security Goes a LOOOONG Way</a></li><li><a href="http://blog.800hosting.com/2009/12/using-mac-as-a-work-pc-the-first-6-months/" title="Using Mac as a Work PC, the First 6 Months">Using Mac as a Work PC, the First 6 Months</a></li><li><a href="http://blog.800hosting.com/2009/11/hosted-microsoft-exchange/" title="Hosted Microsoft Exchange?">Hosted Microsoft Exchange?</a></li><li><a href="http://blog.800hosting.com/2009/11/linux-tip-setting-up-key-based-authentication/" title="Linux Tip: Setting up key-based authentication.">Linux Tip: Setting up key-based authentication.</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://blog.800hosting.com/2009/05/linux-shell-insights-volume-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
