<?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>iptables and more on Linux &#187; gnu/linux</title>
	<atom:link href="http://iptables.gen.tr/category/gnulinux/feed/" rel="self" type="application/rss+xml" />
	<link>http://iptables.gen.tr</link>
	<description>networking, tools in Linux and more...</description>
	<lastBuildDate>Wed, 16 Jun 2010 15:37:47 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>SSH timeout</title>
		<link>http://iptables.gen.tr/2010/05/ssh-timeout/</link>
		<comments>http://iptables.gen.tr/2010/05/ssh-timeout/#comments</comments>
		<pubDate>Tue, 04 May 2010 11:03:45 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[gnu/linux]]></category>

		<guid isPermaLink="false">http://iptables.gen.tr/?p=162</guid>
		<description><![CDATA[If you have a problem of frequent disconnection from your SSH server, you can enable the following setting in your sshd_config file and restart SSHD.



ClientAliveInterval 60



The exact description of what this does is



ClientAliveInterval
Sets a timeout interval in seconds after which if no data has
been received from the client, sshd will send a message through
the encrypted [...]]]></description>
			<content:encoded><![CDATA[<p>If you have a problem of frequent disconnection from your SSH server, you can enable the following setting in your sshd_config file and restart SSHD.</p>
<table style="background-color: #87cefa; width: 456px; height: 29px;" border="0">
<tbody>
<tr>
<td>ClientAliveInterval 60</td>
</tr>
</tbody>
</table>
<p>The exact description of what this does is</p>
<table style="background-color: #87cefa; width: 456px; height: 131px;" border="0">
<tbody>
<tr>
<td>ClientAliveInterval<br />
Sets a timeout interval in seconds after which if no data has<br />
been received from the client, sshd will send a message through<br />
the encrypted channel to request a response from the client.<br />
The default is 0, indicating that these messages will not be<br />
sent to the client.  This option applies to protocol version 2<br />
only.</td>
</tr>
</tbody>
</table>
<div id="_mcePaste" style="overflow: hidden; position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px;">
<div>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: &amp;quot;Trebuchet MS&amp;quot;,&amp;quot;sans-serif&amp;quot;;">SPBCHSW81</span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: &amp;quot;Trebuchet MS&amp;quot;,&amp;quot;sans-serif&amp;quot;;">SPBCHSW82</span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: &amp;quot;Trebuchet MS&amp;quot;,&amp;quot;sans-serif&amp;quot;;">SPBCHSW91</span></p>
</div>
<p><span style="font-size: 10pt; font-family: &amp;quot;Trebuchet MS&amp;quot;,&amp;quot;sans-serif&amp;quot;;">SPBCHSW92</span></div>
]]></content:encoded>
			<wfw:commentRss>http://iptables.gen.tr/2010/05/ssh-timeout/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Screen command</title>
		<link>http://iptables.gen.tr/2010/01/screen-command/</link>
		<comments>http://iptables.gen.tr/2010/01/screen-command/#comments</comments>
		<pubDate>Tue, 19 Jan 2010 21:53:09 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[gnu/linux]]></category>

		<guid isPermaLink="false">http://iptables.gen.tr/?p=135</guid>
		<description><![CDATA[I hadn&#8217;t used screen much in the past but I see that it is a very handy tool. I just would like to add some tips about screen command.



Ctrl-a c : creates a new screen shell
Ctrl-a TAB: switches focues between upper and lower split terminal
Ctrl-a &#8220; : Display a list of managed windows. (This is [...]]]></description>
			<content:encoded><![CDATA[<p>I hadn&#8217;t used screen much in the past but I see that it is a very handy tool. I just would like to add some tips about screen command.</p>
<table style="background-color: #87cefa; width: 459px; height: 24px;" border="0">
<tbody>
<tr>
<td><strong>Ctrl-a c </strong>: creates a new screen shell<br />
<strong>Ctrl-a TAB</strong>: switches focues between upper and lower split terminal<br />
<strong>Ctrl-a &#8220;</strong> : Display a list of managed windows. (This is the most I like:)</td>
</tr>
</tbody>
</table>
<p>It is very useful to use the option &#8220;-t&#8221; in screen as it allows you to mark your instances. If you run a new screen sheel with the command;</p>
<table style="background-color: #87cefa; width: 463px; height: 24px;" border="0">
<tbody>
<tr>
<td><strong>screen -t /var/log/local6 1 tail -f /var/log/local6</strong></td>
</tr>
</tbody>
</table>
<p>Then when you run <strong>Ctrl-a &#8220;</strong> to list the windows, you will recognize your tailing window with the title &#8220;/var/log/local6&#8243;</p>
<p>This is a very short article about screen. I hope on the way I use this tool, I may improve this it.</p>
]]></content:encoded>
			<wfw:commentRss>http://iptables.gen.tr/2010/01/screen-command/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>sysconfig.txt</title>
		<link>http://iptables.gen.tr/2010/01/sysconfig-txt/</link>
		<comments>http://iptables.gen.tr/2010/01/sysconfig-txt/#comments</comments>
		<pubDate>Sat, 09 Jan 2010 16:31:05 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[gnu/linux]]></category>

		<guid isPermaLink="false">http://iptables.gen.tr/?p=109</guid>
		<description><![CDATA[You can find quite a lot of files in /etc/sysconfig however in configuring them you may have trouble but there is a file that you can use to understand what attributes you can use for each file. It is sysconfig.txt. In my current Redhat 5.4 system the file is at the following location as it [...]]]></description>
			<content:encoded><![CDATA[<p>You can find quite a lot of files in /etc/sysconfig however in configuring them you may have trouble but there is a file that you can use to understand what attributes you can use for each file. It is sysconfig.txt. In my current Redhat 5.4 system the file is at the following location as it comes with the package initscripts.</p>
<table style="background-color: #87cefa; width: 371px; height: 24px;" border="0">
<tbody>
<tr>
<td><strong>/usr/share/doc/initscripts-8.45.30/sysconfig.txt</strong></td>
</tr>
</tbody>
</table>
<p>For example if you want to set ethernet options into your ifcfg-eth0 file below is the quote from this file;</p>
<table style="background-color: #87cefa; width: 485px; height: 24px;" border="0">
<tbody>
<tr>
<td><strong>ETHTOOL_OPTS</strong>=&#8230;<br />
Any device-specific options supported by ethtool. For example,<br />
if you wanted to force 100Mb full duplex:<br />
ETHTOOL_OPTS=&#8221;speed 100 duplex full autoneg off&#8221;<br />
Note that changing speed or duplex settings almost always<br />
requires disabling autonegotiation with &#8216;autoneg off&#8217;.</td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://iptables.gen.tr/2010/01/sysconfig-txt/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Installing RPM file into a different root</title>
		<link>http://iptables.gen.tr/2010/01/installing-rpm-file-into-a-different-root/</link>
		<comments>http://iptables.gen.tr/2010/01/installing-rpm-file-into-a-different-root/#comments</comments>
		<pubDate>Sat, 09 Jan 2010 14:59:03 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[gnu/linux]]></category>

		<guid isPermaLink="false">http://iptables.gen.tr/?p=101</guid>
		<description><![CDATA[One day you may have to install an RPM file into a different root folder. For example under rescue mode though you can chroot as an option. Here is the handy option for you to do it.



#rpm -ivh zip-2.31-2.el5.i386.rpm &#8211;root /mnt/sysimage



]]></description>
			<content:encoded><![CDATA[<p>One day you may have to install an RPM file into a different root folder. For example under rescue mode though you can chroot as an option. Here is the handy option for you to do it.</p>
<table style="background-color: #87cefa; width: 486px; height: 24px;" border="0">
<tbody>
<tr>
<td><strong>#rpm -ivh zip-2.31-2.el5.i386.rpm &#8211;root /mnt/sysimage</strong></td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://iptables.gen.tr/2010/01/installing-rpm-file-into-a-different-root/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MBR recovery and grub reinstall</title>
		<link>http://iptables.gen.tr/2010/01/mbr-recovery-and-grub-reinstall/</link>
		<comments>http://iptables.gen.tr/2010/01/mbr-recovery-and-grub-reinstall/#comments</comments>
		<pubDate>Sat, 09 Jan 2010 14:10:24 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[gnu/linux]]></category>
		<category><![CDATA[grub]]></category>

		<guid isPermaLink="false">http://iptables.gen.tr/?p=99</guid>
		<description><![CDATA[In the event that partition table is corrupted or boot loader has gone, here are some steps that you can take in order to boot the system as normal.
I hope that you have taken the backup of partition table previously with the command;



#sfdisk -d /dev/sda &#62; /root/sda_partition_table.out



Or if you also want to backup the whole [...]]]></description>
			<content:encoded><![CDATA[<p>In the event that partition table is corrupted or boot loader has gone, here are some steps that you can take in order to boot the system as normal.</p>
<p>I hope that you have taken the backup of partition table previously with the command;</p>
<table style="background-color: #87cefa; width: 422px; height: 24px;" border="0">
<tbody>
<tr>
<td>#<strong>sfdisk -d /dev/sda &gt; /root/sda_partition_table.out</strong></td>
</tr>
</tbody>
</table>
<p>Or if you also want to backup the whole MBR to a file do this;</p>
<table style="background-color: #87cefa; width: 423px; height: 24px;" border="0">
<tbody>
<tr>
<td><strong>#dd if=/dev/sda of=/tmp/mbr_sda.out bs=512 count=1</strong></td>
</tr>
</tbody>
</table>
<p>From now on, I assume that you have booted the system in rescue mode with networking support.</p>
<p>1) The first thing is to paste this partition table back into its original space. Presumably, you have copied the partition table from network and put it under /tmp/sda_partition_table.out</p>
<table style="background-color: #87cefa; width: 428px; height: 24px;" border="0">
<tbody>
<tr>
<td><strong>#sfdisk /dev/sda &lt;  /tmp/sda_partition_table.out</strong></td>
</tr>
</tbody>
</table>
<p>This will fix your partition table. Now time to fix MBR</p>
<p>2) As the MBR has gone, we have to write MBR again. Do the followings;</p>
<table style="background-color: #87cefa; width: 430px; height: 24px;" border="0">
<tbody>
<tr>
<td><strong>#grub</strong></p>
<p><strong>grub&gt; root (hd0,0)<br />
grub&gt;setup (hd0)<br />
grub&gt;quit</strong></td>
</tr>
</tbody>
</table>
<p>The root (hd0,0) command assumes that your boot partition is in /dev/sda1</p>
<p>After these commands, you should be able to boot your system as before.</p>
]]></content:encoded>
			<wfw:commentRss>http://iptables.gen.tr/2010/01/mbr-recovery-and-grub-reinstall/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>NIS &amp; Autofs configuration</title>
		<link>http://iptables.gen.tr/2010/01/nis-server-and-client-configuration/</link>
		<comments>http://iptables.gen.tr/2010/01/nis-server-and-client-configuration/#comments</comments>
		<pubDate>Sun, 03 Jan 2010 17:49:55 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[gnu/linux]]></category>
		<category><![CDATA[autofs]]></category>
		<category><![CDATA[nis]]></category>

		<guid isPermaLink="false">http://iptables.gen.tr/?p=40</guid>
		<description><![CDATA[This article is about to configure NIS server and NIS client in a redhat base distribution.  I know that NIS isn&#8217;t the preferred method of authentication anymore but I wanted to add this short NIS document along with autofs usage so that when any user logs in, their homedirectories at the remote NFS server will [...]]]></description>
			<content:encoded><![CDATA[<p>This article is about to configure NIS server and NIS client in a redhat base distribution.  I know that NIS isn&#8217;t the preferred method of authentication anymore but I wanted to add this short NIS document along with autofs usage so that when any user logs in, their homedirectories at the remote NFS server will be mounted automatically.</p>
<p>Lets start:</p>
<p><strong>Sample NIS domain:</strong> penguen.com<br />
<strong>NIS Server: </strong>rh54srv1.penguen.com<br />
<strong>NIS Server IP</strong>:  192.168.200.1<br />
<strong>NIS Client IP: </strong>192.168.200.81</p>
<p>**Don&#8217;t forget that this hostname to IP mapping must exist in /etc/hosts file.</p>
<p><strong>[SERVER SIDE CONFIGURATION]</strong></p>
<p>Install the packages required for NIS server</p>
<table style="background-color: #ffe4b5; width: 187px; height: 66px;" border="0">
<tbody>
<tr>
<td><strong>ypserv<br />
ypbind<br />
portmap<br />
yp-tools</strong></td>
</tr>
</tbody>
</table>
<p>Add the following line  into cat /etc/sysconfig/network</p>
<table style="background-color: #ffe4b5; width: 341px; height: 24px;" border="0">
<tbody>
<tr>
<td><strong>NISDOMAIN=&#8221;penguen.com&#8221;</strong></td>
</tr>
</tbody>
</table>
<p>Start the following daemons</p>
<table style="background-color: #ffe4b5; width: 342px; height: 24px;" border="0">
<tbody>
<tr>
<td><strong>service portmap start<br />
service ypserv start<br />
service yppasswdd start</strong></td>
</tr>
</tbody>
</table>
<p><span id="more-40"></span></p>
<p>Generate the NIS database by the following command. Command should detect your hostname and you should only press Control D.<br />
Once you Press and confirm the output, database will be generated.</p>
<table style="background-color: #ffe4b5; width: 515px; height: 24px;" border="0">
<tbody>
<tr>
<td>[root@rh54srv1 yp]# <strong>/usr/lib/yp/ypinit -m</strong></p>
<p>At this point, we have to construct a list of the hosts which will run NIS<br />
servers.  rh54srv1.penguen.com is in the list of NIS server hosts.  Please continue to add<br />
the names for the other hosts, one per line.  When you are done with the<br />
list, type a &lt;control D&gt;.<br />
next host to add:  rh54srv1.penguen.com<br />
next host to add:</td>
</tr>
</tbody>
</table>
<p>Now start two more services</p>
<table style="background-color: #ffe4b5; width: 273px; height: 24px;" border="0">
<tbody>
<tr>
<td><strong>service ypbind start<br />
service ypxfrd start</strong></td>
</tr>
</tbody>
</table>
<p>Make sure that deamons are running not to beat the air</p>
<table style="background-color: #ffe4b5; width: 496px; height: 24px;" border="0">
<tbody>
<tr>
<td>[root@rh54srv1 yp]# <strong>rpcinfo -p localhost</strong><br />
program vers proto   port<br />
100000    2   tcp    111  portmapper<br />
100000    2   udp    111  portmapper<br />
100024    1   udp    662  status<br />
100024    1   tcp    662  status<br />
100011    1   udp    875  rquotad<br />
100011    2   udp    875  rquotad<br />
100011    1   tcp    875  rquotad<br />
100011    2   tcp    875  rquotad<br />
100003    2   udp   2049  nfs<br />
100003    3   udp   2049  nfs<br />
100003    4   udp   2049  nfs<br />
100021    1   udp  32769  nlockmgr<br />
100021    3   udp  32769  nlockmgr<br />
100021    4   udp  32769  nlockmgr<br />
100021    1   tcp  32803  nlockmgr<br />
100021    3   tcp  32803  nlockmgr<br />
100021    4   tcp  32803  nlockmgr<br />
100003    2   tcp   2049  nfs<br />
100003    3   tcp   2049  nfs<br />
100003    4   tcp   2049  nfs<br />
100005    1   udp    892  mountd<br />
100005    1   tcp    892  mountd<br />
100005    2   udp    892  mountd<br />
100005    2   tcp    892  mountd<br />
100005    3   udp    892  mountd<br />
100005    3   tcp    892  mountd<br />
100004    2   udp    829  ypserv<br />
100004    1   udp    829  ypserv<br />
100004    2   tcp    832  ypserv<br />
100004    1   tcp    832  ypserv<br />
100009    1   udp    608  yppasswdd<br />
100007    2   udp    840  ypbind<br />
100007    1   udp    840  ypbind<br />
100007    2   tcp    843  ypbind<br />
100007    1   tcp    843  ypbind<br />
600100069    1   udp    855  fypxfrd<br />
600100069    1   tcp    857  fypxfrd</td>
</tr>
</tbody>
</table>
<p>Now our NIS server is ready, it is time to configure NIS clients.</p>
<p>NIS client configuration is easy, espacially with the handy tool &#8220;<strong>authconfig</strong>&#8221; in redhat. It is sufficent to type &#8220;<strong>man authconfig</strong>&#8221; to learn how you can use this tool to configure your nis client. Run the following command to activate authentication via your NIS server.</p>
<table style="background-color: #ffe4b5; width: 783px; height: 122px;" border="0">
<tbody>
<tr>
<td>[root@rh54-2 ~]# <strong>authconfig &#8211;enablenis &#8211;nisdomain penguen.com &#8211;nisserver rh54srv1.penguen.com &#8211;update</strong><br />
Stopping portmap: [  OK  ]<br />
Starting portmap: [  OK  ]<br />
Shutting down NIS services: [  OK  ]<br />
Turning on allow_ypbind SELinux boolean<br />
Binding to the NIS domain: [  OK  ]<br />
Listening for an NIS domain server..</td>
</tr>
</tbody>
</table>
<p>Everything is completed now. Lets test the setup. Login to the server and run the following;</p>
<table style="background-color: #ffe4b5; width: 672px; height: 24px;" border="0">
<tbody>
<tr>
<td>[root@rh54srv1 yp]# <strong>ypcat passwd</strong><br />
redhat:$1$CtsnSUU0S$qVtddcKXT8QWJlQoqsda0Gvs4.:502:502::/data:/bin/bash<br />
nisuser:$1$2issdfeFXfuv$HYXcVUiu0jsktNDKtXF2M.:505:505::/home/nisuser:/bin/bash<br />
nisuser1:!!:506:506::/home/nisuser1:/bin/bash<br />
accountant:!!:503:503::/home/accountant:/bin/bash<br />
nisuser2:!!:507:507::/home/nisuser2:/bin/bash</td>
</tr>
</tbody>
</table>
<p>You should see a similar output. If you don&#8217;t check your setup. Now lets add another username &#8220;nisuser100&#8243; ,  update the database<br />
and test this username in the client.</p>
<table style="background-color: #ffe4b5; width: 567px; height: 24px;" border="0">
<tbody>
<tr>
<td>[root@rh54srv1 ~]#<strong> useradd nisuser100</strong><br />
[root@rh54srv1 ~]# <strong>passwd nisuser100</strong><br />
Changing password for user nisuser100.<br />
New UNIX password:<br />
Retype new UNIX password:<br />
passwd: all authentication tokens updated successfully.<br />
[root@rh54srv1 ~]#<strong> cd /var/yp ; make</strong><br />
gmake[1]: Entering directory `/var/yp/penguen.com&#8217;<br />
Updating passwd.byname&#8230;<br />
Updating passwd.byuid&#8230;<br />
Updating group.byname&#8230;<br />
Updating group.bygid&#8230;<br />
Updating netid.byname&#8230;<br />
gmake[1]: Leaving directory `/var/yp/penguen.com&#8217;</td>
</tr>
</tbody>
</table>
<p>Now try to login with this username into the client that we previously configured as NIS client.</p>
<table style="background-color: #ffe4b5; width: 576px; height: 24px;" border="0">
<tbody>
<tr>
<td>[root@rh54srv1 yp]# <strong>ssh nisuser100@192.168.200.81</strong><br />
nisuser100@192.168.200.81&#8217;s password:<br />
Could not chdir to home directory /home/nisuser100: No such file or directory</td>
</tr>
</tbody>
</table>
<p>Just ignore the error message now. We haven&#8217;t configured autofs mounter yet, but we can see that our NIS setup<br />
works properly. Now configure NFS server for home exports.</p>
<p>Add the following line into our NFS server (rh54srv1) /etc/exportfs file.</p>
<table style="background-color: #ffe4b5; width: 434px; height: 24px;" border="0">
<tbody>
<tr>
<td>/home 192.168.200.0/255.255.255.0(rw)</td>
</tr>
</tbody>
</table>
<p>Now reexport all directories in NFS server and check the configuration;</p>
<table style="background-color: #ffe4b5; width: 452px; height: 24px;" border="0">
<tbody>
<tr>
<td>[root@rh54srv1 home]#<strong> exportfs -r</strong><br />
[root@rh54srv1 home]# <strong>showmount -e</strong><br />
Export list for rh54srv1.penguen.com:<br />
/home       192.168.200.0/255.255.255.0</td>
</tr>
</tbody>
</table>
<p>Server side NFS configuration is completed. Now login to NIS client and configure automounter.</p>
<p>Add the following line into /etc/auto.master file</p>
<table style="background-color: #ffe4b5; width: 458px; height: 24px;" border="0">
<tbody>
<tr>
<td>/home   /etc/auto.home</td>
</tr>
</tbody>
</table>
<p>Create the file /etc/auto.home and add the following line into it, so that when users login their home directories will be mapped.</p>
<table style="background-color: #ffe4b5; width: 462px; height: 24px;" border="0">
<tbody>
<tr>
<td><strong>*         192.168.200.1:/home/&amp;</strong></td>
</tr>
</tbody>
</table>
<p>Restart autofs deamon</p>
<table style="background-color: #ffe4b5; width: 462px; height: 24px;" border="0">
<tbody>
<tr>
<td>[root@rh54-2 /]# <strong>/etc/init.d/autofs restart</strong><br />
Stopping automount: [  OK  ]<br />
Starting automount: [  OK  ]</td>
</tr>
</tbody>
</table>
<p>To test automounting works properly, login into the client via ssh once again.</p>
<table style="background-color: #ffe4b5; width: 714px; height: 178px;" border="0">
<tbody>
<tr>
<td>[root@rh54srv1 home]# <strong>ssh nisuser100@192.168.200.81</strong><br />
nisuser100@192.168.200.81&#8217;s password:<br />
Last login: Sun Jan  3 07:28:58 2010 from rh54srv1.penguen.com<br />
[nisuser100@rh54-2 ~]$ <strong>df </strong><br />
Filesystem           1K-blocks      Used Available Use% Mounted on<br />
/dev/mapper/VolGroup00-LogVol00<br />
3203952   2098188    941932  70% /<br />
/dev/sda1               101086     17112     78755  18% /boot<br />
tmpfs                   265604         0    265604   0% /dev/shm<br />
<strong>192.168.200.1:/home/nisuser100 59514976  12735296  43707680  23% /home/nisuser100</strong></td>
</tr>
</tbody>
</table>
<p>As you can see we haven&#8217;t received any error message about &#8220;home directory not found&#8221; but instead /home/nisuser100 is automatically mounted on the NFS server.</p>
<p>I hope everything went right on your side too. Let me know if you see any issues on this short article.</p>
]]></content:encoded>
			<wfw:commentRss>http://iptables.gen.tr/2010/01/nis-server-and-client-configuration/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Software Raid</title>
		<link>http://iptables.gen.tr/2010/01/software-raid/</link>
		<comments>http://iptables.gen.tr/2010/01/software-raid/#comments</comments>
		<pubDate>Sun, 03 Jan 2010 12:58:27 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[gnu/linux]]></category>
		<category><![CDATA[software raid]]></category>

		<guid isPermaLink="false">http://iptables.gen.tr/?p=34</guid>
		<description><![CDATA[Software raid configuration is quite easy and within a few minutes you can start building your array. Depending on the size of the array, build time may vary. Here is a quick instruction about how you can use mdadm utility to create a raid 1 array.
We have two partitions of the size 512MB in two [...]]]></description>
			<content:encoded><![CDATA[<p>Software raid configuration is quite easy and within a few minutes you can start building your array. Depending on the size of the array, build time may vary. Here is a quick instruction about how you can use mdadm utility to create a raid 1 array.</p>
<p>We have two partitions of the size 512MB in two different disks:</p>
<p><strong>First Partition:</strong> /dev/sdb2<br />
<strong>Second Partition: </strong>/dev/sdc1<br />
<strong>Partition Types: </strong>fd (Linux raid auto detect)</p>
<p>As we are creating a raid paritition, using fdisk set both partition types to the code &#8220;<strong>fd</strong>&#8221; . Your output from fdisk will be something like below;</p>
<table style="border-color: #4b0082; border-width: 0px; background-color: #ffe4b5; width: 518px; height: 148px;" border="0">
<tbody>
<tr>
<td>[root@rh54-2 ~]# <strong>fdisk /dev/sdb -l</strong></p>
<p>Disk /dev/sdb: 1073 MB, 1073741824 bytes<br />
255 heads, 63 sectors/track, 130 cylinders<br />
Units = cylinders of 16065 * 512 = 8225280 bytes</p>
<p>Device Boot      Start         End      Blocks   Id  System<br />
/dev/sdb1               1          63      506016   83  Linux<br />
<strong>/dev/sdb2              64         130      538177+  fd  Linux raid autodetect</strong></td>
</tr>
</tbody>
</table>
<p><span id="more-34"></span></p>
<table style="background-color: #ffe4b5; width: 470px; height: 24px;" border="0">
<tbody>
<tr>
<td>[root@rh54-2 ~]#<strong> fdisk /dev/sdc -l</strong></p>
<p>Disk /dev/sdc: 1073 MB, 1073741824 bytes<br />
255 heads, 63 sectors/track, 130 cylinders<br />
Units = cylinders of 16065 * 512 = 8225280 bytes</p>
<p>Device Boot      Start         End      Blocks   Id  System<br />
<strong>/dev/sdc1               1          63      506016   fd  Linux raid autodetect</strong><br />
/dev/sdc2              64         130      538177+  fd  Linux raid autodetect</td>
</tr>
</tbody>
</table>
<p>Lets create our RAID1 array;</p>
<table style="background-color: #ffe4b5; width: 697px; height: 24px;" border="0">
<tbody>
<tr>
<td>[root@rh54-2 ~]# <strong>mdadm &#8211;create /dev/md1 &#8211;raid-devices=2 &#8211;level=1 /dev/sdb2 /dev/sdc1</strong></td>
</tr>
</tbody>
</table>
<p>Now check the raid array building;</p>
<table style="background-color: #ffe4b5; width: 441px; height: 24px;" border="0">
<tbody>
<tr>
<td>[root@rh54-2 ~]# <strong>cat /proc/mdstat </strong><br />
Personalities : [raid1]<br />
md1 : active raid1 sdc1[1] sdb2[0]<br />
505920 blocks [2/2] [UU]</td>
</tr>
</tbody>
</table>
<p>As you can see from the output of cat command, md1 raid device has been created with two active partitions (sdc1 and sdb2)</p>
<p>Now you can create the filesystem on /dev/md1 device and mount.</p>
<table style="background-color: #ffe4b5; width: 448px; height: 24px;" border="0">
<tbody>
<tr>
<td>[root@rh54-2 ~]# <strong>mkfs.ext3 /dev/md1</strong><br />
mke2fs 1.39 (29-May-2006)<br />
Filesystem label=<br />
OS type: Linux<br />
Block size=1024 (log=0)<br />
Fragment size=1024 (log=0)<br />
126480 inodes, 505920 blocks<br />
25296 blocks (5.00%) reserved for the super user<br />
First data block=1<br />
Maximum filesystem blocks=67633152<br />
62 block groups<br />
8192 blocks per group, 8192 fragments per group<br />
2040 inodes per group<br />
Superblock backups stored on blocks:<br />
8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409</p>
<p>Writing inode tables: done<br />
Creating journal (8192 blocks): done<br />
Writing superblocks and filesystem accounting information: done</p>
<p>This filesystem will be automatically checked every 21 mounts or<br />
180 days, whichever comes first.  Use tune2fs -c or -i to override.</td>
</tr>
</tbody>
</table>
<p>Finally mount the partition into a directory.</p>
<table style="background-color: #ffe4b5; width: 455px; height: 24px;" border="0">
<tbody>
<tr>
<td>[root@rh54-2 ~]# <strong>mkdir /raiddisk1</strong><br />
[root@rh54-2 ~]# <strong>mount /dev/md1 /raiddisk1/</strong><br />
[root@rh54-2 ~]#<strong> df -l</strong><br />
Filesystem           1K-blocks      Used Available Use% Mounted on<br />
/dev/mapper/VolGroup00-LogVol00<br />
3203952   2062572    977548  68% /<br />
/dev/sda1               101086     17112     78755  18% /boot<br />
tmpfs                   265604         0    265604   0% /dev/shm<br />
/dev/md1                489958     10544    454118   3% /raiddisk1</td>
</tr>
</tbody>
</table>
<p>In order to see the status of the array you can run the command for which you will see a similar output like below;</p>
<table style="background-color: #87cefa; width: 419px; height: 24px;" border="0">
<tbody>
<tr>
<td><strong>#mdadm &#8211;detail /dev/md1</strong></p>
<p>Number   Major   Minor   RaidDevice State<br />
0       8       17        0      active sync   /dev/sdb2<br />
1       8       33        1      active sync   /dev/sdc1</td>
</tr>
</tbody>
</table>
<p><strong>DISK FAILURE</strong></p>
<p>Now your array is working. Imagine that one of the disks (e.g /dev/sdc1) in the array has failed and we need<br />
replace the failed disk with another one (e.g /dev/sdd1) . Here is the process: First fail the disk (but this may not<br />
be necessary if it is in already failed state, you can try) , remove it and add /dev/sde1 device.</p>
<table style="background-color: #87cefa; width: 424px; height: 24px;" border="0">
<tbody>
<tr>
<td><strong>#mdadm /dev/md1 -f /dev/sdc1 -r /dev/sdc1 -a /dev/sdd1</strong></td>
</tr>
</tbody>
</table>
<p>After this command, rebuilding the array starts automatically.</p>
<p>The new situation is;</p>
<table style="background-color: #87cefa; width: 426px; height: 24px;" border="0">
<tbody>
<tr>
<td><strong>#mdadm &#8211;detail /dev/md1</strong></p>
<p>Number   Major   Minor   RaidDevice State<br />
0       8       17        0      active sync   /dev/sdb2<br />
1       8       49        1      active sync   /dev/sdd1</td>
</tr>
</tbody>
</table>
<p><strong>SPARE DISK</strong></p>
<p>What if you want to have a spare disk into this array. Normally spare disk can be added during initilization step with the<strong> switch &#8220;-x&#8221;</strong> , however<br />
in our configuration (raid1 with 2 disks) if you try to add a third disk, mdadm will automatically add it as a spare disk.</p>
<table style="background-color: #87cefa; width: 609px; height: 119px;" border="0">
<tbody>
<tr>
<td>#<strong>mdadm /dev/md1 -a /dev/sde1</strong><br />
#<strong>mdadm &#8211;detail /dev/md1 </strong></p>
<p>Number   Major   Minor   RaidDevice State<br />
0       8       17        0      active sync   /dev/sdb2<br />
1       8       49        1      active sync   /dev/sdd1</p>
<p><span style="color: #ff0000;"><strong>2       8       65        -      spare   /dev/sde1</strong></span></td>
</tr>
</tbody>
</table>
<p>You can also try failing /dev/sdd1 and you will see that /dev/sde1 will be automatically attached into the raid1 array and /dev/sdd1 will be marked as faulty.</p>
<p><strong>STOPPING THE ARRAY</strong></p>
<p>If you want to stop/disassemble the array, use the following;</p>
<table style="background-color: #87cefa; width: 507px; height: 24px;" border="0">
<tbody>
<tr>
<td><strong>#mdadm -S /dev/md1</strong></td>
</tr>
</tbody>
</table>
<p>Now you have a fully functional raid1 array. Congratulations!!</p>
]]></content:encoded>
			<wfw:commentRss>http://iptables.gen.tr/2010/01/software-raid/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Public key authentication in SSH</title>
		<link>http://iptables.gen.tr/2009/12/public-key-authentication-in-ssh/</link>
		<comments>http://iptables.gen.tr/2009/12/public-key-authentication-in-ssh/#comments</comments>
		<pubDate>Tue, 29 Dec 2009 20:18:15 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[gnu/linux]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://iptables.gen.tr/?p=14</guid>
		<description><![CDATA[I am sure most system administrators don&#8217;t want to waste their time by entering the same passwords everyday for every server. Here SSH utilities comes with lovely flavoured tools. In this article, I will try to explain how we can login to remote systems without using password at all or once in a day.
In this [...]]]></description>
			<content:encoded><![CDATA[<p>I am sure most system administrators don&#8217;t want to waste their time by entering the same passwords everyday for every server. Here SSH utilities comes with lovely flavoured tools. In this article, I will try to explain how we can login to remote systems without using password at all or once in a day.</p>
<p>In this example, here are the client and server data. Green color  is used for the text/command you should type.</p>
<p><strong>Client hostname: </strong> rh54-win-1<br />
<strong>Client username: </strong>sshtest<br />
<strong>Remote system IP:</strong> 192.168.200.1<br />
<strong>Remote system hostname: </strong>rh54srv1<br />
<strong>Remote username:</strong> root</p>
<h3><strong>1) Authenticating yourself by public key instead of password into remote systems</strong></h3>
<p><strong>a)</strong> <strong>First create private and public keys. When the passphrase is asked leave it empty.</strong></p>
<p>[sshtest@rh54-win-1 ~]$<strong> <span style="color: #008000;">ssh-keygen -t rsa</span></strong><br />
<em>Generating public/private rsa key pair.<br />
Enter file in which to save the key (/home/sshtest/.ssh/id_rsa):<br />
Enter passphrase (empty for no passphrase):<br />
Enter same passphrase again:<br />
Your identification has been saved in /home/sshtest/.ssh/id_rsa.<br />
Your public key has been saved in /home/sshtest/.ssh/id_rsa.pub.<br />
The key fingerprint is:<br />
a3:6f:be:7f:0c:c5:32:61:dc:d6:e1:2c:57:df:9a:a2 sshtest@rh54-win-1.penguen.com</em></p>
<p>Now our keys are saved under <strong>/home/sshtest/.ssh</strong> folder in the client we work.</p>
<p><span id="more-14"></span></p>
<p><strong>b) It is time to copy our public key into the remote system</strong><br />
[sshtest@rh54-win-1 ~]$ <strong><span style="color: #008000;">ssh-copy-id -i /home/sshtest/.ssh/id_rsa.pub root@192.168.200.1</span></strong><br />
<em>29<br />
root@192.168.200.1&#8217;s password:<br />
Now try logging into the machine, with &#8220;ssh &#8216;root@192.168.200.1&#8242;&#8221;, and check in:</em></p>
<p><em>.ssh/authorized_keys</em></p>
<p><em>to make sure we haven&#8217;t added extra keys that you weren&#8217;t expecting.</em></p>
<p>We have copied our key successfully.</p>
<p><strong>c) Now try to login to the system again</strong></p>
<p>[sshtest@rh54-win-1 ~]$ <span style="color: #008000;"><strong>ssh root@192.168.200.1</strong></span><br />
Last login: Tue Dec 29 20:37:59 2009 from 192.168.200.50<br />
[root@rh54srv1 ~]#</p>
<p>It is nice right:)</p>
<h3>2) Using passphrase in authentication</h3>
<p>If you had provided a passphrase during the key creation in the step 1.a, then you would have had to enter the passphrase in each connection setup but what is the point if we have to enter a passphrase each time we initiate the connection.  If we put the security point of view aside, I will try to explain how we can avoid entering passphrase everytime but once for the session. For instance once at the beginning of the day and you won&#8217;t have to type it again and again. Here it is;</p>
<p><strong>1) Create public and private key but this time type a passphrase.</strong></p>
<p>[sshtest@rh54-win-1 ~]$ <span style="color: #008000;"><strong>ssh-keygen -t rsa</strong></span><br />
Generating public/private rsa key pair.<br />
Enter file in which to save the key (/home/sshtest/.ssh/id_rsa):<br />
Enter passphrase (empty for no passphrase): <span style="color: #008000;"> <strong>testphrase</strong></span><br />
Enter same passphrase again: <span style="color: #008000;"><strong>testphrase</strong></span><br />
Your identification has been saved in /home/sshtest/.ssh/id_rsa.<br />
Your public key has been saved in /home/sshtest/.ssh/id_rsa.pub.<br />
The key fingerprint is:<br />
b1:b1:68:45:8e:31:fb:98:7f:b9:21:c7:2c:73:ce:9b sshtest@rh54-win-1.penguen.com</p>
<p><strong>2)Copy the key into the remote system</strong><br />
[sshtest@rh54-win-1 ~]$<span style="color: #008000;"> <strong>ssh-copy-id -i /home/sshtest/.ssh/id_rsa.pub root@192.168.200.1</strong></span><br />
<em>29<br />
root@192.168.200.1&#8217;s password:<br />
Now try logging into the machine, with &#8220;ssh &#8216;root@192.168.200.1&#8242;&#8221;, and check in:</em></p>
<p><em>.ssh/authorized_keys</em></p>
<p><em>to make sure we haven&#8217;t added extra keys that you weren&#8217;t expecting.</em></p>
<p>From now on if you try to login to the root account on the remote system 192.168.200.1 you will be presented by a passphrase. To avoid this, continue reading.</p>
<p><strong>3) Run the ssh-agent program which will respond on behalf of us.<br />
</strong></p>
<p>[sshtest@rh54-win-1 ~]$<span style="color: #008000;"> <strong>ssh-agent /bin/bash</strong></span><br />
[sshtest@rh54-win-1 ~]$ <span style="color: #008000;"><strong>env | grep SSH</strong></span><br />
SSH_AGENT_PID=3381<br />
SSH_AUTH_SOCK=/tmp/ssh-Bixnyz3380/agent.3380<br />
SSH_ASKPASS=/usr/libexec/openssh/gnome-ssh-askpass</p>
<p>We can see from the output of the second command such that ssh-agent sets some environmental variables. That is good:)</p>
<p><strong>4) Now let&#8217;s use ssh-add to provide ssh-agent with your key.</strong></p>
<p>[sshtest@rh54-win-1 ~]$ <span style="color: #008000;"><strong>ssh-add </strong></span><br />
Enter passphrase for /home/sshtest/.ssh/id_rsa:  <span style="color: #008000;"><strong>testphrase</strong></span><br />
Identity added: /home/sshtest/.ssh/id_rsa (/home/sshtest/.ssh/id_rsa)</p>
<p><strong>5) Now try to login again</strong></p>
<p>[sshtest@rh54-win-1 ~]$<span style="color: #008000;"><strong> ssh root@192.168.200.1</strong></span><br />
Last login: Tue Dec 29 21:13:55 2009 from 192.168.200.50<br />
[root@rh54srv1 ~]#</p>
<p>As you can see, nothing has been asked. However, if you leave the current shell in which you have executed ssh-agent, ssh-agent will die and you will have to enter passphrase again. SSH-AGENT is very handy for administrators who have terminals active during the day  and connect into various servers.</p>
<p>I hope this article was useful for a quick intro authentication in SSH. If you want to have more info on the subject not a tutorial style but mainly about concepts you can have a look at <strong><a href="http://unixwiz.net/techtips/ssh-agent-forwarding.html" target="_blank">http://unixwiz.net/techtips/ssh-agent-forwarding.html</a></strong></p>
]]></content:encoded>
			<wfw:commentRss>http://iptables.gen.tr/2009/12/public-key-authentication-in-ssh/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
