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

<channel>
	<title>J Squared Consulting &#187; Linux</title>
	<atom:link href="http://jsquaredconsulting.com/blog/category/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://jsquaredconsulting.com/blog</link>
	<description></description>
	<lastBuildDate>Mon, 16 Aug 2010 06:46:12 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Using Screen to share your terminal.</title>
		<link>http://jsquaredconsulting.com/blog/2010/08/using-screen-to-share-your-terminal/</link>
		<comments>http://jsquaredconsulting.com/blog/2010/08/using-screen-to-share-your-terminal/#comments</comments>
		<pubDate>Mon, 16 Aug 2010 06:46:12 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[User Administration]]></category>
		<category><![CDATA[BASH]]></category>
		<category><![CDATA[pair programing]]></category>
		<category><![CDATA[remote debugging]]></category>
		<category><![CDATA[remote desktop]]></category>
		<category><![CDATA[screen]]></category>
		<category><![CDATA[screen sharing]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[terminal sharing]]></category>

		<guid isPermaLink="false">http://jsquaredconsulting.com/blog/?p=88</guid>
		<description><![CDATA[As a consultant who works with remote clients and, before that, a telecommuting systems engineer for companies who used linux I have often encountered the problem of collaborating inside of a remote client that does not have X and who&#8217;s only access is ssh. Servers with GUI interfaces like Windows or Mac OS X have [...]]]></description>
			<content:encoded><![CDATA[<p>As a consultant who works with remote clients and, before that, a telecommuting systems engineer for companies who used linux I have often encountered the problem of collaborating inside of a remote client that does not have X and who&#8217;s only access is ssh.  Servers with GUI interfaces like Windows or Mac OS X have a long history of tools to share the desktop with multiple users, oddly enough both are called Remote Desktop.  Servers that only have a command line interface, like most linux servers, do not have such an obvious tool for sharing the terminal with another user. While bash and ssh can be manipulated to accomplish this, <a href="http://www.gnu.org/software/screen/">screen</a> fills this roll nicely.  </p>
<p>Screen allows you to create virtual terminals that you can detach from and attach to at will.  Detaching from a screen will leave it running in the background.  Attaching to it again allows you to keep executing commands where you were or see the current state of a process you left running.  If you are the user who started the screen you can attach to a screen that is already attached to, this is is how the shared screen is accomplished. </p>
<p>To set it up, one user logs in to the server and, using su or sudo su, changes to either the second users account or an account that all parties can access.  Next, start screen with the -S option and give it a meaningful name.</p>
<blockquote><p>me@jjtest:~# sudo su &#8211; theOtherGuy<br />
theOtherGuy@jjtest:~# screen -S blogTest
</p></blockquote>
<p>If screen is not installed, it is available as a package on most popular linux distributions.  You are now in a screen session as theOtherGuy.  Now just tell theOtherGuy to log in and that your screen is called blogTest and he will simply need to run screen with the -x option and give the screen name.</p>
<blockquote><p>theOtherGuy@jjtest:~# screen -x blogTest</p></blockquote>
<p>At this point you are both in the same screen session and can both interact with it.  This is great for showing another user what kind of problems you may be having or how to do a certain process.  It can also be used to accomplish remote pair programing on the remote system.  And this doesn&#8217;t have to be limited to just two users, as long as someone can get to that system as that user they can join the screen as well.  </p>
<p>Typing exit at this point will kill the screen and kick both of you out.  If one user wants to leave but not kick the other person off the user just presses Ctrl+a and then d, this will detach you from the screen.  Ctrl+a is the default hot key for activating screen commands.  You can read more about the variety of command available on screen at <a href="http://www.pixelbeat.org/lkdb/screen.html">this site</a> or read abut it fully on the <a href="http://www.gnu.org/software/screen/manual/screen.html">man page</a>.</p>
<p>Screen can be used to do so much more than I&#8217;ve talked about here but it&#8217;s ability to facilitate the sharing of a terminal between users can be a life saver when you need it.  It is not normally installed by default to may linux systems so you may have to install it or ask that it be installed.  </p>
]]></content:encoded>
			<wfw:commentRss>http://jsquaredconsulting.com/blog/2010/08/using-screen-to-share-your-terminal/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting the bang (!) for your buck ($) from BASH</title>
		<link>http://jsquaredconsulting.com/blog/2010/07/getting-the-bang-for-your-buck-from-bash/</link>
		<comments>http://jsquaredconsulting.com/blog/2010/07/getting-the-bang-for-your-buck-from-bash/#comments</comments>
		<pubDate>Tue, 13 Jul 2010 06:36:03 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[!]]></category>
		<category><![CDATA[!!]]></category>
		<category><![CDATA[!$]]></category>
		<category><![CDATA[!:]]></category>
		<category><![CDATA[BASH]]></category>
		<category><![CDATA[bash history]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[history]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[RedHat]]></category>
		<category><![CDATA[server administration]]></category>
		<category><![CDATA[system administration]]></category>
		<category><![CDATA[System administrator]]></category>
		<category><![CDATA[time saving]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://jsquaredconsulting.com/blog/?p=64</guid>
		<description><![CDATA[Most of the work I do is on systems who&#8217;s primary interface is BASH. BASH is the shell that runs on most Linux distributions and Mac OS X when you open a terminal or SSH in. There are a few short cuts I have picked up along the way that are built into BASH but [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft" title="Tux" src="http://jsquaredconsulting.com/images/linux.png" alt="" width="64" height="64"> Most of the work I do is on systems who&#8217;s primary interface is BASH.  BASH is the shell that runs on most Linux distributions and Mac OS X when you open a terminal or SSH in.  There are a few short cuts I have picked up along the way that are built into BASH but aren&#8217;t all that obvious or in the man ( manual ) pages.  One very powerful shortcut, ! ( refered to as bang ), is used in BASH to reference the prior command(s) in varius ways and can really speed up your work in the terminal.</p>
<p><strong>!$</strong><br />
The command that this post is named for is used to reference the last argument in the previous command. For example, let&#8217;s say you set up a new directory for your client you would need to set the ownership and permissions on it.</p>
<blockquote><p>mkdir /dir/made/for/client1<br />
chown client1:client1 /dir/made/for/client1<br />
chmod 750 /dir/made/for/client1</p></blockquote>
<p>This can be shortened by using the !$ shortcut like this.</p>
<blockquote><p>mkdir /dir/made/for/client1<br />
chown client1:client1 !$<br />
chmod 750 !$</p></blockquote>
<p>The time savings here are minor but over time can help, by referencing the first command we also reduce the number of typos.</p>
<p><strong>!!</strong><br />
This command references the complete previous command.  &#8220;Doesn&#8217;t the up arrow do that?&#8221; you ask?  The up arrow pulls the previous command up, allowing you to run it again or modify it.  !! allows you to insert the previous command into what you are typing.  Take the previous example, if you didn&#8217;t have permission to make the directory the first time you tried you could try it again using sudo, like this.</p>
<blockquote><p>mkdir /dir/made/for/client1 (returns an error about permission denied)<br />
sudo mkdir /dir/made/for/client1 (works)</p></blockquote>
<p>This can be shortened using the !! shortcut like this.</p>
<blockquote><p>mkdir /dir/made/for/client1 (returns an error about permission denied)<br />
sudo !! (works)</p></blockquote>
<p><strong>!number</strong> or <strong>!-number</strong><br />
BASH, in most configurations, keeps a history of your commands. You can see a list of those commands using the command <em>history</em>.</p>
<blockquote><p>server01:~ j2$ history<br />
26  command1<br />
27  command2<br />
28  command3<br />
29  command4<br />
30  command5<br />
31  command6<br />
32  command7<br />
33  command8<br />
34  command9<br />
35  history</p></blockquote>
<p>You can reference any of these commands using the number next to them and the ! shortcut.  If I wanted to run command5 again I would do this.</p>
<blockquote><p>!30</p></blockquote>
<p>You can also reference commands in reverse by negating them.  If I remembered that I ran command5 six commands ago I could do this.</p>
<blockquote><p>!-6</p></blockquote>
<p><strong>!:number</strong><br />
By putting a : and a number after the ! you can reference individual arguments in a previous command.  Each &#8220;word&#8221; in a command gets assigned a number, starting with 0.  For example, in the command chmod 750 /dir/made/for/client1 chmod = 0, 750 = 1, and /dir/made/for/client1 = 2.   So if I had to change the permissions on a few directories it would look like this.</p>
<blockquote><p>chmod 750 /dir/made/for/client1<br />
chmod 750 /dir/made/for/client2<br />
chmod 750 /dir/made/for/client3</p></blockquote>
<p>Using the shortcut it would look like this.</p>
<blockquote><p>chmod 750 /dir/made/for/client1<br />
!:0 !:1 /dir/made/for/client2<br />
!:0 !:1 /dir/made/for/client3</p></blockquote>
<p>Finally, the last shortcut and this one can be combined to reference specific parts of a command in your history list.  Say I just did all those chmod commands above but forgot to chown client1&#8242;s dir.  Using the combination I could do this.</p>
<blockquote><p>chown client1:client1 !-3:2</p></blockquote>
<p>You can now see why ! is one of my favorite tools while working in BASH.  If you have any questions or know of another way to use !, please leave a comment.</p>
]]></content:encoded>
			<wfw:commentRss>http://jsquaredconsulting.com/blog/2010/07/getting-the-bang-for-your-buck-from-bash/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>0 day exploits</title>
		<link>http://jsquaredconsulting.com/blog/2010/01/0-day-exploits/</link>
		<comments>http://jsquaredconsulting.com/blog/2010/01/0-day-exploits/#comments</comments>
		<pubDate>Thu, 14 Jan 2010 03:25:40 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Monitoring]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Apache HTTP Server]]></category>
		<category><![CDATA[Exploit]]></category>
		<category><![CDATA[Hack]]></category>
		<category><![CDATA[Hackers]]></category>
		<category><![CDATA[LAMP]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Red Hat]]></category>
		<category><![CDATA[Server]]></category>
		<category><![CDATA[Web server]]></category>
		<category><![CDATA[WWW]]></category>
		<category><![CDATA[Zero Day Attack]]></category>
		<category><![CDATA[Zero Day Exploit]]></category>

		<guid isPermaLink="false">http://jsquaredconsulting.com/blog/?p=28</guid>
		<description><![CDATA[Zero day exploits, best explained here, will be coming out daily for the month of January, it seems, due to a security research firm in Russia. No matter what you think about their methods, this does highlight a fact that is sometimes forgotten, every running service presents the potential for an exploit. But without those [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft" title="Tux" src="http://jsquaredconsulting.com/images/linux.png" alt="" width="64" height="64">Zero day exploits, best explained <a href="http://en.wikipedia.org/wiki/Zero_day_attack" target="_new">here</a>, will be coming out daily for the month of January, it seems, due to a <a href="http://intevydis.blogspot.com/" target="_new">security research firm in Russia</a>.  No matter what you think about their methods, this does highlight a fact that is sometimes forgotten, every running service presents the potential for an exploit.  But without those services a computer is just an overpriced electric heater.  So how do we protect ourselves against the unknown and unpatched?  By being very careful about what our servers are running, only allowing access to the minimum number of resources required to get the job done, and having a plan for when your monitoring reports the service is down.</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Since linux distributions are varied in their installs I won&#8217;t go through each but most of the &#8220;friendly&#8221; distributions start, by default, a variety of services that may not be required but could potentially have exploits.   While most of these don&#8217;t have a network component, combined with other exploits they could help open the server to attack.  For example, Red Hat starts processes to monitor the software raid and logical volume manager even if you aren&#8217;t using them.  It also starts processes for handling bluetooth devices, HP printers, and command line mouse support, even if you don&#8217;t have them.  None of these should cause you any concern but if you don&#8217;t need them they don&#8217;t need to run at all.</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Most Apache HTTP server installs suffer from the same desire for usability, many modules are made available to the server by default.  For example, you probably aren&#8217;t using LDAP authentication or WebDAV as part of your server but the modules for them are preloaded on most default installs.  Identifying the modules that are required for your web site or application to run and then disabling the ones that are not will reduce your apache httpd footprint and therefore reduce your exposure.</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MySQL server doesn&#8217;t have the modular nature of our prior two examples but there are some steps that you can take to reduce your exposure.  First off, after doing the install and setting the root password, remove the test user and database.  These have no known exploits but aren&#8217;t needed.  Second, ensure that your users are bound to a host instead of a wild card address, this makes sure that connections are only authorized from known hosts.  Finally, if you are running mysql on the same host as your webserver and this is the only server that needs to access it, configure it to only listen on localhost ( There is no place like 127.0.0.1 ), this ensures that remote hosts cannot connect to your database even if your firewall fails.</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;While I did focus on some of the more simple things that can be done to a LAMP server, this should give you an idea of what kind of changes can be made that won&#8217;t effect your service but will reduce your exposure footprint.  Remember that before you make any changes you should do a backup and make copies of the files you are editing.  We will see what this month brings as far as unpublished exploits and should also take this time to remember that not all exploits are published or patched, or even discovered yet.</p>
<div style="margin-top: 10px; height: 15px;" class="zemanta-pixie"><a class="zemanta-pixie-a" href="http://reblog.zemanta.com/zemified/7fe923b5-726f-4079-a969-5b65c2f19d1f/" title="Reblog this post [with Zemanta]"><img style="border: medium none ; float: right;" class="zemanta-pixie-img" src="http://img.zemanta.com/reblog_e.png?x-id=7fe923b5-726f-4079-a969-5b65c2f19d1f" alt="Reblog this post [with Zemanta]"></a><span class="zem-script more-related more-info pretty-attribution"><script type="text/javascript" src="http://static.zemanta.com/readside/loader.js" defer="defer"></script></span></div>
]]></content:encoded>
			<wfw:commentRss>http://jsquaredconsulting.com/blog/2010/01/0-day-exploits/feed/</wfw:commentRss>
		<slash:comments>92</slash:comments>
		</item>
		<item>
		<title>Likewise, the myth debunked</title>
		<link>http://jsquaredconsulting.com/blog/2009/06/likewise-the-myth-debunked/</link>
		<comments>http://jsquaredconsulting.com/blog/2009/06/likewise-the-myth-debunked/#comments</comments>
		<pubDate>Mon, 15 Jun 2009 06:28:08 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[User Administration]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[Authentication]]></category>
		<category><![CDATA[Microsoft Windows]]></category>
		<category><![CDATA[Open source]]></category>
		<category><![CDATA[Operating system]]></category>
		<category><![CDATA[System administrator]]></category>
		<category><![CDATA[User]]></category>

		<guid isPermaLink="false">http://jsquaredconsulting.com/blog/?p=7</guid>
		<description><![CDATA[This post originally written for my personal blog on June 14th 2009. As a systems administrator in many mixed Windows and linux environments I have seen and made many of my own attempts at integrating the linux servers into the Windows Active Directory structure with mixed results. Linux registration and authentication inside of a Windows [...]]]></description>
			<content:encoded><![CDATA[<p>This post originally written for my personal blog on June 14th 2009.</p>
<p><a href="http://www.likewise.com"><img alt="" src="http://likewise.com/images/logo_likewise_pos.gif" title="Likewise" class="alignleft" width="232" height="36"></a>As a systems administrator in many mixed <a class="zem_slink" href="http://www.microsoft.com/WINDOWS" title="Windows" rel="homepage">Windows</a> and linux environments I have seen and made many of my own attempts at integrating the linux servers into the Windows Active Directory structure with mixed results.  Linux registration and authentication inside of a Windows domain is akin to the bigfoot: some have claimed to see one, many have worked long hours to find them, no one can produce consistent results.  Until now.</p>
<p>At the suggestion by a coworker I decided to give <a href="http://likewise.com" target="_new">Likewise</a> a try on my most recent attempt at bringing our linux servers into the windows domain.  Skeptically I built a new <a class="zem_slink" href="http://www.centos.org/" title="CentOS" rel="homepage">CentOS</a> 5.3 server and proceeded to follow the instructions for installing Likewise.  The seemed too simple and with each step I waited for the fatal issue that would bring the test to it&#8217;s demise.  Software installed, no issues.  As I reviewed the <a href="http://likewise.com/resources/documentation_library/manuals/open/likewise-open-guide.html" target="_new">instructions</a> for adding the system to the domain and found that it only required one command and no further configuration of files I thought, &#8220;This is so going to fall on it&#8217;s face.&#8221;  Command executed and I&#8217;m waiting, then it comes up on the screen: Success.  Success? Really? I don&#8217;t believe it, I log onto the domain controller and there it is, right where new computers are supposed to go in the domain.  I quickly flip over to the manual and look up how to authenticate for ssh, simple DOMAIN\\username@host, and give it the final test.  Success.  In the span of 15 minutes I was able to install the app, add my computer to the domain and authenticate against the domain.  15 more minutes and I was able to limit who could log in and give them sudo access.  This is a huge win for any admin who deals with linux servers in a domain.</p>
<p>I&#8217;m still testing the limits of <a href="http://likewise.com" target="_new">Likewise</a> and I will say that it hasn&#8217;t been without it&#8217;s speed bumps but I plan on paying for a little support and getting the answers I need.  Like may <a class="zem_slink" href="http://www.wikinvest.com/concept/Open_Source" title="Open Source" rel="wikinvest">open source</a> products, Likewise is making it&#8217;s money on support and by selling upgraded functionality.  I applaud this model, allowing the flexibility of open source while still finding a way to pay for all that hard work.  I will be continuing to test the limits of Likewise but as of now I am thoroughly impressed and will continue to use it.</p>
<div style="margin-top: 10px; height: 15px;" class="zemanta-pixie"><a class="zemanta-pixie-a" href="http://reblog.zemanta.com/zemified/bdcfe811-bf6d-41eb-89fd-6e19ef88c268/" title="Reblog this post [with Zemanta]"><img style="border: medium none ; float: right;" class="zemanta-pixie-img" src="http://img.zemanta.com/reblog_e.png?x-id=bdcfe811-bf6d-41eb-89fd-6e19ef88c268" alt="Reblog this post [with Zemanta]"></a><span class="zem-script more-related more-info pretty-attribution"><script type="text/javascript" src="http://static.zemanta.com/readside/loader.js" defer="defer"></script></span></div>
]]></content:encoded>
			<wfw:commentRss>http://jsquaredconsulting.com/blog/2009/06/likewise-the-myth-debunked/feed/</wfw:commentRss>
		<slash:comments>156</slash:comments>
		</item>
	</channel>
</rss>
