<?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>dbugs.org &#187; Linux</title>
	<atom:link href="http://blog.dbugs.org/category/tutorial/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.dbugs.org</link>
	<description>where knowledge meets creation</description>
	<lastBuildDate>Fri, 04 Feb 2011 16:13:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>quick recipe</title>
		<link>http://blog.dbugs.org/2009/01/05/quick-wordpress-upgrade-recipie/</link>
		<comments>http://blog.dbugs.org/2009/01/05/quick-wordpress-upgrade-recipie/#comments</comments>
		<pubDate>Mon, 05 Jan 2009 00:49:04 +0000</pubDate>
		<dc:creator>Marco Garcês</dc:creator>
				<category><![CDATA[Blogs]]></category>
		<category><![CDATA[CLI]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[new]]></category>
		<category><![CDATA[svn]]></category>
		<category><![CDATA[upgrade]]></category>

		<guid isPermaLink="false">http://blog.dbugs.org/?p=151</guid>
		<description><![CDATA[Such a long time since my last post&#8230; so here is a quick recipe for WordPress upgrade: Login to your shell mv blog blog_old mkdir blog_new &#38;&#38; cd blog_new &#38;&#38; svn co http://svn.automattic.com/wordpress/tags/2.7 . cd ~/blog_old/ cp -p wp-config.php .htaccess ../blog_new &#38;&#38; cp -rpf wp-content/* ../blognew/wp-content cd ~/blog_new/ &#38;&#38; svn sw http://svn.automattic.com/wordpress/tags/2.7/ . mv blog_new [...]]]></description>
			<content:encoded><![CDATA[<p>Such a long time since my last post&#8230; so here is a quick recipe for WordPress upgrade:</p>
<p style="text-align: center;">
<p><span id="more-151"></span></p>
<ol>
<li>Login to your shell</li>
<li><em><code>mv blog blog_old</code></em></li>
<li><em><code>mkdir blog_new &amp;&amp; cd blog_new</code></em><code><em> &amp;&amp; svn co http://svn.automattic.com/wordpress/tags/2.7 .</em></code><em></em></li>
<li><em><code>cd ~/blog_old/</code></em></li>
<li><em><code>cp -p wp-config.php .htaccess ../blog_new &amp;&amp; cp -rpf wp-content/* ../blognew/wp-content</code></em></li>
<li><em><code>cd ~/blog_new/ &amp;&amp; svn sw http://svn.automattic.com/wordpress/tags/2.7/ . </code></em></li>
<li><em><code>mv blog_new blog</code><br />
</em></li>
<li>go to http://&lt;you_url&gt;/wp-admin/upgrade.php and perform the update process</li>
</ol>
<p>And thats it! Put it in the hoven for 10 minutes and leave to rest! After that go enjoy your new and upgraded blog! Oh, by the way, each time a new version comes out, just go inside your blog dir and do a:</p>
<ul>
<li><em><code>svn sw http://svn.automattic.com/wordpress/tags/2.7/ . </code></em></li>
</ul>
<p>Pretty sweet! =)</p>
<p><strong>UPDATE:</strong> in fact you can forget step 2, and just move your old directory in the end, when about to go live. Perform the all the steps in the recipe, than at the end, just change blog to blog_old (or some other name you might have) and change blog_new to blog. This way you now point to you new <a title="svn - version control system" href="http://subversion.tigris.org/" target="_self">SVN</a> install, and you old stuff is safeguarded. Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.dbugs.org/2009/01/05/quick-wordpress-upgrade-recipie/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>I feel so limited&#8230;</title>
		<link>http://blog.dbugs.org/2008/02/22/4-gb-memory-limitation/</link>
		<comments>http://blog.dbugs.org/2008/02/22/4-gb-memory-limitation/#comments</comments>
		<pubDate>Fri, 22 Feb 2008 12:03:29 +0000</pubDate>
		<dc:creator>Marco Garcês</dc:creator>
				<category><![CDATA[hardware]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[4GB]]></category>
		<category><![CDATA[intel]]></category>
		<category><![CDATA[memory]]></category>
		<category><![CDATA[PAE]]></category>
		<category><![CDATA[ram]]></category>
		<category><![CDATA[vista]]></category>
		<category><![CDATA[xp]]></category>

		<guid isPermaLink="false">http://blog.dbugs.org/2008/02/22/4-gb-memory-limitation/</guid>
		<description><![CDATA[Yesterday at work, my boss asked me, if I knew the 4GB memory limitation Windows Vista had, because a client was there having problems with this issue&#8230; Since I&#8217;m not a big windows user, except for a desktop that his only purpose is to download Linux distros using bit torrent protocol, I was not fully [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://farm3.static.flickr.com/2317/1568025784_8f10e9d3c6_t.jpg"><img style="border: 5px solid black;" src="http://farm3.static.flickr.com/2317/1568025784_8f10e9d3c6_t.jpg" border="5" alt="copyright http://www.flickr.com/photos/sikachu/" width="83" height="125" align="right" /></a>Yesterday at work, my boss asked me, if I knew the 4GB memory limitation Windows Vista had, because a client was there having problems with this issue&#8230;<span id="more-117"></span></p>
<p>Since I&#8217;m not a big windows user, except for a desktop that his only purpose is to download Linux distros using bit torrent protocol, I was not fully aware of this limitation.</p>
<p>So I did some quick research and realized that this limitation was not a Windows problem, but a hardware problem! You see, 32-bit systems have a limit of memory that they can use. Normally this is 4GB minus the total ammount of memory in the Video Card, the BIOS and everything inside you machine that has memory. So most of the users that now buy 4Gib ram to use with their brand new Vista machine, get stucked at 3 ou 3,5 Gib.</p>
<p>Even thouhg Linux also suffers from the same limitations, it is able to handle higher memory installed, since it uses correctly the PAE&#8230; What is PAE you might ask? PAE, or <a title="Physical Address Extension" href="http://en.wikipedia.org/wiki/Physical_Address_Extension">Physical Address Extension</a> is a feature that allows the use of more than 4Gib of physical memory, given apropriate operating system support for this feature.</p>
<p>There are some things you might do to enable PAE in 32-bit Vista, but I haven&#8217;t tryed yet this.. maybe in the future&#8230;</p>
<p>Here are some places you can go, to read a little bit more and try for yourself:</p>
<ul>
<li><a title="Enabling PAE on 32-bit Windows Vista" href="http://www.thegeeksweek.com/blog/enabling-pae-on-32-bit-windows-vista.html">Enabling PAE in Vista</a></li>
<li><a title="Physical Address Extension" href="http://en.wikipedia.org/wiki/Physical_Address_Extension">Wiki on PAE</a></li>
<li><a title="The system memory that is reported in the System Information dialog box in Windows Vista is less than you expect if 4 GB of RAM is installed" href="http://support.microsoft.com/kb/929605">Microsoft on PAE in Vista</a></li>
</ul>
<p>In the future, this limitation will be overcome, since the use of 64-bit systems sets the memory limit much higher. If you want 4Gib, with no hassle just switch to a superior operating system like GNU/Linux or Mac OS X =)</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.dbugs.org/2008/02/22/4-gb-memory-limitation/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>SSH on Window$.. .the smart way!</title>
		<link>http://blog.dbugs.org/2007/09/29/ssh-on-windows-smart-way/</link>
		<comments>http://blog.dbugs.org/2007/09/29/ssh-on-windows-smart-way/#comments</comments>
		<pubDate>Sat, 29 Sep 2007 15:32:24 +0000</pubDate>
		<dc:creator>Marco Garcês</dc:creator>
				<category><![CDATA[CLI]]></category>
		<category><![CDATA[hacks]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://blog.dbugs.org/2007/09/29/ssh-on-windows-smart-way/</guid>
		<description><![CDATA[This will be a quick one&#8230; Do you use Linux over the command-line? Do you access remotely these machines using SSH? Are you sitting in front of a Windows computer? If your answers were yes to all three, I&#8217;m going to assume that you know the Putty software, and you already use it.. Now lets [...]]]></description>
			<content:encoded><![CDATA[<p>This will be a quick one&#8230; Do you use Linux over the command-line? Do you access remotely these machines using SSH? Are you sitting in front of a Windows computer? If your answers were yes to all three, I&#8217;m going to assume that you know the <a href="http://en.wikipedia.org/wiki/PuTTY" title="everything on the Putty software">Putty</a> software, and you already use it.. Now lets learn how to use it&#8230; the smart way!<br />
<span id="more-114"></span>These are very simple steps, and will save you a lot of clicks and time, not to mention its way more cool!</p>
<ol>
<li><a href="http://www.google.com/search?q=putty+download&amp;ie=utf-8&amp;oe=utf-8&amp;aq=t&amp;rls=org.mozilla:en-US:official&amp;client=firefox-a" title="get your copy of Putty">Download</a> Putty to you desktop</li>
<li>Change the name of the file, from <em>putty.exe</em> to <em>ssh.exe</em></li>
<li>Move this file to your <strong><em>Windows</em></strong> directory (should be on you drive <strong><em>C:\</em></strong>)</li>
<li>Press <em><a href="http://en.wikipedia.org/wiki/Windows_key" title="don't know the windows key?">Windows Key</a> + R</em> (shortcut for run command)</li>
<li>Type <em>ssh user@remote.example.com </em>(use your own user and server)</li>
</ol>
<p>If you got everything right, you now will be asked for your user password.. You can do it even smarter, and use <a href="http://blog.dbugs.org/2007/06/17/ssh-keys-authentication/" title="my post on the subject, no steps for putty">public key authentication</a>, which I love so much, and no more typing would be necessary.</p>
<p>Very cool right? No more fiddling for Putty.exe, no more clicks, no more hassle.. Just &#8220;<strong>RUN+ssh+options</strong>&#8221; and this will get you there! Like I said, SSH on Windows&#8230; The smart way!</p>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.dbugs.org/2007/09/29/ssh-on-windows-smart-way/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Lock down! SSH lock down!</title>
		<link>http://blog.dbugs.org/2007/08/29/ssh-security/</link>
		<comments>http://blog.dbugs.org/2007/08/29/ssh-security/#comments</comments>
		<pubDate>Wed, 29 Aug 2007 16:17:24 +0000</pubDate>
		<dc:creator>Marco Garcês</dc:creator>
				<category><![CDATA[CLI]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[Clients]]></category>
		<category><![CDATA[Command line interface]]></category>
		<category><![CDATA[Documentation]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Open SSH]]></category>
		<category><![CDATA[Protocols]]></category>
		<category><![CDATA[Secure Shell]]></category>

		<guid isPermaLink="false">http://blog.dbugs.org/2007/08/29/ssh-security/</guid>
		<description><![CDATA[Everybody that uses Linux, one way or another, will be using the command line for admin. Sure you can have those graphical tools to do the job, but there is nothing like the command line for this. And if you manage a couple of remote machines, the only way you can get with this, is [...]]]></description>
			<content:encoded><![CDATA[<p><img title="terminal" src="http://blog.dbugs.org/wp-content/uploads/2007/08/terminal1.png" alt="terminal" align="right" />Everybody that uses Linux, one way or another, will be using the <a class="zem_slink" title="Command line interface" rel="wikipedia" href="http://en.wikipedia.org/wiki/Command_line_interface">command line</a> for admin. Sure you can have those graphical tools to do the job, but there is nothing like the command line for this. And if you manage a couple of remote machines, the only way you can get with this, is using the command line via SSH. Although this is a discussed subject, I went to a few steps the other day, on a personal remote server, to improve SSH security, to a level I can sleep good at night. So let me show you what I did&#8230;<span id="more-90"></span><br class="webkit-block-placeholder" />To resume, here is my path to security:</p>
<ul id="null">
<li>Changed default listen port (default is 22)</li>
<li>Only allow SSH protocol 2 (there are 2 versions of SSH, version 2 is far more secure)</li>
<li>Disabled root login</li>
<li>Allowed only some users to login</li>
<li>Disabled password login</li>
<li>Set up a private/public key method for authentication</li>
<li>Set a a firewall rule for those script kiddies who like to knock on my server doors</li>
</ul>
<p>These were the steps, and believe me, it&#8217;s not that big a deal to go through them. Let&#8217;s now describe each one!</p>
<p><img src="http://blog.dbugs.org/wp-content/uploads/2007/08/bullet1.png" alt="bullet1" /><span class="Apple-style-span" style="font-weight: bold">Default Listen Port<br />
</span>By default, the <a class="zem_slink" title="OpenSSH" rel="homepage" href="http://www.openssh.com">Open SSH</a> server comes with listen <a class="zem_slink" title="TCP and UDP port" rel="wikipedia" href="http://en.wikipedia.org/wiki/TCP_and_UDP_port">TCP port</a> set to 22. Not trying to make <a class="zem_slink" title="Security through obscurity" rel="wikipedia" href="http://en.wikipedia.org/wiki/Security_through_obscurity">security by obscurity</a>, if you change this default behavior, at least those script kiddies, who scan your port 22, and hammer you with the defaults logins, will be dropped, and your bandwidth will be spared. So head to <em>/etc/ssh</em> (the default directory, most distros) and edit your <strong><em>sshd_confing.</em></strong> On the line: &#8220;<a class="zem_slink" title="Secure Shell" rel="wikipedia" href="http://en.wikipedia.org/wiki/Secure_Shell">Port 22</a>&#8220;, change this to something else, higher than 1024, because usually port scanners don&#8217;t go higher than this by default; for example, use port 2222. When connecting to you server, don&#8217;t forget to specify the port number (in the command line this goes by ssh -p 2222 hostname).</p>
<p><img src="http://blog.dbugs.org/wp-content/uploads/2007/08/bullet1.png" alt="bullet1" /><strong>SSH protocol 2</strong><br />
In the present, there are 2 versions of SSH <a title="SSH protocols differences" href="http://www.snailbook.com/faq/ssh-1-vs-2.auto.html">protocol</a>. It&#8217;s better to go with the latest, since it&#8217;s far more secure. So, in the same file you made your port changes, the line which contains the word &#8220;<span class="Apple-style-span" style="font-style: italic">Protocol</span>&#8220;, put a lonely &#8220;<span class="Apple-style-span" style="font-style: italic">2</span>&#8221; (probably there is already one there, or 2,1) in front. Save your changes.</p>
<p><img src="http://blog.dbugs.org/wp-content/uploads/2007/08/bullet1.png" alt="bullet1" /><strong>Disable root login<br />
</strong>Normally for administration purposes, we use the <a class="zem_slink" title="Superuser" rel="wikipedia" href="http://en.wikipedia.org/wiki/Superuser">super user</a> (root), but it&#8217;s not safe to remote login with this user. If something gets compromised, the attacker will have full power to change anything in your system. So, force logins with other user than the root, and then when you are <a class="zem_slink" title="Logging (computer security)" rel="wikipedia" href="http://en.wikipedia.org/wiki/Logging_%28computer_security%29">logged in</a>, su to become root. Believe me, it&#8217;s safer this way. So in the same file, when it says &#8220;<em>PermitRootLogin</em>&#8220;, put a &#8220;<em>no</em>&#8221; in front. Thats it!</p>
<p><img src="http://blog.dbugs.org/wp-content/uploads/2007/08/bullet1.png" alt="bullet1" /><strong>Allow only some users to login</strong><br />
Ok, you now have disabled root login, but any <a class="zem_slink" title="User (computing)" rel="wikipedia" href="http://en.wikipedia.org/wiki/User_%28computing%29">user account</a> on your system will be authorized to remote login. This brings a lot of issues, because more users, means more distributed logins, more chances to security issues (imagine one of your users being kidnapped by a alien, you never know). So authorize one user (you), and if needed, other users, but only if needed. I hope you never left <strong><em>sshd_config</em></strong>, because now we have to search for the line &#8220;AllowUsers&#8221;. If this line doesn&#8217;t exist, add it, in the &#8220;<em>#Authentication</em>&#8221; part of the file, and specify the users you want to allow login. Example: &#8220;<em>AllowUsers user1 user2</em>&#8220;. Easy right? Let&#8217;s continue.</p>
<p><img src="http://blog.dbugs.org/wp-content/uploads/2007/08/bullet1.png" alt="bullet1" /><strong>Password logins</strong><br />
By default, you authenticate in your remote host, by using a combination of user/password. Passwords, by it&#8217;s nature are unsafe, so why use them? Next we will set up a digital key authentication, so disable passwords for now. In the same configuration file, change &#8220;PasswordAuthentication yes&#8221; to &#8220;PasswordAuthentication no&#8221;. And we are done regarding passwords.</p>
<p><img src="http://blog.dbugs.org/wp-content/uploads/2007/08/bullet1.png" alt="bullet1" /><strong>Private/Public key authentication (using DSA)</strong><br />
In the past I <a title="ssh authentication using keys" href="http://blog.dbugs.org/2007/06/17/ssh-keys-authentication/">explained</a> this (link to previous post). You can use a combination of private/public key to authenticate yourself in a remote host, so use this. Go through that post, and set everything up. Its just a matter of following the steps: <strong>(1)</strong><em>ssh-keygen -t dsa</em>; <strong>(2)</strong><em>cat ~/.ssh/id_dsa.pub</em> <strong>(3)</strong>put the output of step <strong>(2)</strong> in remote ~/.ssh/authorized_keys (chmodded to 600). After making this, edit the lines inside <em><strong>sshd_config</strong></em>, &#8220;RSAAuthentication yes&#8221;, &#8220;PubkeyAuthentication yes&#8221; and &#8220;AuthorizedKeysFile %h/.ssh/authorized_keys&#8221;. And your done here.</p>
<p><img src="http://blog.dbugs.org/wp-content/uploads/2007/08/bullet1.png" alt="bullet1" /><strong>Firewall Rule<br />
</strong>Would it be great if your firewall detected if someone was knocking on your firewall door? Well, you can use a fully blown intrusion detection system, like Snort (link to snort), but by using simple rules in iptables, we can accomplish some security on the number of times someone tries to login. If you don&#8217;t know what iptables are, ignore this step, else, add this rules to your firewall (run this in the CLI or add it to your firewall scripts):</p>
<blockquote><p>iptables -A INPUT -i ${WAN} -p tcp &#8211;dport 2222 -m state &#8211;state NEW -m recent &#8211;set &#8211;name SSH</p></blockquote>
<blockquote><p>iptables -A INPUT -i ${WAN} -p tcp &#8211;dport 2222 -m state &#8211;state NEW -m recent &#8211;update &#8211;seconds 60 &#8211;hitcount 8 &#8211;rttl &#8211;name SSH -j DROP</p></blockquote>
<p>The <em>${WAN}</em> part of the rule, is the network interface you use to connect to your ssh server. I normally export LAN and WAN in a bash script, so I always know what is going where. In the future we will discuss firewall/iptables in detail, for those who do not know about the subject.This simple 2 rules will limit to 8, the number of ssh logins your host will permit in a minute. Thats a huge improvement (only 8 against unlimited attempts).And thats it! This were the steps I made to improve security on my remote host. Combined with a good firewall script, you will get a very tight system, believe me! There are other stuff you can make, like using TCP wrappers, but in my case, I login from a changing IP addres, and this method is not very useful if your IP address changes a lot.Oh, one last thing you can do! If all this methods fail, and someone is able to login using ssh to your server, edit again the <em>/etc/ssh/<strong>sshd_config</strong></em>, and in the line &#8220;<em>Banner</em>&#8221; add in front put &#8220;<em>/etc/sshbanner.txt</em>&#8220;. Now edit (create) the file <em>/etc/<strong>sshbanner.txt</strong></em> and put this inside (copy/paste):</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
WARNING! THIS IS A PRIVATE SSH SERVICE, NOT TO BE USED BY A STRANGER. IF YOU HAVE GAINED ILLICIT ACCESS ON THIS SYSTEM, A CURSE WILL BE SET UPON YOU, AND YOU WILL HAVE A SERIOUS RASH ON YOUR PRIVATE PARTS, AND SUFFER IN AGONIE! YOU HAVE BEEN WARNED!<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</p>
<p>Now, each time a user logs in, he will see this message. If it&#8217;s a unwanted user, he will be so scared, that he will log off immediately! =)</p>
<p>Please post back comments, on more things we can use to improve security on our servers!</p>
<p><strong>PS: Don&#8217;t forget, when all changes are made, to restart your ssh server (ex: <em>/etc/init.d/ssh restart</em>).</strong></p>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Zemified by Zemanta" href="http://reblog.zemanta.com/zemified/c61f8dfa-0d53-462f-a1d8-79c761e476f5/"><img class="zemanta-pixie-img" style="border: medium none; float: right;" src="http://img.zemanta.com/reblog_e.png?x-id=c61f8dfa-0d53-462f-a1d8-79c761e476f5" alt="Zemanta Pixie" /></a></div>
]]></content:encoded>
			<wfw:commentRss>http://blog.dbugs.org/2007/08/29/ssh-security/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Digital Backups Using GMail Storage &#8211; theory</title>
		<link>http://blog.dbugs.org/2007/08/13/backups-gmail-lvm-raid-linux/</link>
		<comments>http://blog.dbugs.org/2007/08/13/backups-gmail-lvm-raid-linux/#comments</comments>
		<pubDate>Mon, 13 Aug 2007 23:21:25 +0000</pubDate>
		<dc:creator>Marco Garcês</dc:creator>
				<category><![CDATA[backups]]></category>
		<category><![CDATA[dbugs]]></category>
		<category><![CDATA[gmail]]></category>
		<category><![CDATA[hacks]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[LVM]]></category>
		<category><![CDATA[theory]]></category>

		<guid isPermaLink="false">http://blog.dbugs.org/2007/08/13/digital-backups-using-gmail-storage-theory/</guid>
		<description><![CDATA[In the past few weeks, I have been dreaming with something that I know is not very practical to do or implement, but in fact, it could be a challenge and a fun thing to look into to. What I propose here in theory is to combine a series of tools, to create a rather [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://blog.dbugs.org/wp-content/uploads/2007/08/dbugs_post_logo1.png" alt="Digital Backups Using GMail Storage" title="Digital Backups Using GMail Storage" align="left" />In the past few weeks, I have been dreaming with something that I know is not very practical to do or implement, but in fact, it could be a challenge and a fun thing to look into to.<br />
What I propose here in theory is to combine a series of tools, to create a rather unique backup solution. What I suggest, is using tools like RAID, LVM, rsync with incremental backups&#8230; OK, you might be thinking: &#8220;but this is normal stuff&#8221;. Now let&#8217;s add the twist! Put these tools to work, using Gmail accounts, and you can begin imagining what I have in mind!<span id="more-79"></span></p>
<p>I came up with a name for this project, and the cool thing, is that I can use my domain as an acronym. So DBUGS stands for Digital Backup Using Gmail Storage.</p>
<p>So, what do I have in mind? Well, I came across some weeks ago, with Richard Jone s&#8217;s project, the <a href="http://richard.jones.name/google-hacks/gmail-filesystem/gmail-filesystem.html" title="gmailfs, currently v. 0.8.0">GmailFS</a>. This project, and using his words, provides a mountable Linux filesystem which uses your Gmail account as its storage medium. I read the entire site, and several other sites on the web, only to find out, that although this already can be achieved, some problems still need to be fixed, but since my project for now, exists only on paper, I hope that in the future, a more robust GmailFS, can be used.</p>
<p>What I propose here, is, to combine some cool open source technologies, to obtain a big, expandable online backup, but things like cost and reliability also come to my mind. Now it&#8217;s possible to create your own Gmail account for free, and all the tools I suggest using are open-source, so the cost factor, it&#8217;s only regarding your Internet connection, which by all means, must be broadband!</p>
<p>So, since it&#8217;s possible to mount GMail accounts locally, I started imagining the possibility, to use 2 accounts in a <a href="http://en.wikipedia.org/wiki/RAID#Standard_RAID_levels" title="Wiki on RAID"><strong>RAID1</strong></a> setup (mirror), where <em><strong>Gmail_account1 </strong></em>would be the mirror of <em><strong>Gmail_account2</strong></em>. This way, data would be backed up twice, in two different locations. If one dies, the other remains alive, while we add a new one to the array. When I say 2 accounts (arrays), I mean <em>n</em> arrays, since, for<strong> RAID1</strong> you can use <em>2+n</em> arrays, this way, data is mirrored against several locations.<br />
<img src="http://blog.dbugs.org/wp-content/uploads/2007/08/raid1.png" alt="RAID1" title="RAID1" align="absmiddle" /></p>
<p>The next step in my theory would be size. Google already offers almost 3GB of storage, and <a href="http://mashable.com/2007/08/09/gmail-going-huge-9000mb/" title="gmail going bigger?">rumors</a> are that they will increase this for 9GB+, but what about if you want more? My thoughts went straight to a <a href="http://en.wikipedia.org/wiki/Logical_Volume_Manager_%28Linux%29" title="Wiki on LVM"><strong>LVM</strong></a> setup, for the extra layer of complexity! Now we would have <em>2+n</em> arrays, each made by <strong>LVM</strong> volumes, which<br />
would be created using several (<em>1 + N</em>) accounts. Confused? I am! This way, each of the <strong>RAID1</strong> array would be stripped across different accounts, and in the future, if we wanted to expand the size of our online backup disk, it was just a matter of creating new accounts, and adding those to each of the <strong>LVM</strong>s, so our <strong>RAID1</strong> array would get bigger.<br />
<img src="http://blog.dbugs.org/wp-content/uploads/2007/08/lvm.png" alt="LVM" title="LVM" align="absmiddle" /></p>
<p>I also thought of security, and the best to do this, is using disk encryption. Another layer is added to the already tricky setup, but this is not important in the beginning, since for testing, I would not use sensitive data.</p>
<p>To perform the backups, I really think it’s a good idea to use some sort of <em>rsync+cp+mv</em> solution that performs incremental backups, without taking too much space. You can find many options for this online, but one my favorites is <a href="http://rsnapshot.org/" title="RSnapshot official site">RSnapshot</a>. A good source of information for this type of backup is Mike Rubel&#8217;s <a href="http://www.mikerubel.org/computers/rsync_snapshots/" title="Myke Rubel's rsync backups">site</a> on the subject.</p>
<p>And that’s it! Several problems must be addressed, and that&#8217;s why I started this post. I don&#8217;t know if it is either a very stupid idea, or if it can be accomplished and become a cool project. I’m working on some solutions, and I really hope I can post something on the subject anytime soon. Why should I even try this? Because I really think this is a cool idea, and perhaps I will not achieve what I intend, but in the process of failing, lies a path of learning&#8230; get it? =)</p>
<p>Please feel free to drop comments on this subject, with suggestions, critics or your help for the project. I&#8217;m more than happy to welcome you aboard. Let’s get this one off the paper, and make it work!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.dbugs.org/2007/08/13/backups-gmail-lvm-raid-linux/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>I am the key master!</title>
		<link>http://blog.dbugs.org/2007/06/17/ssh-keys-authentication/</link>
		<comments>http://blog.dbugs.org/2007/06/17/ssh-keys-authentication/#comments</comments>
		<pubDate>Sun, 17 Jun 2007 22:42:02 +0000</pubDate>
		<dc:creator>Marco Garcês</dc:creator>
				<category><![CDATA[CLI]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://blog.dbugs.org/2007/06/17/i-am-the-key-master/</guid>
		<description><![CDATA[Since I acquired a hosting plan, with the great Dreamhost team, I&#8217;ve been creating some websites, experimenting with stuff, login in, login out, via terminal ssh and also using CyberDuck sftp client for Mac. And, even though I use Linux for a while now, sometimes laziness takes his best, and it seems like my brain [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://blog.dbugs.org/wp-content/uploads/2007/06/key.png" title="icon_key" alt="icon_key" align="left" height="108" width="108" />Since I acquired a hosting plan, with the great <a href="http://www.dreamhost.com/" title="my host" target="_blank">Dreamhost</a> team, I&#8217;ve been creating some websites, experimenting with stuff, login in, login out, via terminal ssh and also using <a href="http://cyberduck.ch/" title="opensource sftp client for Mac" target="_blank">CyberDuck</a> sftp client for Mac. And, even though I use Linux for a while now, sometimes laziness takes his best, and it seems like my brain goes numb! Let me explain&#8230; Every time I login on my server space, I type a username (if I&#8217;m in the terminal this part is skipped, because local user is the same in the remote server, thereby no need to specify user) and a password. This is cool, if you do it one or two times a day, but if you keep doing this a lot, and have a bunch of servers (working in system administration can do this for you =] ) to login, you will get tired typing all this username/passwords all the time! Believe me&#8230; Not to mention the fact that a password scheme, is bad for your security! Why not remove all the need for passwords, and use digital security keys? They are like your <a href="http://en.wikipedia.org/wiki/Secure_Shell#How_SSH_uses_public-key_cryptography_.28with_analogy.29" target="_blank" title="analogy">normal keys</a>, but one keys does it all! <span id="more-65"></span></p>
<p>Here I will cover both the Mac and Linux, because, well, in fact they are almost the same, command line speaking I guess.</p>
<p>So, let&#8217;s skip the romantic part of the post, and let&#8217;s cut to the chase!  =)</p>
<p>First go to your favorite command line client, and create or own set of digital keys. It&#8217;s very simple, don&#8217;t worry, just type <strong><em>ssh-keygen -t dsa</em></strong> (this generates a digital key, using <a href="http://en.wikipedia.org/wiki/Digital_Signature_Algorithm" title="wiki entry for DSA" target="_blank">DSA</a> as security algorithm). It will prompt you the destination for the key, which normally resides inside folder <em>.ssh</em> at your <em>home</em> folder, and if you want to use a passphrase each time you use the keys (let&#8217;s keep it simple for now and say no). Now if you take a look inside <em>.ssh</em> folder, you will now see 2 files or more, but the important ones are <strong><em>id_dsa</em></strong> and <strong><em>id_dsa.pub</em></strong>. This is the pair of keys, one which is public, and the other you keep it for yourself.</p>
<p>Now if you look inside your <em><strong>id_dsa.pub</strong></em>, you will see a bunch of characters, which don&#8217;t mean anything to you. But copy everything to clipboard, for use in your remote server. My looks like this:</p>
<p><img src="http://blog.dbugs.org/wp-content/uploads/2007/06/picture-2.png" alt="cat id_dsa.pub" height="98" width="479" /></p>
<p align="center"><em>(this is all in a single line)</em><br />
<em><strong> </strong></em></p>
<p>There is no problem on showing my public key, because, well, it&#8217;s public. You can learn more why <a href="http://en.wikipedia.org/wiki/Secure_Shell#How_SSH_uses_public-key_cryptography_.28with_analogy.29" target="_blank">here</a>.</p>
<p>Now, login to your server, go to  directory <em>.ssh</em> on you <em>home</em> folder, and edit or create the file <strong><em>authorized_keys</em></strong>; paste your public key inside, all in one line! That&#8217;s it, your done. If you use Dreamhost I found out that both <em>.ssh</em> folder and <strong><em>authorized_keys</em></strong> file must have <strong><em>700</em></strong> permissions set.</p>
<p>Now logout, and login again, and the remote server will match your public key, with your local private key, and if everything goes smoothly, you are in! No passwords, no hassle, no nothing!<img src="http://blog.dbugs.org/wp-content/uploads/2007/06/picture-1.png" title="keys_cyberduck" alt="keys_cyberduck" align="right" height="132" width="362" /></p>
<p>It&#8217;s also possible to make your sftp client to use your keys, just define this in the login options, and check the &#8220;<em>Use public keys authentication</em>&#8221; or something similar, and choose your private key, not your public one. Next time you login, again, no passwords will be asked. Cool eyn?</p>
<p>I did not cover ssh inside Windows systems, but you can do the same using <a href="http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html" title="ssh client tools 4 Window$" target="_blank">Putty</a> and all the tools available. Go <a href="http://sourceforge.net/docs/F02/" target="_blank">here</a> to learn more about ssh authentication inside Windows, using Putty, but also for a more precise explanation on ssh authentication.</p>
<p>In the future it also should be important for you to set a passphrase with your keys, for extra security. But for now this is enough, so enjoy!<br />
Oh, by the way, in case you did not understand the romantic vs chase part of this post, take a look <a href="http://www.phrases.org.uk/meanings/107300.html" title="let's cut to the chase!" target="_blank">here</a>&#8230;</p>
<p><em><strong>Update</strong>: By the way, this post refers to Dreamhost, but you can use this with any server you wish, just make the same steps discribed. </em></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.dbugs.org/2007/06/17/ssh-keys-authentication/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Eyh!!! I own that!</title>
		<link>http://blog.dbugs.org/2007/03/17/changing-ownership-in-linux/</link>
		<comments>http://blog.dbugs.org/2007/03/17/changing-ownership-in-linux/#comments</comments>
		<pubDate>Sat, 17 Mar 2007 17:54:34 +0000</pubDate>
		<dc:creator>Marco Garcês</dc:creator>
				<category><![CDATA[CLI]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://blog.dbugs.org/2007/03/17/eyh-i-own-that/</guid>
		<description><![CDATA[Now that we know how to change object&#8217;s permissions, let&#8217;s take a look at how to change object&#8217;s ownerships. Like we have already learned, objects can have two types of ownerships: user ownership, and group ownership. We shall learn how to change both individually, and at the same time. Looks boring? Keep reading so I [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://blog.dbugs.org/wp-content/uploads/2007/03/users.png" title="users" alt="users" align="left" height="81" width="81" />Now that we know how to change object&#8217;s permissions, let&#8217;s take a look at how to change object&#8217;s ownerships. Like we have already learned, objects can have two types of ownerships: user ownership, and group ownership. We shall learn how to change both individually, and at the same time. Looks boring? Keep reading so I can change your opinion! (or not&#8230;)<br />
<span id="more-52"></span></p>
<p>The basic command to change ownership is <em><strong>chown</strong></em>. You use it, giving a general syntax example, by typing <em><strong>chown -option_flags user:group object</strong></em>. Between the user and group, you can use either a <em><strong>.</strong></em> or <strong><em>:</em></strong> (<em>user:group</em> or <em>user.group</em>, both are acceptable).</p>
<p>There are a few option flags you can use, read the <em><strong>man</strong></em> page for <em><strong>chown</strong></em> to learn them. I think the most important one is the<em><strong> -R</strong></em> (Recursively change ownership of directories and their contents), but this, I leave you to decide.</p>
<p><em><strong>Chown</strong></em> accepts different methods for setting permissions, and you can see that they are easy to remember:</p>
<ul>
<li><em><strong>owner</strong></em> &#8211; it only changes the object&#8217;s owner</li>
<li><em><strong>owner:</strong></em> &#8211; changes the owner, and, automatically changes the group to the login or primary group of the user</li>
<li><em><strong>owner:group</strong></em> &#8211; it changes both the group and the owner at the same time</li>
<li><em><strong>:group</strong></em> &#8211; it only changes the group, leaving alone the user ownership</li>
</ul>
<p>Now let&#8217;s go through a few examples&#8230;<br />
Imagine you are user <em>spider</em> and you have the primary group <em>users. </em>When you create a file, default permissions are set (-rw-r- -r- -) and the file gets <em>spider</em> ownership and group <em>users</em> ownership. If you want to give that file to someone outside the <em>users </em>group, it will be able to read it, but not modified it, because the world trio bit (the others) is only readable.<br />
Let&#8217;s say that the user you give the file to is <em>ladybug</em>, and her primary group is <em>ladybug. </em>You could use <em><strong>chown ladybug object1 </strong></em>and this will leave the file <span style="font-style: italic">object1</span>, with the ownership of <span style="font-style: italic">ladybug.</span><br />
Let&#8217;s say, both <span style="font-style: italic">spider </span>and <span style="font-style: italic">ladybug</span> belong to <span style="font-style: italic">dbugs</span> group. You could <em><strong>chmod 660 objec1</strong></em> (user and group = read and write), and then <em><strong>chown spider:dbugs object1</strong></em>, leaving the file with user ownership unchanged but the group ownership set to <em>dbugs. </em>Since <em>spider</em> and <em>ladybug</em> have secondary group <em>dbugs</em>, they both can read and change the contents for <em>object1</em>. Getting the big picture by now?</p>
<p>The <em><strong>chown</strong></em>  command, like I said can be used both in files and directories, and you can use it to change full directories and its contents. Just use the <em><strong>-R</strong></em> option, on a directory as target, and both the directory and everything inside it, will get the ownership you set. Example: <em><strong>chown -R spider:dbugs /pictures</strong></em>, will change directory <em><strong>pictures </strong></em>and everything inside to user <em>spider</em> and group <em>dbugs</em>.</p>
<p>That&#8217;s it! Practice a little, so you get the hang of it. Like everything in Linux, you will find it a lot easier with time and practice, to do things around the command line. Master these easy steps and you are in your way to proficiency! Have phun!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.dbugs.org/2007/03/17/changing-ownership-in-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>It&#8217;s so symbolic!</title>
		<link>http://blog.dbugs.org/2007/03/15/changing-permissions-in-linux/</link>
		<comments>http://blog.dbugs.org/2007/03/15/changing-permissions-in-linux/#comments</comments>
		<pubDate>Thu, 15 Mar 2007 23:14:55 +0000</pubDate>
		<dc:creator>Marco Garcês</dc:creator>
				<category><![CDATA[CLI]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://blog.dbugs.org/2007/03/15/51/</guid>
		<description><![CDATA[To change file permissions, you simply need to know the chmod command. Its simple to learn, and there are two different modes to use it: a symbolic mode and a numeric mode. By now you have some hints, on how to use a little of both, so now we get into detail. To change an [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://blog.dbugs.org/wp-content/uploads/2007/03/thetrios.png" title="permission trios (boring turorial table)" alt="permission trios (boring turorial table)" align="right" height="48" width="137" />To change file permissions, you simply need to know the <em><strong>chmod</strong></em> command. Its simple to learn, and there are two different modes to use it: a symbolic mode and a numeric mode. By now you have some hints, on how to use a little of both, so now we get into detail.<br />
<span id="more-51"></span>To change an object&#8217;s permissions, you either have to be the owner for that given object, or the superuser <em>root</em> (root can get way with anything, oh the mighty root). This means there is no way you can change files and directories permissions, even though it might be possible to view them!</p>
<p>Like I said, there are two modes to use the <em><strong>chmod</strong></em>  command:</p>
<ul>
<li><strong>NUMERIC</strong></li>
</ul>
<p>This one is the most common, and the one you will be using almost exclusively. There are differente ways to do some things, but sometimes you stick with the better one, right? Well, you decide&#8230;<br />
When using numeric mode, you simply do, for example, <em><strong>chmod 666 object1</strong></em>. This would, like you learned before, change the permission of the owner, the group and the rest of the world to read/write/not-execute (4=read/2=write/0=not-execute).</p>
<p>You can use combination of numbers to obtain what you intend. For example, its also possible to change permissions in a bunch o files, like you would do when copying, using wildcards or file extensions. You even can change permissions on everything inside a given directory, but not the directory itself; you can choose to follow child directories, affecting everything on the way. Now do you see why I keep saying CLI is the power?<br />
Like any Linux Command, you have some options flags you can add. Today I&#8217;ll just steal the man page for chmod and present you with that:</p>
<blockquote><p><strong>POSIX OPTIONS</strong><br />
-R     Recursively change permissions of directories and their contents.</p>
<p>&#8211;     Terminate option list.</p>
<p><strong>GNU OPTIONS</strong><br />
-c, &#8211;changes<br />
Verbosely describe the action for each file whose permissions actually changes.</p>
<p>-f, &#8211;silent, &#8211;quiet<br />
Do not print error messages about files whose permissions cannot be changed.</p>
<p>-v, &#8211;verbose<br />
Verbosely describe the action or non-action taken for every file.</p>
<p>-R, &#8211;recursive<br />
Recursively change permissions of directories and their contents.</p></blockquote>
<p>Not to many right? The other <em><strong>chmod</strong></em> mode is:</p>
<ul>
<li><strong>SYMBOLIC</strong></li>
</ul>
<p>In this mode, you pretty much do the same, that when you choose numeric mode, but some people find it more simple to use this one.<br />
In symbolic mode you use letters to identify the trio bits, which are: <em><strong>u</strong></em> = user, <em><strong>g</strong></em> = group, <em><strong>o</strong></em> = others and <strong><em>a</em></strong> = all. You also use in combination to letters, qualifiers, which are the <strong><em>+</em></strong>, <em><strong>- </strong></em>and <em><strong>=, </strong></em>and on the top of the cake you use the good old letters you know for permissions, <em><strong>r</strong></em>ead, <strong><em>w</em></strong>rite and e<em><strong>x</strong></em>ecute.<br />
A simple example is <em><strong>chmod u=rwx, g=r, o=r object1</strong></em>. This will change for object1 permissions for the owner user (read/write/execute), the owner group (read) and the rest of the world (read). Simple, and you could do it just for a specific permission trio, like <em><strong>chmod g=rw object1</strong></em>. Its also possible to set an object permission, without really knowing what permissions it already has. You just use the modifier <em><strong>+</strong></em> instead of the <em><strong>=</strong></em>, so you get <em><strong>chmod a+x object1</strong></em>, and this will add execute permission to everyone (a=all, remember). There is a small trick in this last example.. you can drop the <em><strong>a</strong></em> and just use the <em><strong>+x</strong></em>, like <em><strong>chmod +x object1 </strong></em>(since no group is specified, all are changed).<br />
One last modifier, the minus (<em><strong>-</strong></em>); this is the same with the plus modifier, except it takes, instead of giving&#8230; simple right?</p>
<p>Train this a little bit, and find out for yourself which mode is more comfortable to you. Keep in mind that this aims to be simple and effective, so keep training until you do it automatically (I&#8217;ll guess&#8230; a couple of minutes).<br />
Cya soon for the last part on  filesystem security.</p>
<p><strong>LINKS</strong>: <a href="http://www.die.net/doc/linux/man/man1/chmod.1.html" title="manual entry for chmod">man chmod</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.dbugs.org/2007/03/15/changing-permissions-in-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>You need permission for that Sir!</title>
		<link>http://blog.dbugs.org/2007/03/15/file-permissions-in-linux/</link>
		<comments>http://blog.dbugs.org/2007/03/15/file-permissions-in-linux/#comments</comments>
		<pubDate>Thu, 15 Mar 2007 02:02:58 +0000</pubDate>
		<dc:creator>Marco Garcês</dc:creator>
				<category><![CDATA[CLI]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://blog.dbugs.org/2007/03/15/you-need-permission-for-that-sir-part-1/</guid>
		<description><![CDATA[In the last articles, specially on the ls command one, you have seen examples of listing your files and directories. And if you paid attention, you noticed those weird characters right in the beginning of the line. Well, those funny guys are what is called the file/directory permissions, and are used to control access to [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://blog.dbugs.org/wp-content/uploads/2007/03/rwx.gif" title="read, write and execute!" alt="read, write and execute!" align="left" />In the last articles, specially on the <a href="http://blog.dbugs.org/2007/03/02/your-second-nature/" title="listing stuff in your filesytem">ls command</a> one, you have seen examples of listing your files and directories. And if you paid attention, you noticed those weird characters right in the beginning  of the line. Well, those funny guys are what is called the file/directory permissions, and are used to control access to all system resources in Linux. Did I get your attention? Good! Keep reading!<br />
<span id="more-45"></span>All files and directories have a set of 10 bits of information, that determine who owns what, who can access, who can change.. Resuming, by modifying these 10 bits of information, you have full control on resources!<br />
So, what are those R&#8217;s, W&#8217;s and X&#8217;s? What about the rest?</p>
<p style="text-align: center"><img src="http://blog.dbugs.org/wp-content/uploads/2007/03/listingpermissions.jpg" title="ls -la /example" alt="ls -la /example" width="490" /></p>
<p>Well the first bit, is the type bit the first of ten permission bits. It can be different, depending on the type of the object.</p>
<ul>
<li><strong> -</strong> = This is used for normal files</li>
<li><strong>d</strong>  = it&#8217;s used for directories</li>
<li><strong>l</strong> = used in symlinks (objects that point elsewhere, to other objects)</li>
<li><strong>b</strong>= used for special block devices files</li>
<li><strong>c</strong> = used for special character device.</li>
</ul>
<p>The next bits (nine actually) are what we call the three permissions trios. Each single trio, is composed by 3 bits, in which, depending on the values (0 or 1) are either set, or unset. Each trio corresponds to a specific &#8220;group&#8221;: the first permission bit, is the &#8220;<strong>user</strong>&#8221; trio, and affects the owner of the object, or, simply speaking, if the user owns the file, this is his affecting trio; the second trio, is the &#8220;<strong>group</strong>&#8221; one, and only affects the object&#8217;s group. If the the user does not own the object, his primary and secondaries groups are checked, and the &#8220;<strong>group</strong>&#8221; permission trio kicks in. For the last we have the &#8220;<strong>Others</strong>&#8221; trio bits, that affect everyone else that neither is the owner or belongs to a group that owns the object&#8230;. The rest of the world!</p>
<p>Like I said, depending if those trios are on or off (1 or 0) you will get the corresponding permissions. If you have 1 (ON) you get a letter, and if you get 0 (OFF) you get a -. When we talk of files, the first bit of the trio, corresponds to the READ permission, meaning if it let&#8217;s you view the files contents. The second bit, corresponds to the WRITE permission, and this decides if you can change that file&#8217;s contents, but also his permissions, ownership and everything else. The last, but not the least, corresponds to the EXECUTE bit, which need to be set ON, if you want for example run a script (in fact, scripts also need the READ bit).</p>
<p>And so on for the three separate trios, I think its simple!</p>
<p>In <a href="http://en.wikipedia.org/wiki/Binary_number" title="wiki entry for binary code">binary code</a>, 111 corresponds to the decimal number  7, because the first bit corresponds to the decimal number 4, the second to 2 and the third to 1. It&#8217;s important to know this small logic behind binary numbers, because we need to master this so we can set or modify permissions in files (later in a new article). So for example to set a read/write/not-execute permission, you will use the 6 decimal number (4+2+0). For just reading you use only the 4 (4+0+0). Simple right?</p>
<p style="text-align: center"><img src="http://blog.dbugs.org/wp-content/uploads/2007/03/thetrios.png" alt="permission trios (boring turorial table)" /></p>
<p>If you take one last look at the example above you will see extra stuff&#8230; Look at part where it says &#8220;<em><strong>mgarces mgarces</strong></em>&#8220;. This is the owner and the group for that object, correspondingly. In this case, since I&#8217;m user <em><strong>mgarces</strong></em>, if I try to access to <em>misc.txt</em>, only the first permission trio will be checked, because I&#8217;m the owner for that file. I have the read and the write permission, but not the execute one&#8230; Cool =)</p>
<p>Thats it! No more theory. Tomorrow I&#8217;ll promise we will get our hands dirty using permissions on our system. Understand this and you will not have any problems manipulating your files. Cya soon!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.dbugs.org/2007/03/15/file-permissions-in-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Security, call security!</title>
		<link>http://blog.dbugs.org/2007/03/11/users-and-groups-in-linux/</link>
		<comments>http://blog.dbugs.org/2007/03/11/users-and-groups-in-linux/#comments</comments>
		<pubDate>Sun, 11 Mar 2007 15:14:23 +0000</pubDate>
		<dc:creator>Marco Garcês</dc:creator>
				<category><![CDATA[CLI]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://blog.dbugs.org/2007/03/11/security-call-security/</guid>
		<description><![CDATA[You already heard that Linux is safe, and that there are no virus, no spyware&#8230; well, in fact, Linux has one small problem regarding security&#8230; YOU! Thats right, problem resides between the keyboard and the chair. So let&#8217;s start to look to you system in a safer way, learning how stuff works, and not making [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://blog.dbugs.org/wp-content/uploads/2007/03/alert.png" title="Security, call security!" alt="Security, call security!" align="left" />You already heard that Linux is safe, and that there are no virus, no spyware&#8230; well, in fact, Linux has one small problem regarding security&#8230; YOU! Thats right, problem resides between the keyboard and the chair. So let&#8217;s start to look to you system in a safer way, learning how stuff works, and not making mistakes in the future.<br />
<span id="more-40"></span></p>
<p>Has you probably found out, you need a combination of a user name and a password, to login to you system. Normal behavior is this security model, but there are distributions that automatically log you in. I believe this is not giving a damm about security, but that&#8217;s just me.<br />
When you create a new user, you are provided with a User ID (uid) and a Group ID (gid). This is what is used to control acess to files and directories, and also running processes. Every single file created in your system, is owned by a specific user, and associated with a certain group. The same goes for processes (running programs), each one of them is controlled by a user and a group, and only the user or users associated with the group, can control the system resources assigned to this process.</p>
<p><strong>USERS</strong><br />
Like I said before, each new user is assigned with a unique User ID (uid). You can check yours by typing <em><strong>id</strong></em> in the <em>cli. </em>It will output your <strong>uid</strong>, your <strong>gid</strong> and the groups that you belong to. Normally when you create a user, you are assigned also with a home directory (<em>/home/&lt;user&gt;</em>), and a program that is run when you login, most of the times this is the shell (ie<em>: /bin/bash</em>).<br />
Users own the files and directories that they create, and cannot read or access other users files/directories. If you want to take a look which users exist on your system, poke trough <em>/etc/passwd</em>; here you can see all the <strong>usernames</strong> and <strong>uid</strong> .<br />
Your home is right that, yours! You can create, destroy, move, copy&#8230; Whatever suits you! Organize it the way you want it, store everything you need. The only limitation to this is either disk space, or system quotas. In a safe Linux system, your user, besides his home, will share the <em>/tmp</em> directory with the rest of the world, and nothing else.You could sa, what about programs, aren&#8217;t this also shared? Yes, but later I&#8217;ll explain how this works.</p>
<p><strong>GROUPS</strong><br />
Following the same philosophy, groups in your system are assigned a unique Group ID (gid), ant these are stored inside a special file, the<em> /etc/group</em>. Each user is assigned with his own private group (the same name as the username), and normally this is their primary group. Users can belong to several groups, and normally these are secondary group affiliations. Now, you might be asking what are the primary and secondary groups? Primary group, defines the creation mode, so files and directories created by the user, will inherit the primary group affiliation. If you intend to create something with a different group mode, user the <em><strong>newgrp &lt;groupname&gt;</strong></em>. From now on, everything will have the group that was chosen, until you type <strong><em>exit</em></strong> or <em><strong>CTRL+D</strong></em> .</p>
<p>Thats it for now! The ability a user has, to use certain directories or access certain files, is determined by his <strong>permissions</strong> (that comes along with <strong>uid</strong> and <strong>gid</strong>). This will be discussed later, so stay tuned =)</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.dbugs.org/2007/03/11/users-and-groups-in-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 1.189 seconds -->

