<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"
	xmlns:media="http://search.yahoo.com/mrss/"
>

<channel>
	<title>CharlieBlog &#187; linux</title>
	<atom:link href="http://www.longitudetech.com/tag/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.longitudetech.com</link>
	<description></description>
	<lastBuildDate>Tue, 20 Apr 2010 20:20:47 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
	<!-- podcast_generator="podPress/8.8" - maintenance_release="8.8.4" -->
		<copyright>Copyright &#xA9; LongitudeTech Blog 2010 </copyright>
		<managingEditor>info@longitudetech.com (CharlieBlog)</managingEditor>
		<webMaster>info@longitudetech.com (CharlieBlog)</webMaster>
		<category>posts</category>
		<itunes:keywords></itunes:keywords>
		<itunes:subtitle></itunes:subtitle>
		<itunes:summary>Linux, Networking, Stories, and Rants</itunes:summary>
		<itunes:author>CharlieBlog</itunes:author>
		<itunes:category text="Society &amp; Culture"/>
		<itunes:owner>
			<itunes:name>CharlieBlog</itunes:name>
			<itunes:email>info@longitudetech.com</itunes:email>
		</itunes:owner>
		<itunes:block>No</itunes:block>
		<itunes:explicit>no</itunes:explicit>
		<itunes:image href="http://www.longitudetech.com/wp-content/plugins/podpress/images/powered_by_podpress_large.jpg" />
		<image>
			<url>http://www.longitudetech.com/wp-content/plugins/podpress/images/powered_by_podpress.jpg</url>
			<title>CharlieBlog</title>
			<link>http://www.longitudetech.com</link>
			<width>144</width>
			<height>144</height>
		</image>
		<item>
		<title>Is Cheap Web Hosting Worth It?</title>
		<link>http://www.longitudetech.com/it-management/is-cheap-web-hosting-worth-it/</link>
		<comments>http://www.longitudetech.com/it-management/is-cheap-web-hosting-worth-it/#comments</comments>
		<pubDate>Thu, 01 Apr 2010 15:34:54 +0000</pubDate>
		<dc:creator>charlie</dc:creator>
				<category><![CDATA[IT Management]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[ROI]]></category>
		<category><![CDATA[web hosting]]></category>

		<guid isPermaLink="false">http://www.longitudetech.com/blog/?p=59</guid>
		<description><![CDATA[Whether you are a small business, fortune 500, or in-between, Web hosting providers may have something to offer. Web hosting is extremely competitive, and not many companies survive. Once the need for Web hosting services is established, you need to do some research to determine whether a specific hosting company is a good fit. Small [...]


Related posts:<ol><li><a href='http://www.longitudetech.com/linux-unix/managing-virtual-machine-and-cloud-sprawl/' rel='bookmark' title='Permanent Link: Managing Virtual Machine and Cloud Sprawl'>Managing Virtual Machine and Cloud Sprawl</a></li>
<li><a href='http://www.longitudetech.com/it-management/how-much-server-do-you-need/' rel='bookmark' title='Permanent Link: How Much Server do you Need?'>How Much Server do you Need?</a></li>
<li><a href='http://www.longitudetech.com/linux-unix/zenoss-we-can-ditch-nagios-now/' rel='bookmark' title='Permanent Link: Zenoss: We Can Ditch Nagios Now'>Zenoss: We Can Ditch Nagios Now</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Whether you are a small business, fortune 500, or in-between, Web hosting providers may have something to offer. Web hosting is extremely competitive, and not many companies survive. Once the need for Web hosting services is established, you need to do some research to determine whether a specific hosting company is a good fit.</p>
<p>Small businesses will depend more heavily on their hosting provider, as their entire Web infrastructure may reside at a hosting company. As businesses get larger, and acquire their own IT staff, they tend to start running their own Web servers. At some point, maybe due to cost-cutting measures, companies may revisit the hosting option. If it’s really only $5 per month, then why not?</p>
<p>Hosting companies also offer virtual machines that your IT staff can run. These are a great alternative to hosting DR servers in remote data centers. VM plans are more expensive than a regular shared Web hosting plan, but not much more. With both options we need to pay close attention to the hosting company’s track record and value-add services.</p>
<p><strong>What to Expect</strong></p>
<p>There are literally hundreds of popular hosting companies out there. Each has their own tools for managing your domains, and each offers their own unique set of value-add services.</p>
<p>At a minimum, there are a few things you should demand from any Web host. Due to the brutally competitive nature of the business and interchangeability of these services, you should never be shy about demanding a new feature or picking up and moving to a new provider. A few of the basic things you should expect are:</p>
<ul>
<li>A Web interface to manage your domains, billing, and user accounts</li>
<li>Shell, SFTP, and various other methods of remote access</li>
<li>Unlimited MySQL databses, and an easy way to create and manage them</li>
<li>Easy, automated installation mechanisms for common open source Web applications</li>
<li>Unlimited e-mail boxes and a few options for Web-based access</li>
<li>Log analysis and detailed reporting</li>
<li>And lately: unlimited disk space and bandwidth</li>
</ul>
<p>Five or ten years ago you would not find most of these features with the most popular hosting companies. These days, however, they all offer most of these items and a lot more.</p>
<p>Companies that offer VM hosting, or Virtual Private Servers (VPS) as some call it, will provide a basic set of tools to manage your virtual machine. You can generally select from a few operating systems and reload it at any time. Afterwards, however, you’re on your own. You get the root password and are free to install whatever you need.</p>
<p><strong>Is it Worth It?</strong></p>
<p>Psychologically, most people have a problem purchasing something that appears too cheap. When looking at Web hosting services, the list of options leaves most people drooling. Then they see the price: sometimes less than $5 per month, for unlimited disk space, bandwidth, accounts, and with a free domain registration. How can they do that?</p>
<p>The servers must be horribly overloaded as these companies cram more and more customers onto them. At $60 per year per customer, the hosting company can’t exactly afford to buy top of the line servers, right?</p>
<p>The truth is, hosting is brutally competitive. Most companies fail. The ones that survive have a high level of automation to allow them to manage their servers with very little manhours. Even at today’s sub-$5 pricing for a monthly plan, that equates to one $3000 server per 50 customers, at their yearly rate. A properly configured Apache Web server environment should be able to handle 300 Web sites on today’s hardware without a problem.</p>
<p>Of course, someone could write a PHP script that goes wild and consumes way too many resources, slowing down the entire server. The hosting companies monitor the servers, and this type of thing is usually dealt with quickly. However, it is worthwhile to ask your chosen hosting company whether or not they allow adult content. Adult sites are generally very high-traffic, and if you’re site is sharing the same Web server, it may suffer performance issues.</p>
<p><strong>The Case for Secondary Hosting</strong></p>
<p>Enterprises should not rule out hosting providers. You don’t need to outsource your entire Web team, but part of a good disaster recovery strategy will certainly include multiple off-site resources. Instead of paying co-location fees and trodding your own servers to a datacenter across the country, why not get a few virtual machines in multiple locations?</p>
<p>If your physical server dies, you may be sending FTE to the remote site to replace the hardware. In a hosted VM environment, you never have to worry about taking employees away from their daily work and paying travel expenses. Just click a button in the hosting provider’s Web interface to create a new VM if something goes awry.</p>
<p>You can host your own Web servers, secondary DNS, or just about any other service your company relies upon. If you’re worried about reliability, you can always select two or three VM providers in separate parts of the country (or world). To equal the cost of one server in a co-location environment, you’d have probably 10-20 virtual machines spread throughout the world.</p>
<p><strong>Next Steps</strong></p>
<p>If you’re interested in hosting Web sites with a Web hosting provider or VMs, the next step is to do some research. Read reviews of various hosting companies, and pay attention to issues people cite. There will always be a certain amount of people unhappy with a service, but pay careful attention to what they are saying went wrong. Likewise, pay attention to the few positive reviews you might find. Most happy customers remain silent, so when you find a positive review it holds more weight than a rant.</p>
<p>“Cheap web hosting” is a great Google search. You will find a few unbiased sites that list providers, the services they offer, reviews, and pricing. We don’t want to make any recommendations, but just remember: more expensive is not always better in a fiercely competitive market such as Web hosting.</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a title="Click me to see the sites." href="#" onclick="$$('div.d59').each( function(e) { e.visualEffect('slide_down',{duration:2.5}) }); return false;"><strong><em>Share this! (we greatly appreciate you sharing with friends)</em></strong></a>
<br />
<div class="d59" style="overflow:hidden">
<br />
<a onclick="pageTracker._trackPageview('/outgoing/del.icio.us/post?url=http_3A_2F_2Fwww.longitudetech.com_2Fit-management_2Fis-cheap-web-hosting-worth-it_2F_amp_title=Is+Cheap+Web+Hosting+Worth+It_3F&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.longitudetech.com%2Fit-management%2Fis-cheap-web-hosting-worth-it%2F&amp;title=Is+Cheap+Web+Hosting+Worth+It%3F" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/digg.com/submit?phase=2_amp_url=http_3A_2F_2Fwww.longitudetech.com_2Fit-management_2Fis-cheap-web-hosting-worth-it_2F_amp_title=Is+Cheap+Web+Hosting+Worth+It_3F&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.longitudetech.com%2Fit-management%2Fis-cheap-web-hosting-worth-it%2F&amp;title=Is+Cheap+Web+Hosting+Worth+It%3F" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/www.facebook.com/sharer.php?u=http_3A_2F_2Fwww.longitudetech.com_2Fit-management_2Fis-cheap-web-hosting-worth-it_2F&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fwww.longitudetech.com%2Fit-management%2Fis-cheap-web-hosting-worth-it%2F" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/www.google.com/bookmarks/mark?op=edit_amp_output=popup_amp_bkmk=http_3A_2F_2Fwww.longitudetech.com_2Fit-management_2Fis-cheap-web-hosting-worth-it_2F_amp_title=Is+Cheap+Web+Hosting+Worth+It_3F&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fwww.longitudetech.com%2Fit-management%2Fis-cheap-web-hosting-worth-it%2F&amp;title=Is+Cheap+Web+Hosting+Worth+It%3F" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/reddit.com/submit?url=http_3A_2F_2Fwww.longitudetech.com_2Fit-management_2Fis-cheap-web-hosting-worth-it_2F_amp_title=Is+Cheap+Web+Hosting+Worth+It_3F&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.longitudetech.com%2Fit-management%2Fis-cheap-web-hosting-worth-it%2F&amp;title=Is+Cheap+Web+Hosting+Worth+It%3F" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/slashdot.org/bookmark.pl?url=http_3A_2F_2Fwww.longitudetech.com_2Fit-management_2Fis-cheap-web-hosting-worth-it_2F_amp_title=Is+Cheap+Web+Hosting+Worth+It_3F&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://slashdot.org/bookmark.pl?url=http%3A%2F%2Fwww.longitudetech.com%2Fit-management%2Fis-cheap-web-hosting-worth-it%2F&amp;title=Is+Cheap+Web+Hosting+Worth+It%3F" rel="nofollow" title="Add to&nbsp;Slashdot"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/slashdot.png" title="Add to&nbsp;Slashdot" alt="Add to&nbsp;Slashdot" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/www.stumbleupon.com/submit?url=http_3A_2F_2Fwww.longitudetech.com_2Fit-management_2Fis-cheap-web-hosting-worth-it_2F_amp_title=Is+Cheap+Web+Hosting+Worth+It_3F&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.longitudetech.com%2Fit-management%2Fis-cheap-web-hosting-worth-it%2F&amp;title=Is+Cheap+Web+Hosting+Worth+It%3F" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/twitter.com/home/?status=Check+out+Is+Cheap+Web+Hosting+Worth+It_3F+_+http_3A_2F_2Fwww.longitudetech.com_2Fit-management_2Fis-cheap-web-hosting-worth-it_2F&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+Is+Cheap+Web+Hosting+Worth+It%3F+@+http%3A%2F%2Fwww.longitudetech.com%2Fit-management%2Fis-cheap-web-hosting-worth-it%2F" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/myweb2.search.yahoo.com/myresults/bookmarklet?u=http_3A_2F_2Fwww.longitudetech.com_2Fit-management_2Fis-cheap-web-hosting-worth-it_2F_amp_t=Is+Cheap+Web+Hosting+Worth+It_3F&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwww.longitudetech.com%2Fit-management%2Fis-cheap-web-hosting-worth-it%2F&amp;t=Is+Cheap+Web+Hosting+Worth+It%3F" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
<a style="font-size:90%;text-align: right; " title="Click me to hide the sites." href="#" onclick="$$('div.d59').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); return false;">Hide Sites</a>
</div>
</div>
<!-- Social Bookmarks END -->


<p>Related posts:<ol><li><a href='http://www.longitudetech.com/linux-unix/managing-virtual-machine-and-cloud-sprawl/' rel='bookmark' title='Permanent Link: Managing Virtual Machine and Cloud Sprawl'>Managing Virtual Machine and Cloud Sprawl</a></li>
<li><a href='http://www.longitudetech.com/it-management/how-much-server-do-you-need/' rel='bookmark' title='Permanent Link: How Much Server do you Need?'>How Much Server do you Need?</a></li>
<li><a href='http://www.longitudetech.com/linux-unix/zenoss-we-can-ditch-nagios-now/' rel='bookmark' title='Permanent Link: Zenoss: We Can Ditch Nagios Now'>Zenoss: We Can Ditch Nagios Now</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.longitudetech.com/it-management/is-cheap-web-hosting-worth-it/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Multi-user Security in Linux</title>
		<link>http://www.longitudetech.com/linux-unix/multi-user-security-in-linux/</link>
		<comments>http://www.longitudetech.com/linux-unix/multi-user-security-in-linux/#comments</comments>
		<pubDate>Mon, 15 Mar 2010 17:16:05 +0000</pubDate>
		<dc:creator>charlie</dc:creator>
				<category><![CDATA[Linux / Unix]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://www.longitudetech.com/blog/?p=56</guid>
		<description><![CDATA[A wise man once said, “everyone is root if you allow them to login as a user,” in retort to a question about the security of a multi-user Linux system. There is plenty of truth in that, but just accepting eminent compromise isn’t always acceptable. Let’s take a look at how you can limit your [...]


Related posts:<ol><li><a href='http://www.longitudetech.com/linux-unix/the-perils-of-sudo-with-user-passwords/' rel='bookmark' title='Permanent Link: The Perils of Sudo With User Passwords'>The Perils of Sudo With User Passwords</a></li>
<li><a href='http://www.longitudetech.com/networking/built-in-security-with-cisco-ips/' rel='bookmark' title='Permanent Link: Built-in Security with Cisco IPS'>Built-in Security with Cisco IPS</a></li>
<li><a href='http://www.longitudetech.com/linux-unix/understanding-linux-virtual-memory/' rel='bookmark' title='Permanent Link: Understanding Linux Virtual Memory'>Understanding Linux Virtual Memory</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>A wise man once said, “everyone is root if you allow them to login as a user,” in retort to a question about the security of a multi-user Linux system. There is plenty of truth in that, but just accepting eminent compromise isn’t always acceptable. Let’s take a look at how you can limit your exposure while letting unknown and untrusted users login with a shell.</p>
<p>There are basically two groups of people who’d want to restrict login users heavily. First, the collaborators, possibly two separate organizations that have been forced to work together. Second, people who wish to allow some shady characters access to a shell, but believe they may attempt to compromise security. If at all possible, the best policy is to simply not give access out, and if you do, make sure patches are applied daily.</p>
<p><img class="alignleft" src="http://www.princeton.edu/plug/linux-penguin.png" alt="" width="227" height="260" />To say that you simply shouldn’t give out shells to untrustworthy users may work in a few instances. Say, for example, there is a need for remote users at another site to login and run the same series of commands every day. Say, for the sake of argument, their task can be easily scripted. If this is their only purpose on the server, a shell certainly isn’t necessary. OpenSSH allows a set of restrictions to be applied to an SSH key.</p>
<p>At the end of an SSH key entry, you can tack on these options:<br />
no-port-forwarding,no-X11-forwarding,no-agent-forwarding,command=&#8221;~/bin/script.sh”<br />
This effectively restricts any SSH connections using this key to only being allowed to run the mentioned script. This can even be a setuid script that restarts a web server, for example. It’s quite safe, because OpenSSH will reject any variation of the <em>command= </em>text. Users possessing this key will <em>only</em> be able to execute the command that is explicitly allowed.</p>
<p>Aside from that, and possibly some fancy web-based tools or cron jobs, there aren’t may options left. At times users just need to be able to login and work.</p>
<p>It should go without saying that you need to stay up-to-date on patches. We won’t focus too much on that, aside from saying: automate! Securing a machine is an entirely different topic all together, but here are a few points to consider.</p>
<p>Enabling SELinux (Security-Enhanced Linux) is your first line of defense against unknown attacks. SELinux can prevent buffer overflows, as opposed to simply taking the “updates” path, which requires that a publicly known hole be fixed before some tries to exploit it. SELinux provides a significantly improved access system to limit programs from accessing things they don’t require to be operational. That, combined with overflow prevention makes it quite difficult to compromise a Linux system.</p>
<p>Further, on the issue of securing a multi-user machine, there is a much-debated precept: that users shouldn’t be able to see what processes are running, unless they own them. This restriction is simple to enable in Linux and the BSD’s, but does it really buy you anything? The answer is “maybe,” and at the same time, “not really.” To satisfy the maybe camp, consider a process’s arguments. When you run a command with a given set of arguments, the command as well as the arguments will show up in a ‘ps’ listing. If you have provided a password on the command-line for some reason, it will be visible to anyone running a ‘ps’ while your process is still running. Many people think that allowing users to see running daemon processes on a server will allow them to know what to try attacking. This information is trivial to obtain via other means anyway, so “not really.”</p>
<p>Every time this discussion starts, someone quickly suggests a chroot jail. The chroot command stands for “change root,” which does just that. If you run the command: ‘chroot /home/charlie /bin/bash’ then chroot will look for the shell in /home/charlie/bin/bash, and then proceed to lock you into that directory. The new root of the file system, for the lifetime of the bash shell, is /home/charlie. You now have zero access to any other part of the actual file system. Any available command, and its required libraries, needs to be copied into the chroot jail. Providing a usable environment is a ton of work. It’s actually easier to give each user their own Linux Xen or Solaris Zone instance. Really.</p>
<p>Finally we come to the restricted shells. The most popular, rbash, is a restricted bash shell. Setting a user’s shell to rbash will provide absolutely zero security. In theory, rbash will prevent users from running anything by specifying a full path, including ‘./’ (the current directory). This implies that it’s difficult for users to run commands, including scripts they write or downloaded exploits. Since $PATH is controlled globally, users can only run things in those locations. Unfortunately, /bin/ is going to need to be in their path, so all a user needs to do is run a new shell, and rbash is no longer in the picture: ‘exec bash’</p>
<p>One method of alleviating this is to give users only one item in their path, a directory the administrator created. Within the directory, simply place symlinks to all the authorized commands. This is nearly as cumbersome as setting up chroot, but much more tolerable.</p>
<p>Security isn’t convenient, and if it is, you’re doing something wrong.</p>
<p>There are certainly ways to prevent users from running downloaded programs, but in the end, the multi-user security of a system will depend on security of every piece of software installed. Preventing the exploits from being successful, a la SELinux, adds the most viable method of protection. Coupled with a frequently updated system, additional restrictions such as rbash aren’t generally necessary.</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a title="Click me to see the sites." href="#" onclick="$$('div.d56').each( function(e) { e.visualEffect('slide_down',{duration:2.5}) }); return false;"><strong><em>Share this! (we greatly appreciate you sharing with friends)</em></strong></a>
<br />
<div class="d56" style="overflow:hidden">
<br />
<a onclick="pageTracker._trackPageview('/outgoing/del.icio.us/post?url=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fmulti-user-security-in-linux_2F_amp_title=Multi-user+Security+in+Linux&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fmulti-user-security-in-linux%2F&amp;title=Multi-user+Security+in+Linux" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/digg.com/submit?phase=2_amp_url=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fmulti-user-security-in-linux_2F_amp_title=Multi-user+Security+in+Linux&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fmulti-user-security-in-linux%2F&amp;title=Multi-user+Security+in+Linux" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/www.facebook.com/sharer.php?u=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fmulti-user-security-in-linux_2F&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fmulti-user-security-in-linux%2F" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/www.google.com/bookmarks/mark?op=edit_amp_output=popup_amp_bkmk=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fmulti-user-security-in-linux_2F_amp_title=Multi-user+Security+in+Linux&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fmulti-user-security-in-linux%2F&amp;title=Multi-user+Security+in+Linux" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/reddit.com/submit?url=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fmulti-user-security-in-linux_2F_amp_title=Multi-user+Security+in+Linux&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fmulti-user-security-in-linux%2F&amp;title=Multi-user+Security+in+Linux" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/slashdot.org/bookmark.pl?url=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fmulti-user-security-in-linux_2F_amp_title=Multi-user+Security+in+Linux&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://slashdot.org/bookmark.pl?url=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fmulti-user-security-in-linux%2F&amp;title=Multi-user+Security+in+Linux" rel="nofollow" title="Add to&nbsp;Slashdot"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/slashdot.png" title="Add to&nbsp;Slashdot" alt="Add to&nbsp;Slashdot" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/www.stumbleupon.com/submit?url=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fmulti-user-security-in-linux_2F_amp_title=Multi-user+Security+in+Linux&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fmulti-user-security-in-linux%2F&amp;title=Multi-user+Security+in+Linux" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/twitter.com/home/?status=Check+out+Multi-user+Security+in+Linux+_+http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fmulti-user-security-in-linux_2F&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+Multi-user+Security+in+Linux+@+http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fmulti-user-security-in-linux%2F" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/myweb2.search.yahoo.com/myresults/bookmarklet?u=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fmulti-user-security-in-linux_2F_amp_t=Multi-user+Security+in+Linux&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fmulti-user-security-in-linux%2F&amp;t=Multi-user+Security+in+Linux" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
<a style="font-size:90%;text-align: right; " title="Click me to hide the sites." href="#" onclick="$$('div.d56').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); return false;">Hide Sites</a>
</div>
</div>
<!-- Social Bookmarks END -->


<p>Related posts:<ol><li><a href='http://www.longitudetech.com/linux-unix/the-perils-of-sudo-with-user-passwords/' rel='bookmark' title='Permanent Link: The Perils of Sudo With User Passwords'>The Perils of Sudo With User Passwords</a></li>
<li><a href='http://www.longitudetech.com/networking/built-in-security-with-cisco-ips/' rel='bookmark' title='Permanent Link: Built-in Security with Cisco IPS'>Built-in Security with Cisco IPS</a></li>
<li><a href='http://www.longitudetech.com/linux-unix/understanding-linux-virtual-memory/' rel='bookmark' title='Permanent Link: Understanding Linux Virtual Memory'>Understanding Linux Virtual Memory</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.longitudetech.com/linux-unix/multi-user-security-in-linux/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>The Perils of Sudo With User Passwords</title>
		<link>http://www.longitudetech.com/linux-unix/the-perils-of-sudo-with-user-passwords/</link>
		<comments>http://www.longitudetech.com/linux-unix/the-perils-of-sudo-with-user-passwords/#comments</comments>
		<pubDate>Thu, 25 Feb 2010 17:11:37 +0000</pubDate>
		<dc:creator>charlie</dc:creator>
				<category><![CDATA[IT Management]]></category>
		<category><![CDATA[Linux / Unix]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://www.longitudetech.com/blog/?p=47</guid>
		<description><![CDATA[The consensus among new Unix and Linux users seems to be that sudo is more secure than using the root account, because it requires you type your password to perform potentially harmful actions. In reality, a compromised user account, which is no big deal normally, is instantly root in most setups. This sudo thinking is [...]


Related posts:<ol><li><a href='http://www.longitudetech.com/linux-unix/multi-user-security-in-linux/' rel='bookmark' title='Permanent Link: Multi-user Security in Linux'>Multi-user Security in Linux</a></li>
<li><a href='http://www.longitudetech.com/linux-unix/back-to-basics-unix-file-permissions/' rel='bookmark' title='Permanent Link: Back to Basics: Unix File Permissions'>Back to Basics: Unix File Permissions</a></li>
<li><a href='http://www.longitudetech.com/linux-unix/working-with-unix-variant-differences/' rel='bookmark' title='Permanent Link: Working With Unix Variant Differences'>Working With Unix Variant Differences</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>The consensus among new Unix and Linux users seems to be that sudo is more secure than using the root account, because it requires you type your password to perform potentially harmful actions. In reality, a compromised user account, which is no big deal normally, is instantly root in most setups. This sudo thinking is flawed, but sudo is actually useful for what’s it was designed for.</p>
<p>The (wrong) idea is that you shouldn’t use the root account, because apparently it’s too “dangerous.” This argument usually comes from new Linux users and people that call themselves “network administrators,” but has no basis in reality. We’ll come back to that in a moment.</p>
<p>The concept behind sudo is to give non-root users access to perform specific tasks without giving away the root password. It can also be used to log activity, if desired. Role-based access control isn’t available in Linux, so sudo is a great alternative, if used properly. Solaris 10 has greatly improved RBAC capabilities; so you can easily allow a junior admin access to web server restart scripts with the appropriate access levels, for example. Sudo is supposed to be configured to allow a certain set of people to run a very limited set of commands, as a different user.</p>
<p>Unfortunately, sysadmins and home users alike have begun using sudo for everything. Instead of running ‘su’ and becoming root, they believe that ‘sudo’ plus ‘command’ is a better alternative. Most of the time, sysadmins with full sudo access just end up running ‘sudo bash’ and doing all their work from that root shell. This is a problem.</p>
<p><strong>Using a user account password to get a root shell is a </strong><em><strong>bad</strong></em><strong> idea.</strong></p>
<p>Why is there a separate root account anyway? It isn’t to simply protect you from your own mistakes. If all sysadmins just become root using their user password (running: sudo bash), then why not just give them uid 0 (aka root) and be done with it? For a group of sysadmins, the only reason they should want to use sudo is for logging of commands. Unfortunately, this provides zero additional security or auditing, because an attacker would just run a shell. If sysadmins are un-trusted such that they need to be audited, they shouldn’t have root access in the first place.</p>
<p>Surprisingly, the home-user rational makes its way into the workplace as well. The recurring argument is that running a root shell is dangerous. Partially to blame for this grave misunderstanding is X login managers, for allowing the root user to login. New users are always scolded and explained to that running X as root is wrong. The same goes for many other applications, too. As time progressed, people started remembering that “running as root” is wrong, passing this idology down to their children, but without any details. A genetic mutation may have occurred, but insufficient research has been done on that topic thus far. Now that Ubuntu Linux doesn’t enable a root account by default, but instead allows full root access to the user via sudo, the world will never be the same.</p>
<p>People praise sudo, while demeaning Windows at the same time for not having any separation of privileges by default. The answer to security clearly is a multi-user system with privilege separation, but sudo blurs these lines in its most common usage. The Ubuntu usage of sudo simply provides a hoop to jump through, requiring users to type their password more often than they’d like. Of course this will prevent a user’s web browser from running something as root, but it isn’t security.</p>
<p><strong>We’d really like to focus on the Enterprise, where sudo has very little place.</strong></p>
<p>The sudo purists, or sudoists, we’ll call them, would have you run sudo before every command that requires root. Apparently running ‘sudo vi /etc/resolv.conf’ is supposed to make you remember that you’re root, and prevent mistakes. Sudoists will also say that it protects against “accidentally left open root shells” as well. If there are accidental shells left on computers with public access, well that’s an HR action item.</p>
<p>Sudo atheists will quickly point out that using sudo without specifically defined commands in the configuration file is a security risk. Sudoists user account passwords have root access, so in essence, sudo has un-done all security mechanisms in place. SSH doesn’t allow root to login, but with sudo, a compromised user password removes that restriction.</p>
<p>In a true multi-user environment, every so often a root compromise will happen. If users can login, they can eventually become root, and that’s just a fact of life. The first thing any old-school cracker installs is a hacked SSH program, to log user passwords. Ideally, this single hacked machine doesn’t have any sort of trust relationship with other computers, because users are allowed access. The next time an administrator logs into the hacked machine, his user account is compromised. Generally this isn’t a big deal, but with sudo, this means a complete root compromise, probably for all machines. Of course SSH keys can help, as will requiring separate passwords for administrators on the more important (non user accessible) servers; but if they’re willing to allow their user account access to unrestricted root-level commands, then it’s unlikely that there’s any other security in place elsewhere.</p>
<p>As we mentioned, sudo has its place. Allowing a single command to be run with elevated privileges in an operating system that doesn’t support such things is quite useful. Still, be very careful about who gets this access, even for one item. As with all software, sudo isn’t without <a href="http://www.courtesan.com/sudo/security.html" onclick="pageTracker._trackPageview('/outgoing/www.courtesan.com/sudo/security.html?referer=');">bugs</a>.</p>
<p>For the love of security, please, we beg of you, do not use sudo for full root access. Administrators keep separate, non-UID 0 accounts for a reason, and it’s not for “limiting the mistakes.” Everything should be done from a root shell, and you should have to know an uber-secret root password to access anything as root.</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a title="Click me to see the sites." href="#" onclick="$$('div.d47').each( function(e) { e.visualEffect('slide_down',{duration:2.5}) }); return false;"><strong><em>Share this! (we greatly appreciate you sharing with friends)</em></strong></a>
<br />
<div class="d47" style="overflow:hidden">
<br />
<a onclick="pageTracker._trackPageview('/outgoing/del.icio.us/post?url=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fthe-perils-of-sudo-with-user-passwords_2F_amp_title=The+Perils+of+Sudo+With+User+Passwords&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fthe-perils-of-sudo-with-user-passwords%2F&amp;title=The+Perils+of+Sudo+With+User+Passwords" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/digg.com/submit?phase=2_amp_url=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fthe-perils-of-sudo-with-user-passwords_2F_amp_title=The+Perils+of+Sudo+With+User+Passwords&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fthe-perils-of-sudo-with-user-passwords%2F&amp;title=The+Perils+of+Sudo+With+User+Passwords" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/www.facebook.com/sharer.php?u=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fthe-perils-of-sudo-with-user-passwords_2F&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fthe-perils-of-sudo-with-user-passwords%2F" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/www.google.com/bookmarks/mark?op=edit_amp_output=popup_amp_bkmk=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fthe-perils-of-sudo-with-user-passwords_2F_amp_title=The+Perils+of+Sudo+With+User+Passwords&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fthe-perils-of-sudo-with-user-passwords%2F&amp;title=The+Perils+of+Sudo+With+User+Passwords" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/reddit.com/submit?url=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fthe-perils-of-sudo-with-user-passwords_2F_amp_title=The+Perils+of+Sudo+With+User+Passwords&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fthe-perils-of-sudo-with-user-passwords%2F&amp;title=The+Perils+of+Sudo+With+User+Passwords" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/slashdot.org/bookmark.pl?url=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fthe-perils-of-sudo-with-user-passwords_2F_amp_title=The+Perils+of+Sudo+With+User+Passwords&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://slashdot.org/bookmark.pl?url=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fthe-perils-of-sudo-with-user-passwords%2F&amp;title=The+Perils+of+Sudo+With+User+Passwords" rel="nofollow" title="Add to&nbsp;Slashdot"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/slashdot.png" title="Add to&nbsp;Slashdot" alt="Add to&nbsp;Slashdot" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/www.stumbleupon.com/submit?url=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fthe-perils-of-sudo-with-user-passwords_2F_amp_title=The+Perils+of+Sudo+With+User+Passwords&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fthe-perils-of-sudo-with-user-passwords%2F&amp;title=The+Perils+of+Sudo+With+User+Passwords" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/twitter.com/home/?status=Check+out+The+Perils+of+Sudo+With+User+Passwords+_+http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fthe-perils-of-sudo-with-user-passwords_2F&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+The+Perils+of+Sudo+With+User+Passwords+@+http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fthe-perils-of-sudo-with-user-passwords%2F" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/myweb2.search.yahoo.com/myresults/bookmarklet?u=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fthe-perils-of-sudo-with-user-passwords_2F_amp_t=The+Perils+of+Sudo+With+User+Passwords&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fthe-perils-of-sudo-with-user-passwords%2F&amp;t=The+Perils+of+Sudo+With+User+Passwords" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
<a style="font-size:90%;text-align: right; " title="Click me to hide the sites." href="#" onclick="$$('div.d47').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); return false;">Hide Sites</a>
</div>
</div>
<!-- Social Bookmarks END -->


<p>Related posts:<ol><li><a href='http://www.longitudetech.com/linux-unix/multi-user-security-in-linux/' rel='bookmark' title='Permanent Link: Multi-user Security in Linux'>Multi-user Security in Linux</a></li>
<li><a href='http://www.longitudetech.com/linux-unix/back-to-basics-unix-file-permissions/' rel='bookmark' title='Permanent Link: Back to Basics: Unix File Permissions'>Back to Basics: Unix File Permissions</a></li>
<li><a href='http://www.longitudetech.com/linux-unix/working-with-unix-variant-differences/' rel='bookmark' title='Permanent Link: Working With Unix Variant Differences'>Working With Unix Variant Differences</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.longitudetech.com/linux-unix/the-perils-of-sudo-with-user-passwords/feed/</wfw:commentRss>
		<slash:comments>28</slash:comments>
		</item>
		<item>
		<title>Back to Basics: Unix System Stats Utilities</title>
		<link>http://www.longitudetech.com/linux-unix/back-to-basics-unix-system-stats-utilities/</link>
		<comments>http://www.longitudetech.com/linux-unix/back-to-basics-unix-system-stats-utilities/#comments</comments>
		<pubDate>Wed, 24 Feb 2010 17:24:29 +0000</pubDate>
		<dc:creator>charlie</dc:creator>
				<category><![CDATA[Linux / Unix]]></category>
		<category><![CDATA[education]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[monitoring]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[solaris]]></category>
		<category><![CDATA[tuning]]></category>

		<guid isPermaLink="false">http://www.longitudetech.com/blog/?p=46</guid>
		<description><![CDATA[Unix and Linux systems have forever been obtuse and mysterious for many people. They generally don’t have nice graphical utilities for displaying system performance information; you need to know how to coax the information you need. Furthermore, you need to know how to interpret the information you’re given. Let’s take a look at some common [...]


Related posts:<ol><li><a href='http://www.longitudetech.com/linux-unix/back-to-basics-unix-differences-in-performing-tasks/' rel='bookmark' title='Permanent Link: Back To Basics: Unix Differences in Performing Tasks'>Back To Basics: Unix Differences in Performing Tasks</a></li>
<li><a href='http://www.longitudetech.com/linux-unix/back-to-basics-unix-file-permissions/' rel='bookmark' title='Permanent Link: Back to Basics: Unix File Permissions'>Back to Basics: Unix File Permissions</a></li>
<li><a href='http://www.longitudetech.com/linux-unix/working-with-unix-variant-differences/' rel='bookmark' title='Permanent Link: Working With Unix Variant Differences'>Working With Unix Variant Differences</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Unix and Linux systems have forever been obtuse and mysterious for many people. They generally don’t have nice graphical utilities for displaying system performance information; you need to know how to coax the information you need. Furthermore, you need to know how to interpret the information you’re given. Let’s take a look at some common system tools that can provide tons of visibility into what the opaque OS is really doing.</p>
<p>Unfortunately, the same tools don’t exist universally across all Unix variants. A few commonly underused ones do, however, and that is what we’ll focus on first.</p>
<p><strong>Disk Activity</strong><br />
A common source of “slowness” is disk I/O, or rather the lack of available I/O. On Linux especially, it may be a difficult diagnosis. Often the load average will climb quickly, but without any corresponding processes in top eating much CPU. Linux counts “iowait” as CPU time when calculating load average. I’ve seen load numbers in the tens of thousands, on more than one occasion.</p>
<p>The easiest way to see what’s happening to your disks is to run the ‘iostat’ program. Via iostat, you can see how many read and write operations are happening per device, how much CPU is being utilized, and how long each transaction takes. Many arguments are available for iostat, so do spend some time with the man page on your specific system. By default, running &#8216;iostat&#8217; with no arguments produces a report about disk IO since boot. To get a snapshot of &#8220;now&#8221; add a numerical argument last, which will prompt iostat to gather statistics for that number of seconds.</p>
<p>Linux will show number of blocks read or written per second, along with some useful CPU statistics. This is one particularly busy server:</p>
<pre> avg-cpu:  %user   %nice %system %iowait  %steal   %idle
 1.36    0.07    5.21   23.80    0.00   69.57</pre>
<pre>Device:   tps   Blk_read/s   Blk_wrtn/s   Blk_read   Blk_wrtn
sda       18.22     15723.35       643.25 65474958946 2678596632</pre>
<p>Notice that iowait is at 23%. This means that 23% of the time this server is waiting on disk I/O. Some Solaris iostat output shows a similar thing, just represented differently(iostat -xnz):</p>
<pre>    r/s    w/s   kr/s   kw/s wait actv wsvc_t asvc_t  %w  %b device
295.3   79.7 5657.8  211.0  0.0 10.3    0.0   27.4   0 100 d101
134.8   16.4 4069.8  116.0  0.0  3.5    0.0   23.3   0  90 d105</pre>
<p>The %b (block) column shows that I/O to device d101 is 100% blocked waiting for the device to complete transaction. The average service time isn&#8217;t good either: disk reads shouldn&#8217;t take 27.4ms. Arguably, Solaris&#8217;s output is more friendly to parse, since it gives the reads per second in kilobytes rather than blocks. We can quickly calculate that this server is reading about 19KB per read by dividing the number of KB read per second by the number of reads that happened. In short: this disk array is being taxed by large amounts of read requests.</p>
<p><strong>Vmstat</strong><br />
The &#8216;vmstat&#8217; program is also universally available, and extremely useful. It, too, provides vastly different information among operating systems. The vmstat utility will show you statistics about the virtual memory subsystem, or to put it simply: swap space. It is much more complex than just swap, as nearly every IO operation involves the VM system when pages of memory are allocated.A disk write, network packet send, and the obvious &#8220;program allocates RAM&#8221; all impact what you see in vmstat.</p>
<p>Running vmstat with the -p argument will print out statistics about disk IO. In Solaris you get some disk information anyway, as seen below:</p>
<pre> kthr      memory            page            disk
 faults      cpu  r b w   swap
free  re  mf pi po fr de sr m0 m1 m2 m7
in   sy   cs us sy id  0 0 0 7856104 526824 386 2401 0 0 0  0  0  3  0  0  0
16586 22969 12576 8 9 83  1 0 0 7851344 522016 18 678 32 0  0  0  0  2
0  0  0 13048 11737 10197 7 6 86  0 0 0 7843584 514128 76 3330 197 0
0 0  0  2  0  0  0 4762 131492 4441 16 8 76</pre>
<p>A subtle, but important differences between Solaris and Linux is that Solaris will start scanning for pages of memory that can be freed before it will actually start swapping RAM to disk. The &#8216;sr&#8217; column, scan rate, will start increasing right before swapping takes place, and continue until some RAM is available. The normal things are available in all operating systems; these include: swap space, free memory, pages in and out (careful, this doesn&#8217;t mean swapping is happening), page faults, context switches, and some CPU idle/system/user statistics. Once you know how to interpret these items you quickly learn to infer what they indicate about the usage of your system.</p>
<p>The two main programs for finding &#8220;slowness&#8221; are therefore iostat and vmstat. Before the obligatory tangent into &#8220;what Dtrace can do for you,&#8221; here&#8217;s a few other tools that no Unix junkie should leave home without:</p>
<dl>
<dt>lsof</dt>
<dd>Lists open files (including network ports) for all processes</dd>
<dt>netstat</dt>
<dd>Lists all sockets in use by the system</dd>
<dt>mpstat</dt>
<dd>Shows CPU statistics (including IO), per-processor</dd>
</dl>
<p>Dtrace<br />
We cannot talk about system visibility without mentioning Dtrace. Invented by Sun, Dtrace provides dynamic tracing of everything about a system. Dtrace gives you the ability to ask any arbitrary question about the state of a system, which works by calling &#8220;probes&#8221; within the kernel. That sounds intimidating, doesn&#8217;t it?</p>
<p>Let&#8217;s say that we wanted to know what files were being read or written on our Linux server that has a high iowait percentage. There&#8217;s simply no way to know. Let&#8217;s ask the same question of Solaris, and instead of learning Dtrace, we&#8217;ll find something useful in the <a href="http://opensolaris.org/os/community/dtrace/dtracetoolkit/" onclick="pageTracker._trackPageview('/outgoing/opensolaris.org/os/community/dtrace/dtracetoolkit/?referer=');">Dtrace ToolKit</a>. In the kit, you&#8217;ll find a few neat programs like iosnoop and iotop, which will tell you which processes are doing all the disk IO operations. Neat, but we really want to know what files are being accessed so much. In the FS directory, the rfileio.d script will provide this information. Run it, and you&#8217;ll see every file that&#8217;s read or written, and cache hit statistics. There&#8217;s no way to get this information in other Unixes, and this is just one simple example of how Dtrace is invaluable.</p>
<p>The script itself is about 90 lines, inclusive of comments, but the bulk of it is dealing with cache statistics. An excellent way to start learning Dtrace is to simply read the Dtrace ToolKit scripts.</p>
<p>Don&#8217;t worry if you&#8217;re not a Solaris admin: Dtrace is coming soon to a FreeBSD near you. SystemTap, a replica of Dtrace, will be available for Linux soon as well. Until then, and even afterward, the above mentioned tools will still be invaluable. If you can quickly get disk IO statistics and see if you&#8217;re swapping the majority of system performance problems are solved. Dtrace also provides amazing application tracing functionality, and if you&#8217;re looking at the application itself, you already know the slowness isn&#8217;t likely being caused by a system problem.</p>
<p>Soon, I&#8217;ll publish a few Dtrace tutorials.</p>
<p>Some things have surely been left out &#8211; discuss below!</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a title="Click me to see the sites." href="#" onclick="$$('div.d46').each( function(e) { e.visualEffect('slide_down',{duration:2.5}) }); return false;"><strong><em>Share this! (we greatly appreciate you sharing with friends)</em></strong></a>
<br />
<div class="d46" style="overflow:hidden">
<br />
<a onclick="pageTracker._trackPageview('/outgoing/del.icio.us/post?url=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fback-to-basics-unix-system-stats-utilities_2F_amp_title=Back+to+Basics_3A+Unix+System+Stats+Utilities&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fback-to-basics-unix-system-stats-utilities%2F&amp;title=Back+to+Basics%3A+Unix+System+Stats+Utilities" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/digg.com/submit?phase=2_amp_url=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fback-to-basics-unix-system-stats-utilities_2F_amp_title=Back+to+Basics_3A+Unix+System+Stats+Utilities&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fback-to-basics-unix-system-stats-utilities%2F&amp;title=Back+to+Basics%3A+Unix+System+Stats+Utilities" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/www.facebook.com/sharer.php?u=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fback-to-basics-unix-system-stats-utilities_2F&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fback-to-basics-unix-system-stats-utilities%2F" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/www.google.com/bookmarks/mark?op=edit_amp_output=popup_amp_bkmk=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fback-to-basics-unix-system-stats-utilities_2F_amp_title=Back+to+Basics_3A+Unix+System+Stats+Utilities&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fback-to-basics-unix-system-stats-utilities%2F&amp;title=Back+to+Basics%3A+Unix+System+Stats+Utilities" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/reddit.com/submit?url=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fback-to-basics-unix-system-stats-utilities_2F_amp_title=Back+to+Basics_3A+Unix+System+Stats+Utilities&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fback-to-basics-unix-system-stats-utilities%2F&amp;title=Back+to+Basics%3A+Unix+System+Stats+Utilities" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/slashdot.org/bookmark.pl?url=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fback-to-basics-unix-system-stats-utilities_2F_amp_title=Back+to+Basics_3A+Unix+System+Stats+Utilities&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://slashdot.org/bookmark.pl?url=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fback-to-basics-unix-system-stats-utilities%2F&amp;title=Back+to+Basics%3A+Unix+System+Stats+Utilities" rel="nofollow" title="Add to&nbsp;Slashdot"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/slashdot.png" title="Add to&nbsp;Slashdot" alt="Add to&nbsp;Slashdot" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/www.stumbleupon.com/submit?url=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fback-to-basics-unix-system-stats-utilities_2F_amp_title=Back+to+Basics_3A+Unix+System+Stats+Utilities&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fback-to-basics-unix-system-stats-utilities%2F&amp;title=Back+to+Basics%3A+Unix+System+Stats+Utilities" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/twitter.com/home/?status=Check+out+Back+to+Basics_3A+Unix+System+Stats+Utilities+_+http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fback-to-basics-unix-system-stats-utilities_2F&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+Back+to+Basics%3A+Unix+System+Stats+Utilities+@+http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fback-to-basics-unix-system-stats-utilities%2F" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/myweb2.search.yahoo.com/myresults/bookmarklet?u=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fback-to-basics-unix-system-stats-utilities_2F_amp_t=Back+to+Basics_3A+Unix+System+Stats+Utilities&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fback-to-basics-unix-system-stats-utilities%2F&amp;t=Back+to+Basics%3A+Unix+System+Stats+Utilities" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
<a style="font-size:90%;text-align: right; " title="Click me to hide the sites." href="#" onclick="$$('div.d46').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); return false;">Hide Sites</a>
</div>
</div>
<!-- Social Bookmarks END -->


<p>Related posts:<ol><li><a href='http://www.longitudetech.com/linux-unix/back-to-basics-unix-differences-in-performing-tasks/' rel='bookmark' title='Permanent Link: Back To Basics: Unix Differences in Performing Tasks'>Back To Basics: Unix Differences in Performing Tasks</a></li>
<li><a href='http://www.longitudetech.com/linux-unix/back-to-basics-unix-file-permissions/' rel='bookmark' title='Permanent Link: Back to Basics: Unix File Permissions'>Back to Basics: Unix File Permissions</a></li>
<li><a href='http://www.longitudetech.com/linux-unix/working-with-unix-variant-differences/' rel='bookmark' title='Permanent Link: Working With Unix Variant Differences'>Working With Unix Variant Differences</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.longitudetech.com/linux-unix/back-to-basics-unix-system-stats-utilities/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Back To Basics: Unix Differences in Performing Tasks</title>
		<link>http://www.longitudetech.com/linux-unix/back-to-basics-unix-differences-in-performing-tasks/</link>
		<comments>http://www.longitudetech.com/linux-unix/back-to-basics-unix-differences-in-performing-tasks/#comments</comments>
		<pubDate>Tue, 23 Feb 2010 17:44:31 +0000</pubDate>
		<dc:creator>charlie</dc:creator>
				<category><![CDATA[Linux / Unix]]></category>
		<category><![CDATA[aix]]></category>
		<category><![CDATA[education]]></category>
		<category><![CDATA[freebsd]]></category>
		<category><![CDATA[hpux]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[solaris]]></category>

		<guid isPermaLink="false">http://www.longitudetech.com/blog/?p=44</guid>
		<description><![CDATA[It has often been said that a skilled sysadmin can quickly come up to speed with any Unix system in a matter of hours. After all, the underlying principals are all the same. Fortunately, this is somewhat correct. Unfortunately, this also leads to people making changes on systems they do not understand, often times in [...]


Related posts:<ol><li><a href='http://www.longitudetech.com/linux-unix/working-with-unix-variant-differences/' rel='bookmark' title='Permanent Link: Working With Unix Variant Differences'>Working With Unix Variant Differences</a></li>
<li><a href='http://www.longitudetech.com/linux-unix/back-to-basics-unix-system-stats-utilities/' rel='bookmark' title='Permanent Link: Back to Basics: Unix System Stats Utilities'>Back to Basics: Unix System Stats Utilities</a></li>
<li><a href='http://www.longitudetech.com/linux-unix/back-to-basics-unix-file-permissions/' rel='bookmark' title='Permanent Link: Back to Basics: Unix File Permissions'>Back to Basics: Unix File Permissions</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>It has often been said that a skilled sysadmin can quickly come up to speed with any Unix system in a matter of hours. After all, the underlying principals are all the same. Fortunately, this is somewhat correct. Unfortunately, this also leads to people making changes on systems they do not understand, often times in suboptimal ways.</p>
<p>In this final Back to Basics With Unix piece, we’d like to spend some time talking about some common, routine sysadmin tasks and how they differ between Unix variants.</p>
<p>Sure, you can clunk around and change configuration files to mostly make something work on a foreign system. But will those changes <img class="alignleft size-medium wp-image-45" title="unix_plate-med" src="http://www.longitudetech.com/blog/wp-content/uploads/2010/02/unix_plate-med-300x152.jpg" alt="" width="300" height="152" />remain after security patches get applied and stomp all over your work? Did you just change a file that was meant to never change, because there’s a separate file for local modifications? If you’re not familiar with “how it’s done” in that particular OS, it’s as likely as not.</p>
<p><strong>GUIs</strong><br />
Yes, I make fun of GUI configuration utilities. People that don’t understand systems often use them and “get by,” but they cannot fix things when they break, unless the GUI tool can do it for them. That said, they do have their place. When learning a new system, it often makes sense to use the provided configuration utilities, as you know without a doubt they will adjust the necessary setting they way the OS wants it done. Here’s a list of some handy general administration GUIs:</p>
<p>-	AIX: smitty (does pretty much everything)<br />
-	FreeBSD: sysinstall (not recommended for use after the initial install, but it works)<br />
-	HP-UX: sam (like AIX’s smitty)<br />
-	Linux: system-config, webmin and many others (distro-dependant)<br />
-	Solaris: admintool, wbem (use with caution)</p>
<p>Often, these tools still don’t do what you need. They certainly don’t help you learn a system unless you take the time to examine what the tool actually changed. Let’s start off with the basics: gathering system information and managing hardware. It can be a nightmare to add a disk to a foreign system, so hopefully this list will get you steered in the proper direction.</p>
<p><strong>Show hardware configuration</strong>:<br />
-	AIX: lsdev, lscfg, prtconf<br />
-	FreeBSD: /var/run/dmesg.boot, pciconf<br />
-	HP-UX: ioscan, model, getconf, print_manifest<br />
-	Linux: dmesg, lspci, lshw, dmidecode<br />
-	Solaris: prtconf, prtdiag, psrinfo, cfgadm</p>
<p>Note that ‘dmesg’ is a circular kernel buffer on most systems, and after the machine has been up for a while the boot information listing devices gets overwritten. FreeBSD thoughtfully saves it in dmesg.boot for you, but in other systems you’re left relying on the above-mentioned exploratory tools.</p>
<p><strong>Add a new device</strong> (have the OS discover it without a reboot):<br />
-	AIX: cfgmgr<br />
-	FreeBSD: atacontrol, camcontrol<br />
-	HP-UX: ioscan, insf<br />
-	Linux: udev, hotplug (automatic)<br />
-	Solaris: devfsadm, disks, devlinks (all a hardlink to the same binary now)</p>
<p>If you connect a new internal disk and need it recognized, you should not need to reboot in the Unix world. The above commands will discover new devices and make them available. If you’re talking about SAN disks, the utilities are mostly the same, but there are other programs that make the process much easier and also allow for multipathing configurations.</p>
<p><strong>Label and partition a disk</strong>:<br />
-	AIX: mkvg then mklv<br />
-	FreeBSD: fdisk or sysinstall<br />
-	HP-UX: pvcreate then lvcreate, or sam<br />
-	Linux: fdisk or others<br />
-	Solaris: format or fmthard</p>
<p>Of course, you’ll also want to create a file system on your new disk. This is newfs or mkfs everywhere, with the exception of AIX which forces you to use crfs. The filesystem tab file, which describes file systems and mount options, vary a bit as well. In Linux, FreeBSD, and HP-UX it is /etc/fstab, Solaris uses /etc/vfstab, and AIX references /etc/filesystems. We spent so much time on filesystems and hardware because that’s the generally the biggest hurdle when learning a new system, and when you’re needing to do it, often you’re in a hurry.</p>
<p>Other tasks may or may not be covered by GUI utilities in the various flavors of Unix, so here’s a few more that we deem crucial to understand.</p>
<p><strong>Display IP information and change IP address permanently</strong>:<br />
-	AIX: ifconfig/lsattr; smitty or chdev<br />
-	FreeBSD: ifconfig; /etc/rc.conf<br />
-	HP-UX: ifconfig/lanadmin; set_params<br />
-	Linux: &#8216;ip addr&#8217;; /etc/sysconfig/network or /etc/network/interfaces<br />
-	Solaris: ifconfig; edit /etc/hosts, /etc/hostname.*</p>
<p>Linux will of course vary, but those two files cover the most popular distros.</p>
<p>When taking over a foreign system, we frequently want to two two things: install missing software (like GNU utilities), and verify that the system is up-to-date on security patches. Where to get packages and where to gete latest security patches varies too much to cover here—you’ll likely need to search to the OS in question—but the way you install packages and show installed patches is extremely useful to know.</p>
<p><strong>List installed patches</strong>:<br />
-	AIX: instfix, oslevel<br />
-	FreeBSD: uname<br />
-	HP-UX: swlist<br />
-	Linux: rpm, dpkg<br />
-	Solaris: showrev</p>
<p><strong>Install packages</strong>:<br />
-	AIX: smitty, rpm, installp<br />
-	FreeBSD: pkg_add, portinstall, sysinstall<br />
-	HP-UX: swinstall<br />
-	Linux: rpm, yum, apt, yast, etc.<br />
-	Solaris: pkgadd</p>
<p>As you can see, things vary immensely between the Unix variants. Even within all of Linux you can easily find yourself lost. Google is a friend to all sysadmins, but too often the conceptual questions go unanswered. Here’s a general rule of thumb, and something I’ve seen done incorrectly too many times: if you see a configuration file in /etc/, say syslog.conf, and there is an accompanying syslog.d directory, you are not supposed to edit the syslog.conf file directly. The same goes for pam.conf and pam.d. Each service will have their own file within the .d directory, and that is where they are configured.</p>
<p>The .d directory example is mostly applicable to Linux, but be sure to pay attention when you see similar multi-config layouts anywhere else. Future sysadmins using the system will thank you if the OS’s conventions are followed and it’s easy to identify customizations. It also means that your changes aren’t likely to be stomped over by updates.</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a title="Click me to see the sites." href="#" onclick="$$('div.d44').each( function(e) { e.visualEffect('slide_down',{duration:2.5}) }); return false;"><strong><em>Share this! (we greatly appreciate you sharing with friends)</em></strong></a>
<br />
<div class="d44" style="overflow:hidden">
<br />
<a onclick="pageTracker._trackPageview('/outgoing/del.icio.us/post?url=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fback-to-basics-unix-differences-in-performing-tasks_2F_amp_title=Back+To+Basics_3A+Unix+Differences+in+Performing+Tasks&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fback-to-basics-unix-differences-in-performing-tasks%2F&amp;title=Back+To+Basics%3A+Unix+Differences+in+Performing+Tasks" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/digg.com/submit?phase=2_amp_url=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fback-to-basics-unix-differences-in-performing-tasks_2F_amp_title=Back+To+Basics_3A+Unix+Differences+in+Performing+Tasks&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fback-to-basics-unix-differences-in-performing-tasks%2F&amp;title=Back+To+Basics%3A+Unix+Differences+in+Performing+Tasks" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/www.facebook.com/sharer.php?u=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fback-to-basics-unix-differences-in-performing-tasks_2F&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fback-to-basics-unix-differences-in-performing-tasks%2F" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/www.google.com/bookmarks/mark?op=edit_amp_output=popup_amp_bkmk=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fback-to-basics-unix-differences-in-performing-tasks_2F_amp_title=Back+To+Basics_3A+Unix+Differences+in+Performing+Tasks&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fback-to-basics-unix-differences-in-performing-tasks%2F&amp;title=Back+To+Basics%3A+Unix+Differences+in+Performing+Tasks" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/reddit.com/submit?url=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fback-to-basics-unix-differences-in-performing-tasks_2F_amp_title=Back+To+Basics_3A+Unix+Differences+in+Performing+Tasks&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fback-to-basics-unix-differences-in-performing-tasks%2F&amp;title=Back+To+Basics%3A+Unix+Differences+in+Performing+Tasks" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/slashdot.org/bookmark.pl?url=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fback-to-basics-unix-differences-in-performing-tasks_2F_amp_title=Back+To+Basics_3A+Unix+Differences+in+Performing+Tasks&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://slashdot.org/bookmark.pl?url=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fback-to-basics-unix-differences-in-performing-tasks%2F&amp;title=Back+To+Basics%3A+Unix+Differences+in+Performing+Tasks" rel="nofollow" title="Add to&nbsp;Slashdot"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/slashdot.png" title="Add to&nbsp;Slashdot" alt="Add to&nbsp;Slashdot" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/www.stumbleupon.com/submit?url=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fback-to-basics-unix-differences-in-performing-tasks_2F_amp_title=Back+To+Basics_3A+Unix+Differences+in+Performing+Tasks&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fback-to-basics-unix-differences-in-performing-tasks%2F&amp;title=Back+To+Basics%3A+Unix+Differences+in+Performing+Tasks" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/twitter.com/home/?status=Check+out+Back+To+Basics_3A+Unix+Differences+in+Performing+Tasks+_+http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fback-to-basics-unix-differences-in-performing-tasks_2F&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+Back+To+Basics%3A+Unix+Differences+in+Performing+Tasks+@+http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fback-to-basics-unix-differences-in-performing-tasks%2F" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/myweb2.search.yahoo.com/myresults/bookmarklet?u=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fback-to-basics-unix-differences-in-performing-tasks_2F_amp_t=Back+To+Basics_3A+Unix+Differences+in+Performing+Tasks&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fback-to-basics-unix-differences-in-performing-tasks%2F&amp;t=Back+To+Basics%3A+Unix+Differences+in+Performing+Tasks" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
<a style="font-size:90%;text-align: right; " title="Click me to hide the sites." href="#" onclick="$$('div.d44').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); return false;">Hide Sites</a>
</div>
</div>
<!-- Social Bookmarks END -->


<p>Related posts:<ol><li><a href='http://www.longitudetech.com/linux-unix/working-with-unix-variant-differences/' rel='bookmark' title='Permanent Link: Working With Unix Variant Differences'>Working With Unix Variant Differences</a></li>
<li><a href='http://www.longitudetech.com/linux-unix/back-to-basics-unix-system-stats-utilities/' rel='bookmark' title='Permanent Link: Back to Basics: Unix System Stats Utilities'>Back to Basics: Unix System Stats Utilities</a></li>
<li><a href='http://www.longitudetech.com/linux-unix/back-to-basics-unix-file-permissions/' rel='bookmark' title='Permanent Link: Back to Basics: Unix File Permissions'>Back to Basics: Unix File Permissions</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.longitudetech.com/linux-unix/back-to-basics-unix-differences-in-performing-tasks/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>LDAP: Understand the Protocol and Work With Entries</title>
		<link>http://www.longitudetech.com/linux-unix/ldap-understand-the-protocol-and-work-with-entries/</link>
		<comments>http://www.longitudetech.com/linux-unix/ldap-understand-the-protocol-and-work-with-entries/#comments</comments>
		<pubDate>Mon, 22 Feb 2010 18:57:55 +0000</pubDate>
		<dc:creator>charlie</dc:creator>
				<category><![CDATA[Linux / Unix]]></category>
		<category><![CDATA[ldap]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://www.longitudetech.com/blog/?p=42</guid>
		<description><![CDATA[Last week we explained how LDAP directories work, without really explaining how to use them. This week we’ll show how LDAP queries work, after explaining how the protocol works. The LDAP protocol supports just a few fairly easy to understand operations. Knowing what’s available provides administrators with the ability to surmise how various applications are [...]


Related posts:<ol><li><a href='http://www.longitudetech.com/linux-unix/an-introduction-to-ldap/' rel='bookmark' title='Permanent Link: An Introduction to LDAP'>An Introduction to LDAP</a></li>
<li><a href='http://www.longitudetech.com/linux-unix/back-to-basics-unix-system-stats-utilities/' rel='bookmark' title='Permanent Link: Back to Basics: Unix System Stats Utilities'>Back to Basics: Unix System Stats Utilities</a></li>
<li><a href='http://www.longitudetech.com/linux-unix/multi-user-security-in-linux/' rel='bookmark' title='Permanent Link: Multi-user Security in Linux'>Multi-user Security in Linux</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Last week we explained <a href="http://www.longitudetech.com/blog/linux-unix/an-introduction-to-ldap/">how LDAP directories work</a>, without really explaining how to use them. This week we’ll show how LDAP queries work, after explaining how the protocol works.</p>
<p>The LDAP protocol supports just a few fairly easy to understand operations. Knowing what’s available provides administrators with the ability to surmise how various applications are using LDAP, troubleshoot issues, and construct their own search queries and filters more effectively.</p>
<p><img class="alignleft size-full wp-image-43" title="ldap icon" src="http://www.longitudetech.com/blog/wp-content/uploads/2010/02/ldap-icon.jpg" alt="" width="175" height="96" />A client, be it a PHP script, command-line program like ldapsearch, or LDAP libraries for user authentication in Unix, will connect to a server on port 389 (or 636 with SSL), and send one of roughly a dozen operation requests. The following operations define how the LDAP protocol works:</p>
<p><strong>Bind</strong><br />
Binding is the pivotal concept to understand. It is optional, depending on access control restrictions defined in the server. The act of binding is authentication: it sends a user’s DN and password. Binding anonymously may not allow access to all directory entries, or it may not be allowed at all, again depending on how the server is configured.</p>
<p><strong>Search or Compare</strong><br />
Search is used to both list entries and search for them. Searching supports a number of parameters, which define how the search is carried out.</p>
<ul>
<li> Base: object to start at</li>
<li> Scope: how much to search; one entry only, a single level below, or the entire subtree below</li>
<li> Filter: limit (optimize) search based on attribute/value or object filters</li>
<li> derefAliases: whether or not to follow alias entries</li>
<li> attributes: which attributes to return (none specified means return all)</li>
<li> sizeLimit, timeLimit: number of entries to return, and a time limit</li>
<li> typesOnly: just return the attribute types, not the actual values</li>
</ul>
<p><strong>Add, Delete, Modify (Update types)</strong><br />
Updating an LDAP entry can take the form of three operations: add, delete, or modify. Actually four, because modify can modify either an entry or a DN. As was explained last week, modifying the DN simply means moving an entry. Add and Delete do the obvious.</p>
<p><strong>Extended Operations</strong><br />
Extended operations can be added at will. For example, many servers support the STARTTLS command, tells the server to start a secure connection.</p>
<p><strong>Abandon</strong><br />
An Abandon operation will abandon any operation, hopefully. There is no guarantee the server will honor an abandon request.</p>
<p><strong>Unbind</strong><br />
Unbind abandons any outstanding operations and disconnects a client.</p>
<p>As mentioned before, LDAP is pretty simple. You can connect, search or update entries, and then disconnect. Nearly every LDAP communication follows those three steps.</p>
<p>So how does one connect? The majority of connections to an LDAP server are made by LDAP client programs on a Unix machine, in environments that use LDAP for server directory services. Web applications often gather and display directory information, or use LDAP to authenticate people. Aside from those, LDAP connections can also be made by Perl or even shell scripts to manage the information within. When you want to manually search or update information, you will generally use some common tools such as ldapsearch, ldapvi, or ldapmodify.</p>
<p>Searching an LDAP directory can be challenging if you’ve never done it before. The command-line utilities have a few arguments that aren’t optional. Let’s take a look at an ldapsearch example:<br />
<code>ldapsearch –h ldapserver.example.com –b ou=People,dc=example,dc=com uid=charlie</code></p>
<p>The ldapsearch program, in most Unix/Linux environments, take the same arguments. You must specify a server (-h) and a base (-b) to begin searching at. The base can be as broad or as specific as you’d like. We’ve chose to start searching at the ou (organizational unit) called people, withing the domain components used to designate our portion of the tree. I could have left out the ou=People portion, but if there is anything else at the level below dc=example, then it would search through those too. It faster to specify the subtree as close to the entry as possible, if you know it. Finally, the last argument was a search filter. I stated that I was interested in all entries where the value of the attribute uid was “charlie.”</p>
<p>The previous example used an anonymous bind, since a DN wasn’t specified. If you need to search information that is restricted to certain people, then specifying –D followed by a user DN will cause ldapsearch to bind as that user, and prompt for a password.</p>
<p>Search filters can be quite complex. When you’re searching manually with ldapsearch, you probably won’t get very complex. When writing a script that could potentially be run very often, you want as optimal a search as possible. Search filters can specify many thing, including what object classes to look for. It’s all about providing as many hints to the server as possible, so that it may make best use of its search indexes.</p>
<p>A search filter has a few basic operators, including “and” and “or” operators. The general syntax is similar to RPN (for math geeks) or functional languages (for programmers). If we want to search for a person whose given name is Bob, and mail attribute is also bob, we could use a search filter of:<br />
<code>(&amp;(givenName=bob)(mail=bob))<br />
</code><br />
If we wanted to return all entries where either bob is the givenName or the mail attribute, we could simply specify: <code>(|(givenName=bob)(mail=bob))</code><br />
Notice the | symbol, followed by two or more attribute/value pairs. In reality, we would really want to specify what object class we’re looking for, if this was used in a script: (&amp;(objectClass=person)(|(givenName=bob)(mail=bob)))<br />
The filter ensures that the objectClass is person, and the other nested statement is true. Again, we’re just trying to give as many hints to the server as possible.</p>
<p>An LDAP URL is similar, but it contains all the information necessary to both identify a server and perform a search. URLs similar to this one, or portions of it, may be required to configure some LDAP clients: <code>ldap://ldap.example.com/ou=People,dc=example,dc=com?one?(pod=evil)</code></p>
<p>The general format is: <code>ldap://host:port/BaseDN?attributes?scope?filter</code></p>
<p>LDAP is extremely powerful, and is certainly the best place for server-based directory information and people information. If you already live in an LDAP environment, hopefully you have a better understanding now. If you’re pondering an LDAP deployment, go and unleash the power now.</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a title="Click me to see the sites." href="#" onclick="$$('div.d42').each( function(e) { e.visualEffect('slide_down',{duration:2.5}) }); return false;"><strong><em>Share this! (we greatly appreciate you sharing with friends)</em></strong></a>
<br />
<div class="d42" style="overflow:hidden">
<br />
<a onclick="pageTracker._trackPageview('/outgoing/del.icio.us/post?url=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fldap-understand-the-protocol-and-work-with-entries_2F_amp_title=LDAP_3A+Understand+the+Protocol+and+Work+With+Entries&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fldap-understand-the-protocol-and-work-with-entries%2F&amp;title=LDAP%3A+Understand+the+Protocol+and+Work+With+Entries" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/digg.com/submit?phase=2_amp_url=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fldap-understand-the-protocol-and-work-with-entries_2F_amp_title=LDAP_3A+Understand+the+Protocol+and+Work+With+Entries&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fldap-understand-the-protocol-and-work-with-entries%2F&amp;title=LDAP%3A+Understand+the+Protocol+and+Work+With+Entries" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/www.facebook.com/sharer.php?u=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fldap-understand-the-protocol-and-work-with-entries_2F&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fldap-understand-the-protocol-and-work-with-entries%2F" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/www.google.com/bookmarks/mark?op=edit_amp_output=popup_amp_bkmk=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fldap-understand-the-protocol-and-work-with-entries_2F_amp_title=LDAP_3A+Understand+the+Protocol+and+Work+With+Entries&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fldap-understand-the-protocol-and-work-with-entries%2F&amp;title=LDAP%3A+Understand+the+Protocol+and+Work+With+Entries" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/reddit.com/submit?url=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fldap-understand-the-protocol-and-work-with-entries_2F_amp_title=LDAP_3A+Understand+the+Protocol+and+Work+With+Entries&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fldap-understand-the-protocol-and-work-with-entries%2F&amp;title=LDAP%3A+Understand+the+Protocol+and+Work+With+Entries" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/slashdot.org/bookmark.pl?url=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fldap-understand-the-protocol-and-work-with-entries_2F_amp_title=LDAP_3A+Understand+the+Protocol+and+Work+With+Entries&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://slashdot.org/bookmark.pl?url=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fldap-understand-the-protocol-and-work-with-entries%2F&amp;title=LDAP%3A+Understand+the+Protocol+and+Work+With+Entries" rel="nofollow" title="Add to&nbsp;Slashdot"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/slashdot.png" title="Add to&nbsp;Slashdot" alt="Add to&nbsp;Slashdot" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/www.stumbleupon.com/submit?url=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fldap-understand-the-protocol-and-work-with-entries_2F_amp_title=LDAP_3A+Understand+the+Protocol+and+Work+With+Entries&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fldap-understand-the-protocol-and-work-with-entries%2F&amp;title=LDAP%3A+Understand+the+Protocol+and+Work+With+Entries" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/twitter.com/home/?status=Check+out+LDAP_3A+Understand+the+Protocol+and+Work+With+Entries+_+http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fldap-understand-the-protocol-and-work-with-entries_2F&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+LDAP%3A+Understand+the+Protocol+and+Work+With+Entries+@+http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fldap-understand-the-protocol-and-work-with-entries%2F" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/myweb2.search.yahoo.com/myresults/bookmarklet?u=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fldap-understand-the-protocol-and-work-with-entries_2F_amp_t=LDAP_3A+Understand+the+Protocol+and+Work+With+Entries&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fldap-understand-the-protocol-and-work-with-entries%2F&amp;t=LDAP%3A+Understand+the+Protocol+and+Work+With+Entries" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
<a style="font-size:90%;text-align: right; " title="Click me to hide the sites." href="#" onclick="$$('div.d42').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); return false;">Hide Sites</a>
</div>
</div>
<!-- Social Bookmarks END -->


<p>Related posts:<ol><li><a href='http://www.longitudetech.com/linux-unix/an-introduction-to-ldap/' rel='bookmark' title='Permanent Link: An Introduction to LDAP'>An Introduction to LDAP</a></li>
<li><a href='http://www.longitudetech.com/linux-unix/back-to-basics-unix-system-stats-utilities/' rel='bookmark' title='Permanent Link: Back to Basics: Unix System Stats Utilities'>Back to Basics: Unix System Stats Utilities</a></li>
<li><a href='http://www.longitudetech.com/linux-unix/multi-user-security-in-linux/' rel='bookmark' title='Permanent Link: Multi-user Security in Linux'>Multi-user Security in Linux</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.longitudetech.com/linux-unix/ldap-understand-the-protocol-and-work-with-entries/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Working With Unix Variant Differences</title>
		<link>http://www.longitudetech.com/linux-unix/working-with-unix-variant-differences/</link>
		<comments>http://www.longitudetech.com/linux-unix/working-with-unix-variant-differences/#comments</comments>
		<pubDate>Sun, 21 Feb 2010 01:55:28 +0000</pubDate>
		<dc:creator>charlie</dc:creator>
				<category><![CDATA[Linux / Unix]]></category>
		<category><![CDATA[aix]]></category>
		<category><![CDATA[freebsd]]></category>
		<category><![CDATA[hpux]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[solaris]]></category>

		<guid isPermaLink="false">http://www.longitudetech.com/blog/?p=38</guid>
		<description><![CDATA[One thing is for certain: Unix is complicated. Linux does it one way, Solaris another, and all the BSDs, yet another. Fortunately there is some logic behind the differences. Some differences have to do with where the OS came from, and some were deign choices, intended to improve usability. In this article we’ll talk about [...]


Related posts:<ol><li><a href='http://www.longitudetech.com/linux-unix/back-to-basics-unix-differences-in-performing-tasks/' rel='bookmark' title='Permanent Link: Back To Basics: Unix Differences in Performing Tasks'>Back To Basics: Unix Differences in Performing Tasks</a></li>
<li><a href='http://www.longitudetech.com/linux-unix/back-to-basics-unix-system-stats-utilities/' rel='bookmark' title='Permanent Link: Back to Basics: Unix System Stats Utilities'>Back to Basics: Unix System Stats Utilities</a></li>
<li><a href='http://www.longitudetech.com/linux-unix/back-to-basics-unix-file-permissions/' rel='bookmark' title='Permanent Link: Back to Basics: Unix File Permissions'>Back to Basics: Unix File Permissions</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>One thing is for certain: Unix is complicated. Linux does it one way, Solaris another, and all the BSDs, yet another. Fortunately there is some logic behind the differences. Some differences have to do with where the OS came from, and some were deign choices, intended to improve usability. In this article we’ll talk about a few major differences between the Unix variants, and tell you what you need to know about various differences in command-line utilities.</p>
<p><strong>Systems</strong></p>
<p><img class="alignleft size-full wp-image-40" title="freebsd_logo" src="http://www.longitudetech.com/blog/wp-content/uploads/2010/02/freebsd_logo.gif" alt="" width="145" height="158" />First, recall that Unix started off in research labs, and two main flavors came about: System V (SysV), and BSD. SysV (five, not “vee”) spawned from AT&amp;T Unix, in their fourth version, SVR4. BSD, from Berkeley, is the competing Unix variant. They both derived from the same Unix from Bell labs, but quickly diverged. Despite POSIX efforts, there are still BSD and SysV systems today, and their functionality still diverges.</p>
<p>Most operating systems are pretty clearly associated with one or the other, and generalizations about BSD vs. SysV prove correct. FreeBSD is the main branch from the traditional BSD, soon followed by NetBSD and OpenBSD. Then OS X came about, which was loosely based on FreeBSD (but is very BSD-like). On the SysV side of the house, AIX, IRIX, and HP-UX were the main variants. In short: commercial entities focused on SysV, academics focused on BSD.</p>
<p>Linux, however, is an oddball. Linux certainly adopted many SysV methodologies, but these days it is also very BSD-like. Sun Solaris, too, is confusing. SunOS started off as BSD, but SunOS 4 was the last BSD version; SunOS 5.x (aka Solaris) is now SysV. The details are much crazier than I’ve alluded to here, and we probably don’t want yet another Unix history lesson. A fun place to start for further reading is the Wikipedia page on Unix_wars.</p>
<p><strong>Fundamental Differences</strong><br />
It has been said that one can tell which system they are using based on two indicators: whether or not the system boots with inittab, and the format of their accounting file. Process accounting isn’t really used any longer, and most people don’t even know what it’s for, so that’s mostly moot. The boot system, however, is still critical to understand.</p>
<p>SysV booting means you use inittab. The init program, when run by the kernel, will check /etc/inittab for the initdefault entry, and then boots<img class="alignright size-medium wp-image-39" title="debian_splash" src="http://www.longitudetech.com/blog/wp-content/uploads/2010/02/debian_splash-283x300.png" alt="" width="198" height="210" /> to the runlevel defined there. Entering a runlevel means that each startup script in the directory will be run in order. Sequentially, and slowly. Sun was so annoyed with this they implemented a mechanism to fire up services in parallel, among other things, with the Service Management Facility (SMF). Ubuntu Linux implemented Upstart, which basically works around the sequential nature of init scripts too.</p>
<p>BSD booting means that init simply runs /etc/rc, and that’s all. Well, it used to. Soon BSD systems implemented rc.local, so that software and sysadmins alike could implement changes without fear of harming the critical system startup routines. Then /etc/rc.d/ was implemented, so that each script could live separately, just like SysV init scripts. Traditionally, BSD-style scripts didn’t take arguments, because there are no runlevels, and they only run once: on startup. There are still no runlevels in BSD, but the startup scripts generally take “start” and “stop” arguments, to allow sysadmins and package management tools to restart services easily.</p>
<p><strong>Command Arguments</strong><br />
The most frustrating, and quickest to surface differences between SysV and BSD, are in the traditional utilities. Some common commands take very different arguments, and even have some very different functionality. This isn’t so important if you’re in Linux now, as it generally supports both, but once you find yourself in BSD-land, you’re up for some confusion.</p>
<p>The first command people usually run into is ‘ps.’ The arguments differ:</p>
<ul>
<li> SysV: ps –elf</li>
<li> BSD: ps aux</li>
</ul>
<p>Linux supports both, BSD does not. Often we may want to list all processes owned by a particular user. In BSD, you must run, “ps aux |grep username” but in SysV you can run, “ps –u username.” Just plain ‘ps’ will list your own processes in both flavors.</p>
<p>Another commonly noticed difference is with the ‘du’ command. Not because some older systems don’t support the –h argument to provide human-readable output, but because they display different things.</p>
<ul>
<li> SysV: shows the amount available in 512-byte blocks</li>
<li> BSD: nice output showing size in bytes and percentage used</li>
</ul>
<p>Printing in BSD is always confusing for SysV users, and vice-versa. Again this isn’t as common, since newer OSes support both, but it’s noteworthy nonetheless. BSD systems traditionally used lpr, lpq, and lprm to administer print jobs, whereas SysV had lp, lpstat, and cancel. Most systems adopted the BSD style, since lpr-ng (next generation) provided these commands, and CUPS subsequently adopted the BSD variants.</p>
<p>Other programs, such as du, who, ln, tr and more will have slight differences between SysV and BSD. Heck, the differences between the various Unix standards are confusing enough that a single Unix variant may have multiple directories of utilities. Take a look at Solaris’s /usr/ucb, /usr/xpg4, and /usr/xpg6 directories. Each standard they support, which has differences from POSIX, is documented and implemented in a separate location. Too bad Linux doesn’t comply with any standards.</p>
<p>In the end, the differences outlined here are probably the only ones anyone would ever notice. The nuances between du, for example, may be applicable for people writing shell scripts for systems administration procedures. The differences do turn up often enough to be mentionable, <img class="alignleft size-full wp-image-41" title="solaris_logo" src="http://www.longitudetech.com/blog/wp-content/uploads/2010/02/solaris_logo.jpg" alt="" width="140" height="120" />but in reality this level of work requires reading manual pages so often that they’d figure it out quickly. User-level utilities are “similar enough” with the exception of ps.</p>
<p>There are so many other differences in system maintenance procedures that those are more frequently focused on. Once the ‘ps’ hurdle is out of the way, and you understand how the system boots, the main problems are more conceptual, as in “how do I add a user.” These vary by OS, and also by distribution of Linux.</p>
<p>Come back next week to learn about the different ways Unix-like operating systems facilitate systems administration tasks.</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a title="Click me to see the sites." href="#" onclick="$$('div.d38').each( function(e) { e.visualEffect('slide_down',{duration:2.5}) }); return false;"><strong><em>Share this! (we greatly appreciate you sharing with friends)</em></strong></a>
<br />
<div class="d38" style="overflow:hidden">
<br />
<a onclick="pageTracker._trackPageview('/outgoing/del.icio.us/post?url=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fworking-with-unix-variant-differences_2F_amp_title=Working+With+Unix+Variant+Differences&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fworking-with-unix-variant-differences%2F&amp;title=Working+With+Unix+Variant+Differences" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/digg.com/submit?phase=2_amp_url=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fworking-with-unix-variant-differences_2F_amp_title=Working+With+Unix+Variant+Differences&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fworking-with-unix-variant-differences%2F&amp;title=Working+With+Unix+Variant+Differences" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/www.facebook.com/sharer.php?u=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fworking-with-unix-variant-differences_2F&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fworking-with-unix-variant-differences%2F" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/www.google.com/bookmarks/mark?op=edit_amp_output=popup_amp_bkmk=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fworking-with-unix-variant-differences_2F_amp_title=Working+With+Unix+Variant+Differences&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fworking-with-unix-variant-differences%2F&amp;title=Working+With+Unix+Variant+Differences" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/reddit.com/submit?url=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fworking-with-unix-variant-differences_2F_amp_title=Working+With+Unix+Variant+Differences&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fworking-with-unix-variant-differences%2F&amp;title=Working+With+Unix+Variant+Differences" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/slashdot.org/bookmark.pl?url=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fworking-with-unix-variant-differences_2F_amp_title=Working+With+Unix+Variant+Differences&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://slashdot.org/bookmark.pl?url=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fworking-with-unix-variant-differences%2F&amp;title=Working+With+Unix+Variant+Differences" rel="nofollow" title="Add to&nbsp;Slashdot"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/slashdot.png" title="Add to&nbsp;Slashdot" alt="Add to&nbsp;Slashdot" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/www.stumbleupon.com/submit?url=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fworking-with-unix-variant-differences_2F_amp_title=Working+With+Unix+Variant+Differences&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fworking-with-unix-variant-differences%2F&amp;title=Working+With+Unix+Variant+Differences" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/twitter.com/home/?status=Check+out+Working+With+Unix+Variant+Differences+_+http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fworking-with-unix-variant-differences_2F&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+Working+With+Unix+Variant+Differences+@+http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fworking-with-unix-variant-differences%2F" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/myweb2.search.yahoo.com/myresults/bookmarklet?u=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fworking-with-unix-variant-differences_2F_amp_t=Working+With+Unix+Variant+Differences&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fworking-with-unix-variant-differences%2F&amp;t=Working+With+Unix+Variant+Differences" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
<a style="font-size:90%;text-align: right; " title="Click me to hide the sites." href="#" onclick="$$('div.d38').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); return false;">Hide Sites</a>
</div>
</div>
<!-- Social Bookmarks END -->


<p>Related posts:<ol><li><a href='http://www.longitudetech.com/linux-unix/back-to-basics-unix-differences-in-performing-tasks/' rel='bookmark' title='Permanent Link: Back To Basics: Unix Differences in Performing Tasks'>Back To Basics: Unix Differences in Performing Tasks</a></li>
<li><a href='http://www.longitudetech.com/linux-unix/back-to-basics-unix-system-stats-utilities/' rel='bookmark' title='Permanent Link: Back to Basics: Unix System Stats Utilities'>Back to Basics: Unix System Stats Utilities</a></li>
<li><a href='http://www.longitudetech.com/linux-unix/back-to-basics-unix-file-permissions/' rel='bookmark' title='Permanent Link: Back to Basics: Unix File Permissions'>Back to Basics: Unix File Permissions</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.longitudetech.com/linux-unix/working-with-unix-variant-differences/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>An Introduction to LDAP</title>
		<link>http://www.longitudetech.com/linux-unix/an-introduction-to-ldap/</link>
		<comments>http://www.longitudetech.com/linux-unix/an-introduction-to-ldap/#comments</comments>
		<pubDate>Fri, 19 Feb 2010 21:10:20 +0000</pubDate>
		<dc:creator>charlie</dc:creator>
				<category><![CDATA[Linux / Unix]]></category>
		<category><![CDATA[ldap]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://www.longitudetech.com/blog/?p=36</guid>
		<description><![CDATA[LDAP directory services are nearly ubiquitous these days. Every sysadmin should know how to work with directories, understand how they are constructed, and have a certain level of familiarity with the LDAP protocol itself. In this, part one of two, we will introduce LDAP and explain how entries and schemas work. Next week, the second [...]


Related posts:<ol><li><a href='http://www.longitudetech.com/linux-unix/ldap-understand-the-protocol-and-work-with-entries/' rel='bookmark' title='Permanent Link: LDAP: Understand the Protocol and Work With Entries'>LDAP: Understand the Protocol and Work With Entries</a></li>
<li><a href='http://www.longitudetech.com/linux-unix/back-to-basics-unix-file-permissions/' rel='bookmark' title='Permanent Link: Back to Basics: Unix File Permissions'>Back to Basics: Unix File Permissions</a></li>
<li><a href='http://www.longitudetech.com/linux-unix/understanding-linux-virtual-memory/' rel='bookmark' title='Permanent Link: Understanding Linux Virtual Memory'>Understanding Linux Virtual Memory</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>LDAP directory services are nearly ubiquitous these days. Every sysadmin should know how to work with directories, understand how they are constructed, and have a certain level of familiarity with the LDAP protocol itself. In this, part one of two, we will introduce LDAP and explain how entries and schemas work. Next week, the second part will cover the LDAP protocol, working with LDAP entries, and searching and storing data.</p>
<p><img alt="" src="http://www.helpdeskpilot.com/images/ldap%20icon.jpg" title="LDAP Directory" class="alignleft" width="175" height="96" />LDAP is actually quite simple, even though it does make use of the ITU X.500 standard—a notoriously complex specification. X.500 directories were accessed via DAP, or Directory Access Protocol. It was large, complex, and unruly, so Lightweight DAP was created. That’s almost accurate; in fact, LDBP (Lightweight Directory Browsing Protocol) came first, because all you could do was search. When the functionality to modify entries was implemented, LDAP was born.</p>
<p><strong>LDAP Structure</strong><br />
A directory can be defined as a set of objects with similar attributes, organized in a hierarchical manner. Sorry, but I must use the old phone book analogy now. In a phone book, an object is a person, and each person has a set of similar attributes: a phone number and perhaps an address. LDAP is the same, but you may make use of many other types of attributes.</p>
<p>LDAP directories are organized in a tree manner, and the design often will reflect organizational or geographic boundries. X.500 tells us:</p>
<ul>
<li>A directory is a tree of directory entries</li>
<li>An entry contains a set of attributes</li>
<li>An attribute has a name, and one or more values.</li>
</ul>
<p>Attributes are defined in a schema, which specifies what types of things can be attributes and whether or not you can multiple values per attribute.</p>
<p>Every entry in a directory has a unique identifier, called the Distinguished Name (DN). The Relative DN (RDN) is part that specifies the current attribute you’re dealing with, sort of like a relative path in Unix (./file). The DN, then, would be a full path (/var/lib/file). A sample directory entry’s DN, therefore, would look like: cn=”john doe”,dc=mytree. The RDN is cn=”john doe”, and the DN is the full path, starting at the top of the tree. A “cn” simply means the “common name” that the entry is referred to as, and “dc” is the “domain component.”</p>
<p>You will often see examples of LDAP structures that use DNS names for the domain component, such as: dc=example,dc=com. This is not necessary, but since DNS itself often implies organizational boundaries, it usually makes sense to just use your existing naming structure. One final note about a DN; it changes over time. If you change a DN, you’re effectively moving an entry in the tree. Some LDAP servers support unique identifiers that will track the movement of entries, but you often don’t need to care. Just know that even though a DN is unique, it changes over time.</p>
<p><strong>LDIF Example</strong><br />
A sample directory entry (of a person) looks like this:<br />
<code>dn: cn=John Doe,dc=myplace<br />
cn: John Doe<br />
givenName: John<br />
sn: Doe<br />
telephoneNumber: +1 555 555 1234<br />
telephoneNumber: +1 555 555 5555<br />
mail: john@example.com<br />
manager: cn=Bob Smith,dc=example,dc=com<br />
objectClass: inetOrgPerson<br />
objectClass: organizationalPerson<br />
objectClass: person<br />
objectClass: top</code></p>
<p>All of the attributes (objects) listed above are associated with the DN; it is a single directory entry. Objects (givenName, sn, etc) are defined by schemas. Every entry must list the objectClass that every attribute is using. For example, organizationalPerson defines what values can live in the attribute called “manager.” If the objectClass wasn’t listed, the LDAP server wouldn’t know what values were allowed, so it wouldn’t allow you to define an attribute called manager.</p>
<p>The example above is an LDIF, LDAP Data Interchange Format, entry. That is the entire LDAP entry in text form. You could insert the data into a directory, and in fact, this is exactly what a backup of your directory looks like. It’s just text, and that’s all there is to an LDAP entry. Well almost: most servers also support aliases and references. An LDAP alias can point to another local entry in the same directory, to avoid duplicating information. A reference will provide a new DN to an LDAP client and tell it to go ask another server. Some LDAP servers even support chained references, where the server will go get the answer and return it to the client; the client never knows a referral has taken place. Regardless, LDAP entries are quite simple.</p>
<p><strong>LDAP Schemas</strong><br />
A schema defines the attribute types that entries can contain, as well as the format of their values. It will specify that: Mail contains a well-formed e-mail address, Photo contains a JPEG image, and uidNumber contains an integer, for example.</p>
<p>Here is an example schema we recently created:<br />
<code>attributeTypes: ( 1.1.1.2.1<br />
NAME 'pod'<br />
DESC 'A pod for people to belong in'<br />
EQUALITY caseIgnoreMatch<br />
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15<br />
)<br />
objectClasses: ( 1.1.1.1.1<br />
NAME 'podPerson'<br />
DESC 'A person who belongs in some pods'<br />
SUP top<br />
MUST cn<br />
MAY pod<br />
)<br />
</code><br />
The objectClass is defined, as well as the allowed attributeTypes. Each schema must have a unique OID (object identifier), which is part of the way X.500 works (SNMP is the same way). We created an objectClass called podPerson, gave it a description, an said the entry must contain a ‘cn,’ and may contain a ‘pod.’ The pod attribute can contain any value, because the only restriction specified is that case doesn’t matter. After loading that scheme into our LDAP server, we could then add a ‘pod’ attribute to each person entry.</p>
<p>Since LDAP is so lightweight and simple, it is not suitable for a few things. It’s very tempting to store tons of data in LDAP, since so many applications can reference LDAP. Unix machines can use LDAP for passwd, shadow, group, netgroup, protocols, and just about everything in nsswitch.conf. LDAP is a database, so print accounting programs, configuration management systems, and just about everything that stores data in a DB will support LDAP. It’s fine for most of these things, but LDAP is not ideal for replicating a relational database. The data in LDAP is not ordered, which means you could get results in any order. If your application is querying for only one result at a time, this is fine, but if multiple results are common and order is important, LDAP just won’t work.</p>
<p>Check back next week (i.e. follow me on Twitter and subscribe via RSS, links at top-right of this page) for a look at the protocol, and some practical examples of querying and using LDAP data.</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a title="Click me to see the sites." href="#" onclick="$$('div.d36').each( function(e) { e.visualEffect('slide_down',{duration:2.5}) }); return false;"><strong><em>Share this! (we greatly appreciate you sharing with friends)</em></strong></a>
<br />
<div class="d36" style="overflow:hidden">
<br />
<a onclick="pageTracker._trackPageview('/outgoing/del.icio.us/post?url=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fan-introduction-to-ldap_2F_amp_title=An+Introduction+to+LDAP&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fan-introduction-to-ldap%2F&amp;title=An+Introduction+to+LDAP" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/digg.com/submit?phase=2_amp_url=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fan-introduction-to-ldap_2F_amp_title=An+Introduction+to+LDAP&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fan-introduction-to-ldap%2F&amp;title=An+Introduction+to+LDAP" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/www.facebook.com/sharer.php?u=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fan-introduction-to-ldap_2F&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fan-introduction-to-ldap%2F" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/www.google.com/bookmarks/mark?op=edit_amp_output=popup_amp_bkmk=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fan-introduction-to-ldap_2F_amp_title=An+Introduction+to+LDAP&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fan-introduction-to-ldap%2F&amp;title=An+Introduction+to+LDAP" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/reddit.com/submit?url=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fan-introduction-to-ldap_2F_amp_title=An+Introduction+to+LDAP&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fan-introduction-to-ldap%2F&amp;title=An+Introduction+to+LDAP" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/slashdot.org/bookmark.pl?url=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fan-introduction-to-ldap_2F_amp_title=An+Introduction+to+LDAP&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://slashdot.org/bookmark.pl?url=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fan-introduction-to-ldap%2F&amp;title=An+Introduction+to+LDAP" rel="nofollow" title="Add to&nbsp;Slashdot"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/slashdot.png" title="Add to&nbsp;Slashdot" alt="Add to&nbsp;Slashdot" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/www.stumbleupon.com/submit?url=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fan-introduction-to-ldap_2F_amp_title=An+Introduction+to+LDAP&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fan-introduction-to-ldap%2F&amp;title=An+Introduction+to+LDAP" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/twitter.com/home/?status=Check+out+An+Introduction+to+LDAP+_+http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fan-introduction-to-ldap_2F&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+An+Introduction+to+LDAP+@+http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fan-introduction-to-ldap%2F" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/myweb2.search.yahoo.com/myresults/bookmarklet?u=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fan-introduction-to-ldap_2F_amp_t=An+Introduction+to+LDAP&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fan-introduction-to-ldap%2F&amp;t=An+Introduction+to+LDAP" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
<a style="font-size:90%;text-align: right; " title="Click me to hide the sites." href="#" onclick="$$('div.d36').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); return false;">Hide Sites</a>
</div>
</div>
<!-- Social Bookmarks END -->


<p>Related posts:<ol><li><a href='http://www.longitudetech.com/linux-unix/ldap-understand-the-protocol-and-work-with-entries/' rel='bookmark' title='Permanent Link: LDAP: Understand the Protocol and Work With Entries'>LDAP: Understand the Protocol and Work With Entries</a></li>
<li><a href='http://www.longitudetech.com/linux-unix/back-to-basics-unix-file-permissions/' rel='bookmark' title='Permanent Link: Back to Basics: Unix File Permissions'>Back to Basics: Unix File Permissions</a></li>
<li><a href='http://www.longitudetech.com/linux-unix/understanding-linux-virtual-memory/' rel='bookmark' title='Permanent Link: Understanding Linux Virtual Memory'>Understanding Linux Virtual Memory</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.longitudetech.com/linux-unix/an-introduction-to-ldap/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Back to Basics: Unix File Permissions</title>
		<link>http://www.longitudetech.com/linux-unix/back-to-basics-unix-file-permissions/</link>
		<comments>http://www.longitudetech.com/linux-unix/back-to-basics-unix-file-permissions/#comments</comments>
		<pubDate>Thu, 18 Feb 2010 00:21:40 +0000</pubDate>
		<dc:creator>charlie</dc:creator>
				<category><![CDATA[Linux / Unix]]></category>
		<category><![CDATA[education]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://www.longitudetech.com/blog/?p=32</guid>
		<description><![CDATA[The most basic, yet important part of mastering Unix is to fully understand the nuances of file permissions. Tools exist to manage permissions easily, but true enlightenment and quick troubleshooting skills come to those who wholly master the concept. Remember, 80% of Unix problems are permissions issues. The Concept At the most basic level, there [...]


Related posts:<ol><li><a href='http://www.longitudetech.com/linux-unix/back-to-basics-unix-system-stats-utilities/' rel='bookmark' title='Permanent Link: Back to Basics: Unix System Stats Utilities'>Back to Basics: Unix System Stats Utilities</a></li>
<li><a href='http://www.longitudetech.com/linux-unix/back-to-basics-unix-differences-in-performing-tasks/' rel='bookmark' title='Permanent Link: Back To Basics: Unix Differences in Performing Tasks'>Back To Basics: Unix Differences in Performing Tasks</a></li>
<li><a href='http://www.longitudetech.com/linux-unix/working-with-unix-variant-differences/' rel='bookmark' title='Permanent Link: Working With Unix Variant Differences'>Working With Unix Variant Differences</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>The most basic, yet important part of mastering Unix is to fully understand the nuances of file permissions. Tools exist to manage permissions easily, but true enlightenment and quick troubleshooting skills come to those who wholly master the concept. Remember, 80% of Unix problems are permissions issues.</p>
<p>The Concept<br />
At the most basic level, there are three types of access:</p>
<ul>
<li> Read – the ability to open a file and read it</li>
<li> Write – the ability to write the file</li>
<li> Execute – the ability to execute (run) the file</li>
</ul>
<p>Directories, though similar, are subject to special rules. Write permissions on a directory imply that you can create new files and directories within. Execute permissions are required to ‘cd’ into the directory, and read permissions are required to list the contents (‘ls’).</p>
<p>You will generally see permissions represented as r, w, or x; for read, write, and execute. Running ‘ls –al’ on the command line will show three sets of these strung together.</p>
<p>For example: -rwxr-xr-x</p>
<p>The dash means that the permission is not set. The first place is always reserved for special identifiers, like ‘d’ for directories or ‘c’ for character devices. The next place begins the actual permissions, for the user, group, and other categories.</p>
<p>Every access control in Unix is based on “who you are.” The user is identified by the uid (user ID), as defined by a person’s user account. The third field in the /etc/password file, for example, specifies what a user’s uid is. Similarly, every user belongs to a default group, as identified by the fourth field in the passwd file. Users can belong to many groups, but they’re always a member of their default group.</p>
<p>The above example of -rwxr-xr-x means that the owner of the file may read, write and execute it, the group members may read or execute it, and everyone else on the system may also read or execute the file.</p>
<p>A full example, from the output of ‘ls -l’ is:<br />
-rw-r&#8211;r&#8211;  1 charlie root        164 2006-12-10 23:51 test.js</p>
<p>The file named test.js is owned by me with read and write permissions, is set to the root group who can only read it, and also allows everyone else to read it.</p>
<p><strong>How it Really Works</strong><br />
That’s basically enough to get by, but being able to understand the more advanced modes of file permissions, your umask, and the numeric representation demands a full understanding. In reality, there are 8-bits available for each type of attribute. Take a look at Figure 1 and note that wherever you see a 1 in the binary column, a corresponding permission will exist.</p>

<table id="wp-table-reloaded-id-3-no-1" class="wp-table-reloaded wp-table-reloaded-id-3">
<thead>
	<tr class="row-1 odd">
		<th class="column-1">Number  </th><th class="column-2">Permissions</th><th class="column-3">Binary</th>
	</tr>
</thead>
<tbody>
	<tr class="row-2 even">
		<td class="column-1">0</td><td class="column-2">---</td><td class="column-3">000</td>
	</tr>
	<tr class="row-3 odd">
		<td class="column-1">1  </td><td class="column-2">--x</td><td class="column-3">001</td>
	</tr>
	<tr class="row-4 even">
		<td class="column-1">2  </td><td class="column-2">-w-</td><td class="column-3">010</td>
	</tr>
	<tr class="row-5 odd">
		<td class="column-1">3 	</td><td class="column-2">-wx</td><td class="column-3">011</td>
	</tr>
	<tr class="row-6 even">
		<td class="column-1">4 	</td><td class="column-2">r--</td><td class="column-3">100</td>
	</tr>
	<tr class="row-7 odd">
		<td class="column-1">5  </td><td class="column-2">r-x</td><td class="column-3">101</td>
	</tr>
	<tr class="row-8 even">
		<td class="column-1">6  </td><td class="column-2">rw-</td><td class="column-3">110</td>
	</tr>
	<tr class="row-9 odd">
		<td class="column-1">7 	</td><td class="column-2">rwx</td><td class="column-3">111</td>
	</tr>
</tbody>
</table>

<p>As you can see, if a “bit” in a certain position of the binary representation is set, the permissions in that space are activated. The number column is the octal representation, and the “Binary” column is how it really works, from the operation system’s perspective.</p>
<p>Example time. Let’s say we wish to give ourselves read/write/execute permissions, the group read/execute, and everyone else read/execute permissions. The following commands both do the same thing:</p>
<ul>
<li> chmod u+rwx .; chmod go+rx .</li>
<li> chmod 755 .</li>
</ul>
<p>Since we know that setting ‘5’ means rx, we can simply say ‘5’ instead of ‘rx.’ The real advntage to knowing the octal representation is that we can set any arbitrary permissions with a single command. Running the chmod command using the mnemonic requires that we run it each time for each set of permissions.</p>
<p>Likewise, to set our umask, we must know how the permissions are numerically represented. The umask is the default mode with which files and directories will get created. It’s a mask, so if we want to create all files with permissions like 755, we must take the mask. Simply subtract 7 from each item, and 022 reveals itself as the magic setting. See the umask man page for further details.</p>
<p><strong>Advanced Modes<br />
</strong>There are, in fact, three other modes you can set on a file or directory. All Unixes support the following:</p>
<ul>
<li> 4000 set user id (suid) on execution</li>
<li> 2000 set group id on execution</li>
<li> 1000 the sticky bit</li>
</ul>
<p>If suid is enabled, the permissions look like: -rws&#8212;&#8212;<br />
This means that when the file is executed, it will run with the permissions of the owner of the file. It’s dangerous, but some times necessary and quite useful. For example, a file suid and owned by root will always run as root.</p>
<p>When sgid is enabled, the permissions look like: -rwxrws&#8212;<br />
When set on a directory, sgid means that all files created within the directory will have the gid set to the current directory’d gid. This is handy when sharing files with other people, who will often forget to give other members read or write permissions.</p>
<p>The sticky bit looks like: -rwx&#8212;&#8212;T<br />
When the sticky bit is enabled, only the owner of the file can change its permissions or delete it. Without the sticky bit, anyone with write permissions can change the modes (including ownership) or delete a file. This one is also handy when sharing files with a group of people.</p>
<p>There are other tidbits of information, once you get into the nuts and bolts of Unix file permissions too. For example, you can also set ACL attributes, which get horribly complex. Yes, you can give individual users access to your files, but it’s better not to. Creating a new group and sticking to general permissions can accomplish most things. Often the extended attributes aren’t necessary, and ACLs likely won’t work over NFS if you’re using Linux.</p>
<p>Spend some time with the chmod manual page to master tricky parts, if they still aren’t clear. It will also mention some implementation-specific limitations you may need to be aware of.</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a title="Click me to see the sites." href="#" onclick="$$('div.d32').each( function(e) { e.visualEffect('slide_down',{duration:2.5}) }); return false;"><strong><em>Share this! (we greatly appreciate you sharing with friends)</em></strong></a>
<br />
<div class="d32" style="overflow:hidden">
<br />
<a onclick="pageTracker._trackPageview('/outgoing/del.icio.us/post?url=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fback-to-basics-unix-file-permissions_2F_amp_title=Back+to+Basics_3A+Unix+File+Permissions&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fback-to-basics-unix-file-permissions%2F&amp;title=Back+to+Basics%3A+Unix+File+Permissions" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/digg.com/submit?phase=2_amp_url=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fback-to-basics-unix-file-permissions_2F_amp_title=Back+to+Basics_3A+Unix+File+Permissions&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fback-to-basics-unix-file-permissions%2F&amp;title=Back+to+Basics%3A+Unix+File+Permissions" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/www.facebook.com/sharer.php?u=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fback-to-basics-unix-file-permissions_2F&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fback-to-basics-unix-file-permissions%2F" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/www.google.com/bookmarks/mark?op=edit_amp_output=popup_amp_bkmk=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fback-to-basics-unix-file-permissions_2F_amp_title=Back+to+Basics_3A+Unix+File+Permissions&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fback-to-basics-unix-file-permissions%2F&amp;title=Back+to+Basics%3A+Unix+File+Permissions" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/reddit.com/submit?url=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fback-to-basics-unix-file-permissions_2F_amp_title=Back+to+Basics_3A+Unix+File+Permissions&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fback-to-basics-unix-file-permissions%2F&amp;title=Back+to+Basics%3A+Unix+File+Permissions" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/slashdot.org/bookmark.pl?url=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fback-to-basics-unix-file-permissions_2F_amp_title=Back+to+Basics_3A+Unix+File+Permissions&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://slashdot.org/bookmark.pl?url=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fback-to-basics-unix-file-permissions%2F&amp;title=Back+to+Basics%3A+Unix+File+Permissions" rel="nofollow" title="Add to&nbsp;Slashdot"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/slashdot.png" title="Add to&nbsp;Slashdot" alt="Add to&nbsp;Slashdot" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/www.stumbleupon.com/submit?url=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fback-to-basics-unix-file-permissions_2F_amp_title=Back+to+Basics_3A+Unix+File+Permissions&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fback-to-basics-unix-file-permissions%2F&amp;title=Back+to+Basics%3A+Unix+File+Permissions" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/twitter.com/home/?status=Check+out+Back+to+Basics_3A+Unix+File+Permissions+_+http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fback-to-basics-unix-file-permissions_2F&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+Back+to+Basics%3A+Unix+File+Permissions+@+http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fback-to-basics-unix-file-permissions%2F" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/myweb2.search.yahoo.com/myresults/bookmarklet?u=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fback-to-basics-unix-file-permissions_2F_amp_t=Back+to+Basics_3A+Unix+File+Permissions&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fback-to-basics-unix-file-permissions%2F&amp;t=Back+to+Basics%3A+Unix+File+Permissions" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
<a style="font-size:90%;text-align: right; " title="Click me to hide the sites." href="#" onclick="$$('div.d32').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); return false;">Hide Sites</a>
</div>
</div>
<!-- Social Bookmarks END -->


<p>Related posts:<ol><li><a href='http://www.longitudetech.com/linux-unix/back-to-basics-unix-system-stats-utilities/' rel='bookmark' title='Permanent Link: Back to Basics: Unix System Stats Utilities'>Back to Basics: Unix System Stats Utilities</a></li>
<li><a href='http://www.longitudetech.com/linux-unix/back-to-basics-unix-differences-in-performing-tasks/' rel='bookmark' title='Permanent Link: Back To Basics: Unix Differences in Performing Tasks'>Back To Basics: Unix Differences in Performing Tasks</a></li>
<li><a href='http://www.longitudetech.com/linux-unix/working-with-unix-variant-differences/' rel='bookmark' title='Permanent Link: Working With Unix Variant Differences'>Working With Unix Variant Differences</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.longitudetech.com/linux-unix/back-to-basics-unix-file-permissions/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Managing Virtual Machine and Cloud Sprawl</title>
		<link>http://www.longitudetech.com/linux-unix/managing-virtual-machine-and-cloud-sprawl/</link>
		<comments>http://www.longitudetech.com/linux-unix/managing-virtual-machine-and-cloud-sprawl/#comments</comments>
		<pubDate>Tue, 16 Feb 2010 06:38:02 +0000</pubDate>
		<dc:creator>charlie</dc:creator>
				<category><![CDATA[IT Management]]></category>
		<category><![CDATA[Linux / Unix]]></category>
		<category><![CDATA[configuration management]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[virtualization]]></category>

		<guid isPermaLink="false">http://www.longitudetech.com/blog/?p=26</guid>
		<description><![CDATA[Virtualization (in the cloud or locally) is great; that much we can all agree on. Virtual machines (VMs) can tend to grow out of control, however, now that it’s so easy to create them. This should not be all that surprising, but many small to medium businesses are also dabbling in VMs, and they are [...]


Related posts:<ol><li><a href='http://www.longitudetech.com/linux-unix/understanding-linux-virtual-memory/' rel='bookmark' title='Permanent Link: Understanding Linux Virtual Memory'>Understanding Linux Virtual Memory</a></li>
<li><a href='http://www.longitudetech.com/it-management/how-much-server-do-you-need/' rel='bookmark' title='Permanent Link: How Much Server do you Need?'>How Much Server do you Need?</a></li>
<li><a href='http://www.longitudetech.com/linux-unix/zenoss-we-can-ditch-nagios-now/' rel='bookmark' title='Permanent Link: Zenoss: We Can Ditch Nagios Now'>Zenoss: We Can Ditch Nagios Now</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Virtualization (in the cloud or locally) is great; that much we can all agree on. Virtual machines (VMs) can tend to grow out of control, however, now that it’s <a href="http://socializedsoftware.com/2010/02/15/cloud-computing-and-virtualization-resources/" target="_blank" onclick="pageTracker._trackPageview('/outgoing/socializedsoftware.com/2010/02/15/cloud-computing-and-virtualization-resources/?referer=');">so easy to create them</a>. This should not be all that surprising, but many small to medium businesses are also dabbling in VMs, and they are suddenly overwhelmed by the VM growth.</p>
<p>Each VM is another server that an administrator must manage. Security updates must be applied and global configuration changes now need to be propagated to all these new machines. While it’s easy to create 3-4 (or more) servers on one physical piece of hardware, you’ll certainly struggle if you aren’t already set up to scale.</p>
<p><strong>Unfettered Growth</strong><br />
The number of physical machines in a small company may drop dramatically; maybe 40%, when virtualization is implemented. Unfortunately, the number of OS instances will generally increase by two-fold or more at the same time. The power and cooling savings are realized, as was promised by virtualization, but taking 20 servers to 12 servers, for example, will means you may soon have 40 OS instances to manage.</p>
<div id="attachment_27" class="wp-caption alignleft" style="width: 229px"><a href="http://reductivelabs.com" target="_blank" onclick="pageTracker._trackPageview('/outgoing/reductivelabs.com?referer=');"><img class="size-full wp-image-27" title="reductivelabs" src="http://www.longitudetech.com/blog/wp-content/uploads/2010/02/reductivelabs.png" alt="You Need It" width="219" height="103" /></a><p class="wp-caption-text">Puppet, from Reductive Labs</p></div>
<p>The reasons for VM proliferation depend on your culture, but the most common reason is that delegating control of an entire OS is easier than managing an application for customers. IT customer, be they engineers, application developers, or smaller IT units within an organization, frequently need more access then cenral IT is willing to give. The easy solution: give them a server of their own. Test environments, too, are best served by virtual machines.</p>
<p>To keep hardware (and power and cooling) costs down, many companies implement policies about the implementation of new services. New applications and servers need to be run on VMs first, unless it’s really requires its own server. Policies such as these are good, in that they limit wastefulness, but they do tend to exacerbate VM sprawl.</p>
<p>Sprawl aside; it’s worth noting that higher utilization levels on your servers does not mean that they’ll use an appreciably larger amount of power. In fact, the power savings claims are really true, and can be even greater if your utilization is low and you use VirtualCenter’s power management features. VMWare can migrate VMs to fewer servers if utilization isn’t high enough, and actually power off unnecessary servers. This works best with Dell hardware, but other large vendors are supported as well. Imagine: all your VMs migrating to a few blades in a blade server during the nighttime, and then as utilization increases during the day, blades quickly boot up and take the load as needed. Granted, I don’t personally know any enterprise environments that are brave enough to try it yet, but in theory the concept is wonderful.</p>
<p><strong>Dealing</strong><br />
Something magical happens when a company grows to around 50 operating systems. It’s too many to manage by simply logging in and running commands, so people start to write scripts. In Windows land, if it hasn’t already happened, you must implement Active Directory. For the Unix/Linux servers, configuration management becomes even more important. Writing a script that SSH’s to each server and runs a command doesn’t scale, no matter how hard people want it to. You need a real configuration management system (such as <a href="reductivelabs.com/">puppet</a> or <a href="http://www.opscode.com/" onclick="pageTracker._trackPageview('/outgoing/www.opscode.com/?referer=');">cfengine</a>) to ensure that servers are configured exactly how you want, and that they will remain that way.</p>
<p>If you already operate in a large environment with good automated installations and configuration management systems, chances are scaling 100-fold won’t be a problem. Barring scaling issues with the management software itseld, that is. A good network-booting deployment system is only half the battle, because every server isn’t going to be configured identically. If you’re “doing it right,” you should be able to arbitrarily reinstall any server, walk away, and know that it’ll come back up patched and running all the services it’s supposed to. Servers, or rather the OS that runs on them, should be truly disposable.</p>
<p>Management of a “golden image” is promised by VMWare, probably because ITIL mentions it, but it doesn’t really help in practice. You have to create your images (somehow). There’s no mechanism to update a golden image with security patches and apply them to existing systems; you’ll generally have to reinstall the OS instances. And that’s what you should do periodically, but without some kind of configuration management system, you’ll also be manually installing and configuring the services that the VMs used to provide in order to restore service functionality.</p>
<p>VM growth, therefore, is no different from server growth. It may be easier and cheaper, but from the OS management viewpoint, you’re doing the same thing. Likewise, the availability of your services is also in danger. Running five VMs on a single piece of hardware means that a hardware failure takes out five servers instead of one. VMWare and Xen can both be clustered and run from shared storage, such that a hardware failure will result in the VMs immediately (instantly, even) being migrated to other servers. The problem is that VMotion requires the most expensive VMWare license, and a VirtualCenter server. Shared storage isn’t as big of an issues these days with iSCSI, but its still another aspect that must be configured. We’ll cover this issue in-depth in a future article, focusing on Xen and RHEL Clustering Services.</p>
<p>The point is: dealing with VM sprawl is no different than dealing with scaling up to support more physical servers. Use whatever mechanisms are available on your given platforms, and “do it right.” A VM is, and always will be, just another server.</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a title="Click me to see the sites." href="#" onclick="$$('div.d26').each( function(e) { e.visualEffect('slide_down',{duration:2.5}) }); return false;"><strong><em>Share this! (we greatly appreciate you sharing with friends)</em></strong></a>
<br />
<div class="d26" style="overflow:hidden">
<br />
<a onclick="pageTracker._trackPageview('/outgoing/del.icio.us/post?url=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fmanaging-virtual-machine-and-cloud-sprawl_2F_amp_title=Managing+Virtual+Machine+and+Cloud+Sprawl&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fmanaging-virtual-machine-and-cloud-sprawl%2F&amp;title=Managing+Virtual+Machine+and+Cloud+Sprawl" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/digg.com/submit?phase=2_amp_url=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fmanaging-virtual-machine-and-cloud-sprawl_2F_amp_title=Managing+Virtual+Machine+and+Cloud+Sprawl&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fmanaging-virtual-machine-and-cloud-sprawl%2F&amp;title=Managing+Virtual+Machine+and+Cloud+Sprawl" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/www.facebook.com/sharer.php?u=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fmanaging-virtual-machine-and-cloud-sprawl_2F&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fmanaging-virtual-machine-and-cloud-sprawl%2F" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/www.google.com/bookmarks/mark?op=edit_amp_output=popup_amp_bkmk=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fmanaging-virtual-machine-and-cloud-sprawl_2F_amp_title=Managing+Virtual+Machine+and+Cloud+Sprawl&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fmanaging-virtual-machine-and-cloud-sprawl%2F&amp;title=Managing+Virtual+Machine+and+Cloud+Sprawl" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/reddit.com/submit?url=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fmanaging-virtual-machine-and-cloud-sprawl_2F_amp_title=Managing+Virtual+Machine+and+Cloud+Sprawl&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fmanaging-virtual-machine-and-cloud-sprawl%2F&amp;title=Managing+Virtual+Machine+and+Cloud+Sprawl" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/slashdot.org/bookmark.pl?url=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fmanaging-virtual-machine-and-cloud-sprawl_2F_amp_title=Managing+Virtual+Machine+and+Cloud+Sprawl&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://slashdot.org/bookmark.pl?url=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fmanaging-virtual-machine-and-cloud-sprawl%2F&amp;title=Managing+Virtual+Machine+and+Cloud+Sprawl" rel="nofollow" title="Add to&nbsp;Slashdot"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/slashdot.png" title="Add to&nbsp;Slashdot" alt="Add to&nbsp;Slashdot" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/www.stumbleupon.com/submit?url=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fmanaging-virtual-machine-and-cloud-sprawl_2F_amp_title=Managing+Virtual+Machine+and+Cloud+Sprawl&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fmanaging-virtual-machine-and-cloud-sprawl%2F&amp;title=Managing+Virtual+Machine+and+Cloud+Sprawl" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/twitter.com/home/?status=Check+out+Managing+Virtual+Machine+and+Cloud+Sprawl+_+http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fmanaging-virtual-machine-and-cloud-sprawl_2F&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+Managing+Virtual+Machine+and+Cloud+Sprawl+@+http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fmanaging-virtual-machine-and-cloud-sprawl%2F" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/myweb2.search.yahoo.com/myresults/bookmarklet?u=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fmanaging-virtual-machine-and-cloud-sprawl_2F_amp_t=Managing+Virtual+Machine+and+Cloud+Sprawl&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fmanaging-virtual-machine-and-cloud-sprawl%2F&amp;t=Managing+Virtual+Machine+and+Cloud+Sprawl" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
<a style="font-size:90%;text-align: right; " title="Click me to hide the sites." href="#" onclick="$$('div.d26').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); return false;">Hide Sites</a>
</div>
</div>
<!-- Social Bookmarks END -->


<p>Related posts:<ol><li><a href='http://www.longitudetech.com/linux-unix/understanding-linux-virtual-memory/' rel='bookmark' title='Permanent Link: Understanding Linux Virtual Memory'>Understanding Linux Virtual Memory</a></li>
<li><a href='http://www.longitudetech.com/it-management/how-much-server-do-you-need/' rel='bookmark' title='Permanent Link: How Much Server do you Need?'>How Much Server do you Need?</a></li>
<li><a href='http://www.longitudetech.com/linux-unix/zenoss-we-can-ditch-nagios-now/' rel='bookmark' title='Permanent Link: Zenoss: We Can Ditch Nagios Now'>Zenoss: We Can Ditch Nagios Now</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.longitudetech.com/linux-unix/managing-virtual-machine-and-cloud-sprawl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Understanding Linux Virtual Memory</title>
		<link>http://www.longitudetech.com/linux-unix/understanding-linux-virtual-memory/</link>
		<comments>http://www.longitudetech.com/linux-unix/understanding-linux-virtual-memory/#comments</comments>
		<pubDate>Mon, 15 Feb 2010 19:11:56 +0000</pubDate>
		<dc:creator>charlie</dc:creator>
				<category><![CDATA[Linux / Unix]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[swap]]></category>
		<category><![CDATA[tuning]]></category>
		<category><![CDATA[vmm]]></category>

		<guid isPermaLink="false">http://www.longitudetech.com/blog/?p=22</guid>
		<description><![CDATA[Virtual memory is one of the most important, and accordingly confusing, piece of an operating system. Understanding the basics of virtual memory is a requisite to understanding operating system performance. Beyond the basics, a deeper understanding allows a systems administrator to interpret system profiling tools better, leading to quicker troubleshooting and better decisions. The concept [...]


Related posts:<ol><li><a href='http://www.longitudetech.com/linux-unix/multi-user-security-in-linux/' rel='bookmark' title='Permanent Link: Multi-user Security in Linux'>Multi-user Security in Linux</a></li>
<li><a href='http://www.longitudetech.com/linux-unix/managing-virtual-machine-and-cloud-sprawl/' rel='bookmark' title='Permanent Link: Managing Virtual Machine and Cloud Sprawl'>Managing Virtual Machine and Cloud Sprawl</a></li>
<li><a href='http://www.longitudetech.com/linux-unix/back-to-basics-unix-system-stats-utilities/' rel='bookmark' title='Permanent Link: Back to Basics: Unix System Stats Utilities'>Back to Basics: Unix System Stats Utilities</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Virtual memory is one of the most important, and accordingly confusing, piece of an operating system. Understanding the basics of virtual memory is a requisite to understanding operating system performance. Beyond the basics, a deeper understanding allows a systems administrator to interpret system profiling tools better, leading to quicker troubleshooting and better decisions.</p>
<p>The concept of virtual memory is generally taught as though it’s only used for extending the amount of physical RAM in a system. Indeed, paging to disk is important, but virtual memory is used by nearly  every aspect of an operating system.</p>
<p>In addition swapping, virtual memory is used to manage all pages of memory, which incidentally are required for file caching, process isolation, and even network communication. Anything that queues data, you can be assured, traverses the virtual memory system. Depending on a server’s role, virtual memory functionality may not be optimal. An administrator can dramatically improve overall system performance by adjusting certain virtual memory manager settings.</p>
<p>To optimally configure your Virtual Memory Manager (VMM), it’s necessary to understand how it does its job. We’re using Linux for example’s sake, but the concepts apply across the board, though some slight architectural differences will exist between the Unixes.</p>
<p>Nearly every VMM interaction involves the MMU, or Memory Management Unit, excluding the disk subsystem. The MMU allows the operating system to access memory through virtual addresses by using data structures to track these translations. Its main job is to translate these virtual addresses into physical addresses, so that the right section of RAM is accessed.</p>
<p>The Zoned Buddy Allocator interacts directly with the MMU, providing valid pages when the kernel asks for them. It also manages lists of pages and keeps track of different categories of memory addresses.</p>
<p>The Slab Allocator is another layer in front of the Buddy Allocator, and provides the ability to create cache of memory objects in memory. On x86 hardware, pages of memory must be allocated in 4KB blocks, but the Slab Allocator allows the kernel to store objects that are differently sized, and will manage and allocate real pages appropriately.</p>
<p>Finally, a few kernel tasks run to manage specific aspects of the VMM. The bdflush manages block device pages (disk IO), and kswapd handles swapping pages to disk. Pages of memory are either Free (available to allocate), Active (in use), or Inactive. Inactive pages of memory are either dirty or clean, depending on if it has been selected for removal yet or not. An inactive dirty page is no longer in use, but is not yet available for re-use. The operating system must scan for dirty pages, and decide to deallocate them. After they have been guaranteed sync’d to disk, an inactive page my be “clean,” or ready for re-use.</p>
<p>Tuning<br />
Tunable parameters may be adjusted in real-time via the proc fils system, but to persist across a reboot, /etc/sysctl.conf is the preferred method. Parameters can be entered in real-time via the sysctl command, and then recorded  in the configuration file for reboot persistence.</p>
<p>You can adjust everything from the interval pages are scanned to the amount of memory to reserve for pagecache use. Let’s see a few examples.</p>
<p>Often we’ll want to optimize a system for IO performance. A busy database server, for example, is generally only going to run the database, and it doesn’t matter if the user experience is good or not. If the system doesn’t require much memory for user applications decreasing the available bdflush tunables is beneficial. The specific parameters being adjusted are just too lengthy to explain here, but definitely look into them if you wish to adjust the values further. They are fully explained in vm.txt, usually located at: /usr/src/linux/Documenation/sysctl/vm.txt.</p>
<p>In general, a IO-heavy server will benefit from the following setting these values in sysctl.conf:<br />
<code>vm.bdflush=”100 5000 640 2560 150 30000 5000 1884 2”<br />
</code></p>
<p>The pagecache values control how much memory is used for pagecache. The amount of pagecache allowed translates directly to how many programs and open files can be held in memory.</p>
<p>The three tunable parameters with pagecache are:</p>
<ul>
<li> Min: the minimum amount of memory reserved for pagecache</li>
<li> Borrow: the percentage of pages used in the process of reclaiming pages</li>
<li> Max: percentage at which kswapd will only page pagecache pages; once it falls below, it can swap out process pages again</li>
</ul>
<p>On a file server, we’d want to increase the amount of pagecache available, so that data isn’t moved to disk as often. Using vm.pagecache=&#8221;10 50 100&#8243; provides more caching, allowing larger and less frequent disk writes for file IO intensive work loads.</p>
<p>On a single-user machine, say your workstation, large number will keep pages in memory, allowing programs to execute faster. Once the upper limit is reached, however, you will start swapping constantly.</p>
<p>Conversely, a server with many users that frequently executes many different programs will not want high amounts of pagecache. The pagecache can easily eat up available memory if it’s too large, so something like vm.pagecache=”10 20 30” is a good compromise.</p>
<p>Finally, the swappiness and vm.overcommit parameters are also very powerful. The overcommit number can be used to allow more memory allocation than RAM exists, which allows you to overcommit the amount of pages. Programs that have a habit of trying to allocate many gigabytes of memory are a hassle, and frequently they don’t use nearly that much memory. Upping the overcommit factor will allow these allocations to happen, but if the application really does use all the RAM, you’ll be swapping like crazy in no time (or worse: running out of swap).</p>
<p>The swappiness concept is heavily debated. If you want to decrease the amount of swapping done by the system, just echo a small number of the range 0-100 into: /proc/sys/vm/swappiness. You don’t generally want to play with this, as it its more mysterious and non-deterministic than the advanced parameters described above. In general, you want applications to swap to avoid them using memory for no reason. Task-specific servers, where you know the amount of RAM and the application requirements, are best suited for swappiness tuning (using a low number to decrease swapping).</p>
<p>These parameters all require a bit of testing, but in the end, you can dramatically increase the performance of many types of servers. The common case of disappointing disk performance stands to gain the most: give the settings a try before going out and buying a faster disk array.</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a title="Click me to see the sites." href="#" onclick="$$('div.d22').each( function(e) { e.visualEffect('slide_down',{duration:2.5}) }); return false;"><strong><em>Share this! (we greatly appreciate you sharing with friends)</em></strong></a>
<br />
<div class="d22" style="overflow:hidden">
<br />
<a onclick="pageTracker._trackPageview('/outgoing/del.icio.us/post?url=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Funderstanding-linux-virtual-memory_2F_amp_title=Understanding+Linux+Virtual+Memory&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Funderstanding-linux-virtual-memory%2F&amp;title=Understanding+Linux+Virtual+Memory" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/digg.com/submit?phase=2_amp_url=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Funderstanding-linux-virtual-memory_2F_amp_title=Understanding+Linux+Virtual+Memory&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Funderstanding-linux-virtual-memory%2F&amp;title=Understanding+Linux+Virtual+Memory" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/www.facebook.com/sharer.php?u=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Funderstanding-linux-virtual-memory_2F&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Funderstanding-linux-virtual-memory%2F" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/www.google.com/bookmarks/mark?op=edit_amp_output=popup_amp_bkmk=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Funderstanding-linux-virtual-memory_2F_amp_title=Understanding+Linux+Virtual+Memory&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Funderstanding-linux-virtual-memory%2F&amp;title=Understanding+Linux+Virtual+Memory" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/reddit.com/submit?url=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Funderstanding-linux-virtual-memory_2F_amp_title=Understanding+Linux+Virtual+Memory&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Funderstanding-linux-virtual-memory%2F&amp;title=Understanding+Linux+Virtual+Memory" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/slashdot.org/bookmark.pl?url=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Funderstanding-linux-virtual-memory_2F_amp_title=Understanding+Linux+Virtual+Memory&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://slashdot.org/bookmark.pl?url=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Funderstanding-linux-virtual-memory%2F&amp;title=Understanding+Linux+Virtual+Memory" rel="nofollow" title="Add to&nbsp;Slashdot"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/slashdot.png" title="Add to&nbsp;Slashdot" alt="Add to&nbsp;Slashdot" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/www.stumbleupon.com/submit?url=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Funderstanding-linux-virtual-memory_2F_amp_title=Understanding+Linux+Virtual+Memory&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Funderstanding-linux-virtual-memory%2F&amp;title=Understanding+Linux+Virtual+Memory" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/twitter.com/home/?status=Check+out+Understanding+Linux+Virtual+Memory+_+http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Funderstanding-linux-virtual-memory_2F&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+Understanding+Linux+Virtual+Memory+@+http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Funderstanding-linux-virtual-memory%2F" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/myweb2.search.yahoo.com/myresults/bookmarklet?u=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Funderstanding-linux-virtual-memory_2F_amp_t=Understanding+Linux+Virtual+Memory&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Funderstanding-linux-virtual-memory%2F&amp;t=Understanding+Linux+Virtual+Memory" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
<a style="font-size:90%;text-align: right; " title="Click me to hide the sites." href="#" onclick="$$('div.d22').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); return false;">Hide Sites</a>
</div>
</div>
<!-- Social Bookmarks END -->


<p>Related posts:<ol><li><a href='http://www.longitudetech.com/linux-unix/multi-user-security-in-linux/' rel='bookmark' title='Permanent Link: Multi-user Security in Linux'>Multi-user Security in Linux</a></li>
<li><a href='http://www.longitudetech.com/linux-unix/managing-virtual-machine-and-cloud-sprawl/' rel='bookmark' title='Permanent Link: Managing Virtual Machine and Cloud Sprawl'>Managing Virtual Machine and Cloud Sprawl</a></li>
<li><a href='http://www.longitudetech.com/linux-unix/back-to-basics-unix-system-stats-utilities/' rel='bookmark' title='Permanent Link: Back to Basics: Unix System Stats Utilities'>Back to Basics: Unix System Stats Utilities</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.longitudetech.com/linux-unix/understanding-linux-virtual-memory/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Zenoss: We Can Ditch Nagios Now</title>
		<link>http://www.longitudetech.com/linux-unix/zenoss-we-can-ditch-nagios-now/</link>
		<comments>http://www.longitudetech.com/linux-unix/zenoss-we-can-ditch-nagios-now/#comments</comments>
		<pubDate>Mon, 15 Feb 2010 01:34:20 +0000</pubDate>
		<dc:creator>charlie</dc:creator>
				<category><![CDATA[IT Management]]></category>
		<category><![CDATA[Linux / Unix]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[monitoring]]></category>
		<category><![CDATA[networks]]></category>
		<category><![CDATA[NMS]]></category>

		<guid isPermaLink="false">http://www.longitudetech.com/blog/?p=20</guid>
		<description><![CDATA[Another perfect example of open source software gone commercial is Zenoss. As a full-featured network and service monitoring solution, Zenoss is one of the best monitoring tools available. Most importantly, Zenoss combines two functionalities. First and foremost an enterprise environment requires host and service monitoring, with notifications. Network monitoring really means checking services, checking that hosts [...]


Related posts:<ol><li><a href='http://www.longitudetech.com/networking/squeeze-your-gigabit-nic-for-top-performance-2/' rel='bookmark' title='Permanent Link: Squeeze Your Gigabit NIC for Top Performance'>Squeeze Your Gigabit NIC for Top Performance</a></li>
<li><a href='http://www.longitudetech.com/linux-unix/managing-virtual-machine-and-cloud-sprawl/' rel='bookmark' title='Permanent Link: Managing Virtual Machine and Cloud Sprawl'>Managing Virtual Machine and Cloud Sprawl</a></li>
<li><a href='http://www.longitudetech.com/networking/built-in-security-with-cisco-ips/' rel='bookmark' title='Permanent Link: Built-in Security with Cisco IPS'>Built-in Security with Cisco IPS</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Another perfect example of open source software gone commercial is <a href="http://www.zenoss.com/" onclick="pageTracker._trackPageview('/outgoing/www.zenoss.com/?referer=');">Zenoss</a>. As a full-featured network and service monitoring solution, Zenoss is one of the best monitoring tools available.</p>
<p>Most importantly, Zenoss combines two functionalities. First and foremost an enterprise environment requires host and service monitoring, with notifications. Network monitoring really means checking services, checking that hosts are up (they ping), and possibly writing your own plugins to check various other aspects of a server or network device. Until now, Nagios has filled that role.</p>
<p>Second, once a decent monitoring solution is in place, getting time-based information becomes desirable. Memory and CPU usage is the most prevalent example: if you&#8217;re checking available swap space every so often with Nagios, you may know when you start running low. But it may be just as important to see a graph of the last week&#8217;s usage. Tools like Cacti or Munin, which collect data frequently and use RRD graphs to display it, are very useful.</p>
<p>Zenoss fills both roles, without the annoying shortcomings prevalent in the alternative solutions. Zenoss uses the terms Availability Monitoring and Performance Monitoring to describe these two fundamental roles.</p>
<p>Performance of monitoring tools is important, and often times overlooked until it becomes a debilitating problem. For example, if you want to chart pretty RRD graphs of systems statistics like available RAM or disk space, <a href="http://munin.projects.linpro.no/" onclick="pageTracker._trackPageview('/outgoing/munin.projects.linpro.no/?referer=');">Munin</a> is an option. Unfortunately it&#8217;s all Perl, and designed in such a way that prevents it from scaling to even moderate amounts of hosts. <a href="http://cacti.net/" onclick="pageTracker._trackPageview('/outgoing/cacti.net/?referer=');">Cacti</a> is a bit better, but monitoring close to 100 hosts is painful with either option. Along comes Zenoss.</p>
<p>Zenoss is written in Python, and uses a MySQL backend for storage, and by all accounts it appears to perform very well. The really great thing about corporate-backed open source is quality control. The community simply isn&#8217;t responsible enough to say, &#8220;No, this won&#8217;t work, re-implement it.&#8221; A company with QA is.</p>
<p>Speaking of features, Zenoss isn&#8217;t missing many. Flexibility seems to be top priority–it can monitor hosts with SNMP, Nagios agents, SSH, Windows WMI, and various other mechanisms. Many features they claim are a bit over-inflated, such as ZenPing (marketed as Network Topology Monitoring) but the feature set is rich nonetheless.</p>
<p>Zenoss&#8217;s primary functions involve four features:</p>
<ul>
<li>Inventory Tracking</li>
<li>Availability Monitoring</li>
<li>Performance Monitoring</li>
<li>Event Monitoring and Management</li>
</ul>
<p>Inventory tracking claims some sort of &#8220;configuration&#8221; reporting as well, but it seems very limited. Zenoss will discover your inventory and auto-populate a database. This is great for knowing which IP addresses are in use, for example, but means that &#8220;configuration&#8221; reporting is limited to an outside observer&#8217;s perspective. It can tell you which servers have a Web server running, but it certainly doesn&#8217;t deal with the configuration of the Web server. Of course, inventory tracking isn&#8217;t limited to automatically discovered information; there are manual input capabilities too.</p>
<p>Availability monitoring is basically Nagios, plus. It can ping, it can monitor Windows machines, and it can pretty much do whatever you need. Even your old Nagios plugins will work with Zenoss. It does generate reports, but much better ones than Nagios is capable of.</p>
<p>Host monitoring, performance monitoring, or whatever you&#8217;d like to call it, is quite robust in Zenoss. Some would think it&#8217;s light on features, but there&#8217;s a good reason that Zenoss requires you use SNMP: it&#8217;s much more scalable than SSH&#8217;ing to each server every minute. A bit of up-front configuration is required, in that all your hosts will need SNMP configured and working, but it&#8217;s completely worth it. Zenoss too uses RRD graphs, and it can generate events and alerts based on pre-defined thresholds.</p>
<p>Finally we come to event monitoring. Zenoss is also encroaching on <a href="http://www.splunk.com/" onclick="pageTracker._trackPageview('/outgoing/www.splunk.com/?referer=');">Splunk</a>&#8216;s territory a bit. It can combine syslog, availability monitoring alerts, SNMP traps, and even Windows event log data. Much like Splunk, Zenoss correlates similar events for easier viewing and troubleshooting. This is the portion that processes all events and generates alerts to pagers or e-mail, taking into account the escalation procedure you&#8217;ve defined.</p>
<p>To top it all off, the Zenoss Web interface is top-notch. It includes a customizable &#8220;dashboard&#8221; for monitoring, and everything is AJAX-enabled. AJAX provides the user experience similar to Splunk and Google&#8217;s Gmail.</p>
<p>Marketing fluff aside, Zenoss really does provide a wonderful product. It is, of course, open source and available for free.</p>
<p>At last year&#8217;s <a href="http://www.enterprisenetworkingplanet.com/netsysm/article.php/3649236" onclick="pageTracker._trackPageview('/outgoing/www.enterprisenetworkingplanet.com/netsysm/article.php/3649236?referer=');">LISA</a> conference, Zenoss gave a demonstration that sadly coincided with free beer time. Stumbling in toward the end, I demanded one of their free baseball caps, and sat to listen to the last few audience questions. One thing was very obvious: everyone in the room was excited about this product. If hardcore sysadmins are excited, you know this is something worthwhile.</p>
<p>Zenosss is very functional and full of features. It may even be possible to replace three separate pieces of software with this one product: host inventory database, Nagios, and your performance monitoring tool of choice. Maybe even Splunk some day. We can&#8217;t wait to see what features they will be adding next.</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a title="Click me to see the sites." href="#" onclick="$$('div.d20').each( function(e) { e.visualEffect('slide_down',{duration:2.5}) }); return false;"><strong><em>Share this! (we greatly appreciate you sharing with friends)</em></strong></a>
<br />
<div class="d20" style="overflow:hidden">
<br />
<a onclick="pageTracker._trackPageview('/outgoing/del.icio.us/post?url=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fzenoss-we-can-ditch-nagios-now_2F_amp_title=Zenoss_3A+We+Can+Ditch+Nagios+Now&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fzenoss-we-can-ditch-nagios-now%2F&amp;title=Zenoss%3A+We+Can+Ditch+Nagios+Now" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/digg.com/submit?phase=2_amp_url=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fzenoss-we-can-ditch-nagios-now_2F_amp_title=Zenoss_3A+We+Can+Ditch+Nagios+Now&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fzenoss-we-can-ditch-nagios-now%2F&amp;title=Zenoss%3A+We+Can+Ditch+Nagios+Now" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/www.facebook.com/sharer.php?u=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fzenoss-we-can-ditch-nagios-now_2F&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fzenoss-we-can-ditch-nagios-now%2F" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/www.google.com/bookmarks/mark?op=edit_amp_output=popup_amp_bkmk=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fzenoss-we-can-ditch-nagios-now_2F_amp_title=Zenoss_3A+We+Can+Ditch+Nagios+Now&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fzenoss-we-can-ditch-nagios-now%2F&amp;title=Zenoss%3A+We+Can+Ditch+Nagios+Now" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/reddit.com/submit?url=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fzenoss-we-can-ditch-nagios-now_2F_amp_title=Zenoss_3A+We+Can+Ditch+Nagios+Now&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fzenoss-we-can-ditch-nagios-now%2F&amp;title=Zenoss%3A+We+Can+Ditch+Nagios+Now" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/slashdot.org/bookmark.pl?url=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fzenoss-we-can-ditch-nagios-now_2F_amp_title=Zenoss_3A+We+Can+Ditch+Nagios+Now&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://slashdot.org/bookmark.pl?url=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fzenoss-we-can-ditch-nagios-now%2F&amp;title=Zenoss%3A+We+Can+Ditch+Nagios+Now" rel="nofollow" title="Add to&nbsp;Slashdot"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/slashdot.png" title="Add to&nbsp;Slashdot" alt="Add to&nbsp;Slashdot" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/www.stumbleupon.com/submit?url=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fzenoss-we-can-ditch-nagios-now_2F_amp_title=Zenoss_3A+We+Can+Ditch+Nagios+Now&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fzenoss-we-can-ditch-nagios-now%2F&amp;title=Zenoss%3A+We+Can+Ditch+Nagios+Now" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/twitter.com/home/?status=Check+out+Zenoss_3A+We+Can+Ditch+Nagios+Now+_+http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fzenoss-we-can-ditch-nagios-now_2F&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+Zenoss%3A+We+Can+Ditch+Nagios+Now+@+http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fzenoss-we-can-ditch-nagios-now%2F" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/myweb2.search.yahoo.com/myresults/bookmarklet?u=http_3A_2F_2Fwww.longitudetech.com_2Flinux-unix_2Fzenoss-we-can-ditch-nagios-now_2F_amp_t=Zenoss_3A+We+Can+Ditch+Nagios+Now&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwww.longitudetech.com%2Flinux-unix%2Fzenoss-we-can-ditch-nagios-now%2F&amp;t=Zenoss%3A+We+Can+Ditch+Nagios+Now" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
<a style="font-size:90%;text-align: right; " title="Click me to hide the sites." href="#" onclick="$$('div.d20').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); return false;">Hide Sites</a>
</div>
</div>
<!-- Social Bookmarks END -->


<p>Related posts:<ol><li><a href='http://www.longitudetech.com/networking/squeeze-your-gigabit-nic-for-top-performance-2/' rel='bookmark' title='Permanent Link: Squeeze Your Gigabit NIC for Top Performance'>Squeeze Your Gigabit NIC for Top Performance</a></li>
<li><a href='http://www.longitudetech.com/linux-unix/managing-virtual-machine-and-cloud-sprawl/' rel='bookmark' title='Permanent Link: Managing Virtual Machine and Cloud Sprawl'>Managing Virtual Machine and Cloud Sprawl</a></li>
<li><a href='http://www.longitudetech.com/networking/built-in-security-with-cisco-ips/' rel='bookmark' title='Permanent Link: Built-in Security with Cisco IPS'>Built-in Security with Cisco IPS</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.longitudetech.com/linux-unix/zenoss-we-can-ditch-nagios-now/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>Squeeze Your Gigabit NIC for Top Performance</title>
		<link>http://www.longitudetech.com/networking/squeeze-your-gigabit-nic-for-top-performance-2/</link>
		<comments>http://www.longitudetech.com/networking/squeeze-your-gigabit-nic-for-top-performance-2/#comments</comments>
		<pubDate>Sat, 13 Feb 2010 20:36:39 +0000</pubDate>
		<dc:creator>charlie</dc:creator>
				<category><![CDATA[Networking]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[networks]]></category>
		<category><![CDATA[NIC]]></category>
		<category><![CDATA[tuning]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://www.longitudetech.com/blog/?p=19</guid>
		<description><![CDATA[Many new workstations and servers are coming with integrated gigabit network cards nowadays, but quite a few people soon discover that they can’t transfer data much faster than they did with 100 Mb/s network cards. Multiple factors can affect your ability to transfer at higher speeds, and most of them revolve around operating system settings. [...]


Related posts:<ol><li><a href='http://www.longitudetech.com/it-management/how-much-server-do-you-need/' rel='bookmark' title='Permanent Link: How Much Server do you Need?'>How Much Server do you Need?</a></li>
<li><a href='http://www.longitudetech.com/linux-unix/zenoss-we-can-ditch-nagios-now/' rel='bookmark' title='Permanent Link: Zenoss: We Can Ditch Nagios Now'>Zenoss: We Can Ditch Nagios Now</a></li>
<li><a href='http://www.longitudetech.com/networking/what-the-heck-is-a-tcam/' rel='bookmark' title='Permanent Link: What the Heck is a TCAM?'>What the Heck is a TCAM?</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Many new workstations and servers are coming with integrated gigabit network cards nowadays, but quite a few people soon discover that they can’t transfer data much faster than they did with 100 Mb/s network cards. Multiple factors can affect your ability to transfer at higher speeds, and most of them revolve around operating system settings. In this article we will discuss the necessary steps to make your new gigabit enabled server obtain close to gigabit speeds in Linux, FreeBSD, and Windows.</p>
<p><strong>Hardware considerations<br />
</strong><br />
First and foremost we must realize that there are hardware limitations to consider. Just because someone throws a gigabit network card in a server doesn’t mean the hardware can keep up. Network cards are normally connected to the PCI bus via a free PCI slot. In older workstation and non server-class motherboards the PCI slots are normally 32 bit, 33MHz. This means they can transfer at speeds of 133MB/s, but since it is a shared bus between many parts of the computer, realistically it’s limited to around 80MB/s in the best case. Gigabit network cards are 1000Mb/s, or 125MB/s. If the PCI bus is only capable of 80MB/s this is a major limiting factor for gigabit network cards. The math works out to 640Mb/s, which is really quite a bit faster than most gigabit network card installations, but remember this is probably the best-case scenario. If there are other hungry data loving PCI cards in the server, you’ll likely see much less throughput. The only solution for overcoming this bottleneck is to purchase a motherboard with a 66MHz PCI slot, which can do 266MB/s. Also, the new 64 bit PCI slots are capable of 532MB/s on a 66MHz bus. These are beginning to come standard on all server-class motherboards. </p>
<p>Assuming we’re using decent hardware that can keep up with the data rates necessary for gigabit, there is now another obstacle – the operating system. For testing, we used two identical servers: Intel Server motherboards, Pentium 4 3.0 GHz, 1GB RAM, integrated 10/100/1000 Intel network card. One was running Gentoo Linux with a 2.6 SMP kernel, and the other is FreeBSD 5.3 with an SMP kernel to take advantage of the Pentium 4’s HyperThreading capabilities. We were lucky to have a gigabit capable switch, but the same results could be accomplished by connecting both servers directly to each other. </p>
<p><strong>Software considerations<br />
</strong><br />
For testing speeds between two servers, we don’t want to use FTP or anything that will require data be fetched from disk. Memory to memory transfers are a much better test, and many tools exist to do this. For our tests, we used ttcp (http://www.pcausa.com/Utilities/pcattcp.htm). </p>
<p>The first test between these two servers was not pretty. The maximum rate was around 230 Mb/s, about two times as fast as a 100Mb/s network card. This is an improvement, but far from optimal. In actuality, most people will see even worse performance out of the box. However, with a few minor setting changes, we quickly realized major speed improvements &#8211; more than a threefold improvement over the initial test. </p>
<p>Many people recommend setting the MTU of your network interface larger. This basically means telling the network card to send a larger sized Ethernet frame. While this may be useful when connecting two hosts directly together, it becomes less useful when connecting through a switch that doesn’t support larger MTUs. At any rate, this isn’t necessary. 900Mb/s can be attained at the normal 1500 byte MTU setting.</p>
<p>For attaining maximum throughput, the most important options involve TCP window sizes. The TCP window controls the flow of data, and is negotiated during the start of a TCP connection. Using too small of a size will result in slowness, since TCP can only use the smaller of the two end system’s capabilities. It is quite a bit more complex than this, but here’s the information you really need to know:</p>
<p>For both Linux and FreeBSD we’re using the sysctl utility. For all of the following options, entering the command ‘sysctl variable=number’ should do the trick. To view the current settings use: ‘sysctl <variable name>’</p>
<p>Maximum window size:<br />
FreeBSD:<br />
kern.ipc.maxsockbuf=262144<br />
Linux:<br />
net.core.wmem_max=8388608</p>
<p>Default window size:</p>
<p>FreeBSD, sending and receiving:<br />
net.inet.tcp.sendspace=65536<br />
net.inet.tcp.recvspace=65536<br />
Linux, sending and receiving:<br />
net.core.wmem_default = 65536<br />
net.core.rmem_default = 65536</p>
<p>RFC 1323:<br />
This enables the useful window scaling options defined in rfc1323, which allows the windows to dynamically get larger than we specified above.<br />
FreeBSD:<br />
net.inet.tcp.rfc1323=1<br />
Linux:<br />
net.ipv4.tcp_window_scaling=1</p>
<p>Buffers:<br />
When sending large amounts of data, we can run the operating system out of buffers. This option should be enabled before attempting to use the above settings. To increase the amount of “mbufs” available:<br />
FreeBSD:<br />
kern.ipc.nmbclusters=32768<br />
Linux:<br />
net.ipv4.tcp_mem= 98304 131072 196608</p>
<p>These quick changes will skyrocket TCP performance. Afterwards we were able to run ttcp and attain around 895 Mb/s every time – quite an impressive data rate. There are other options available for adjusting the UDP datagram sizes as well, but we’re mainly focusing on TCP here.</p>
<p>Windows XP / 2000 Server / Server 2003</p>
<p>The magical location for TCP settings in the registry editor is:<br />
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters</p>
<p>We need to add a registry DWORD named TcpWindowSize, and enter a sufficiently large size. 131400 (make sure you click on decimal) should be enough.</p>
<p>Tcp1323Opts should be set to 3. This enables both rfc1323 scaling and timestamps.</p>
<p>And similarly to Unix, we also want to increase the TCP buffer sizes:<br />
ForwardBufferMemory 80000<br />
NumForwardPackets 60000</p>
<p>One last important note for Windows XP users needs to be made. If you’re installed service pack 2, then there is another likely culprit of poor network performance. Explained in knowledge base article 842264, Microsoft says that disabling Internet Connection Sharing after an SP2 install should fix performance issues. </p>
<p>The above tweaks should enable your sufficiently fast server to attain much faster data rates over TCP. If your specific application makes significant use of UDP, then it will be worth looking into similar options relating to UDP datagram sizes. Remember, we obtained close to 900Mb/s with a very fast Pentium 4 machine, server-class motherboard, and quality Intel network card. Results may vary wildly, but adjusting the above settings are a necessary step toward realizing your server’s capabilities.</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a title="Click me to see the sites." href="#" onclick="$$('div.d19').each( function(e) { e.visualEffect('slide_down',{duration:2.5}) }); return false;"><strong><em>Share this! (we greatly appreciate you sharing with friends)</em></strong></a>
<br />
<div class="d19" style="overflow:hidden">
<br />
<a onclick="pageTracker._trackPageview('/outgoing/del.icio.us/post?url=http_3A_2F_2Fwww.longitudetech.com_2Fnetworking_2Fsqueeze-your-gigabit-nic-for-top-performance-2_2F_amp_title=Squeeze+Your+Gigabit+NIC+for+Top+Performance&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.longitudetech.com%2Fnetworking%2Fsqueeze-your-gigabit-nic-for-top-performance-2%2F&amp;title=Squeeze+Your+Gigabit+NIC+for+Top+Performance" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/digg.com/submit?phase=2_amp_url=http_3A_2F_2Fwww.longitudetech.com_2Fnetworking_2Fsqueeze-your-gigabit-nic-for-top-performance-2_2F_amp_title=Squeeze+Your+Gigabit+NIC+for+Top+Performance&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.longitudetech.com%2Fnetworking%2Fsqueeze-your-gigabit-nic-for-top-performance-2%2F&amp;title=Squeeze+Your+Gigabit+NIC+for+Top+Performance" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/www.facebook.com/sharer.php?u=http_3A_2F_2Fwww.longitudetech.com_2Fnetworking_2Fsqueeze-your-gigabit-nic-for-top-performance-2_2F&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fwww.longitudetech.com%2Fnetworking%2Fsqueeze-your-gigabit-nic-for-top-performance-2%2F" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/www.google.com/bookmarks/mark?op=edit_amp_output=popup_amp_bkmk=http_3A_2F_2Fwww.longitudetech.com_2Fnetworking_2Fsqueeze-your-gigabit-nic-for-top-performance-2_2F_amp_title=Squeeze+Your+Gigabit+NIC+for+Top+Performance&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fwww.longitudetech.com%2Fnetworking%2Fsqueeze-your-gigabit-nic-for-top-performance-2%2F&amp;title=Squeeze+Your+Gigabit+NIC+for+Top+Performance" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/reddit.com/submit?url=http_3A_2F_2Fwww.longitudetech.com_2Fnetworking_2Fsqueeze-your-gigabit-nic-for-top-performance-2_2F_amp_title=Squeeze+Your+Gigabit+NIC+for+Top+Performance&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.longitudetech.com%2Fnetworking%2Fsqueeze-your-gigabit-nic-for-top-performance-2%2F&amp;title=Squeeze+Your+Gigabit+NIC+for+Top+Performance" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/slashdot.org/bookmark.pl?url=http_3A_2F_2Fwww.longitudetech.com_2Fnetworking_2Fsqueeze-your-gigabit-nic-for-top-performance-2_2F_amp_title=Squeeze+Your+Gigabit+NIC+for+Top+Performance&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://slashdot.org/bookmark.pl?url=http%3A%2F%2Fwww.longitudetech.com%2Fnetworking%2Fsqueeze-your-gigabit-nic-for-top-performance-2%2F&amp;title=Squeeze+Your+Gigabit+NIC+for+Top+Performance" rel="nofollow" title="Add to&nbsp;Slashdot"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/slashdot.png" title="Add to&nbsp;Slashdot" alt="Add to&nbsp;Slashdot" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/www.stumbleupon.com/submit?url=http_3A_2F_2Fwww.longitudetech.com_2Fnetworking_2Fsqueeze-your-gigabit-nic-for-top-performance-2_2F_amp_title=Squeeze+Your+Gigabit+NIC+for+Top+Performance&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.longitudetech.com%2Fnetworking%2Fsqueeze-your-gigabit-nic-for-top-performance-2%2F&amp;title=Squeeze+Your+Gigabit+NIC+for+Top+Performance" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/twitter.com/home/?status=Check+out+Squeeze+Your+Gigabit+NIC+for+Top+Performance+_+http_3A_2F_2Fwww.longitudetech.com_2Fnetworking_2Fsqueeze-your-gigabit-nic-for-top-performance-2_2F&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+Squeeze+Your+Gigabit+NIC+for+Top+Performance+@+http%3A%2F%2Fwww.longitudetech.com%2Fnetworking%2Fsqueeze-your-gigabit-nic-for-top-performance-2%2F" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<a onclick="pageTracker._trackPageview('/outgoing/myweb2.search.yahoo.com/myresults/bookmarklet?u=http_3A_2F_2Fwww.longitudetech.com_2Fnetworking_2Fsqueeze-your-gigabit-nic-for-top-performance-2_2F_amp_t=Squeeze+Your+Gigabit+NIC+for+Top+Performance&amp;referer=');window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwww.longitudetech.com%2Fnetworking%2Fsqueeze-your-gigabit-nic-for-top-performance-2%2F&amp;t=Squeeze+Your+Gigabit+NIC+for+Top+Performance" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://www.longitudetech.com/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
<a style="font-size:90%;text-align: right; " title="Click me to hide the sites." href="#" onclick="$$('div.d19').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); return false;">Hide Sites</a>
</div>
</div>
<!-- Social Bookmarks END -->


<p>Related posts:<ol><li><a href='http://www.longitudetech.com/it-management/how-much-server-do-you-need/' rel='bookmark' title='Permanent Link: How Much Server do you Need?'>How Much Server do you Need?</a></li>
<li><a href='http://www.longitudetech.com/linux-unix/zenoss-we-can-ditch-nagios-now/' rel='bookmark' title='Permanent Link: Zenoss: We Can Ditch Nagios Now'>Zenoss: We Can Ditch Nagios Now</a></li>
<li><a href='http://www.longitudetech.com/networking/what-the-heck-is-a-tcam/' rel='bookmark' title='Permanent Link: What the Heck is a TCAM?'>What the Heck is a TCAM?</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.longitudetech.com/networking/squeeze-your-gigabit-nic-for-top-performance-2/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->