<?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>Technical Diary &#187; Linux</title>
	<atom:link href="http://andriigrytsenko.net/category/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://andriigrytsenko.net</link>
	<description>With Andrii Grytsenko</description>
	<lastBuildDate>Wed, 28 Jul 2010 09:02:46 +0000</lastBuildDate>
	
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Software RAID level 1 behavior</title>
		<link>http://andriigrytsenko.net/2010/07/software-raid-level-1-behavior/</link>
		<comments>http://andriigrytsenko.net/2010/07/software-raid-level-1-behavior/#comments</comments>
		<pubDate>Tue, 27 Jul 2010 17:47:57 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[fs]]></category>
		<category><![CDATA[mdadm]]></category>
		<category><![CDATA[raid]]></category>

		<guid isPermaLink="false">http://andriigrytsenko.net/?p=827</guid>
		<description><![CDATA[Here I will try to describe behavior of SW RAID level 1 in case of crash.

There will be two scenario:

 Delete partition by fdisk and restart the computer.
 Delete and create empty partition by fdisk and restart the computer.
 Delete whole storage device from the system and restart computer.
 Delete and create whole storage device [...]]]></description>
			<content:encoded><![CDATA[<p>Here I will try to describe behavior of SW RAID level 1 in case of crash.<br />
<span id="more-827"></span></p>
<p>There will be two scenario:</p>
<ol>
<li> Delete partition by <strong>fdisk</strong> and restart the computer.</li>
<li> Delete and create empty partition by <strong>fdisk</strong> and restart the computer.</li>
<li> Delete whole storage device from the system and restart computer.</li>
<li> Delete and create whole storage device from the system and restart computer.</li>
</ol>
<h3 style="text-align: center;"><strong>1.  Delete partition by fdisk and restart the computer.</strong></h3>
<p>First, I gotta create the <em>raid</em> device:</p>
<pre>[root@node1 ~]# mdadm -C /dev/md0 -n 2 -l 1 /dev/hdd1 /dev/hdb8
mdadm: largest drive (/dev/hdb8) exceed size (476160K) by more than 1%
Continue creating array? y
mdadm: array /dev/md0 started.</pre>
<p>and build <strong>ext3</strong> file system on the device:</p>
<pre>[root@node1 ~]# mke2fs -j /dev/md0</pre>
<p>Edit <em>/etc/fstab</em> according to the changes:</p>
<pre>/dev/md0                /test                   ext3    defaults        0 0</pre>
<p>and mount everything is contained at <strong>/etc/fstab</strong>:</p>
<pre>[root@node1 ~]#mount -a</pre>
<p>Copy some files to <strong>/test</strong>(to be able to check files integrity in the future):</p>
<pre>[root@node1 ~]# cp -rfv /var/* /test/</pre>
<p>Now, delete <strong>/dev/hdd1</strong> through <strong>fdisk</strong>:</p>
<pre>[root@node1 ~]# fdisk  /dev/hdd

The number of cylinders for this disk is set to 8322.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): d
Selected partition 1

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.</pre>
<p>and restart computer:</p>
<pre>[root@node1 ~]# reboot</pre>
<p>During the system booting I got next error(the same I got when try to manually mount <strong>md0</strong>):</p>
<pre>mount: wrong fs type, bad option, bad superblock on /dev/md0,
       missing codepage or other error
       (could this be the IDE device where you in fact use
       ide-scsi so that sr0 or sda or so is needed?)
       In some cases useful info is found in syslog - try
       dmesg | tail  or so</pre>
<p><strong>/proc/mdstat</strong> doesn&#8217;t see any  local raid devices:</p>
<pre>[root@node1 ~]# cat /proc/mdstat
Personalities :
unused devices:</pre>
<p>Let&#8217;s create new <strong>mdadm.conf</strong> :</p>
<pre>[root@node1 ~]#  mdadm --examine --scan  /dev/hdb8 &gt; /etc/mdadm.conf

[root@node1 ~]# cat /etc/mdadm.conf
ARRAY /dev/md0 level=raid1 num-devices=2 UUID=c1ce0c10:035aa2a3:829450b6:84b7a236</pre>
<p>And active everything from mdadm.conf:</p>
<pre>[root@node1 ~]#  mdadm -A -s
mdadm: /dev/md0 has been started with 1 drive (out of 2).</pre>
<p>The <strong>md0</strong> was activated, but only with one disk:</p>
<pre>[root@node1 ~]# cat /proc/mdstat
Personalities : [raid1]
md0 : active raid1 hdb8[1]
      476160 blocks [2/1] [_U]</pre>
<p><strong>Conclusion:</strong> If it was a root partition your system wouldn&#8217;t boot at all. And you would have to dance with boot disk to make you system alive.</p>
<h3 style="text-align: center;"><strong>2. Delete and create empty partition by fdisk and restart the computer.</strong></h3>
<p>The same actions as above and additional create partition <strong>/dev/hdd1</strong> in <strong>fdisk</strong>.<br />
After system booted. None of raid&#8217;s are active :</p>
<p></strong></p>
<pre>[root@node1 ~]# cat /proc/mdstat
Personalities :
unused devices:</pre>
<p>But after restore procedure system is going to work in full-fledged mode(with 2 disks):</p>
<pre>[root@node1 ~]#  mdadm --examine --scan  /dev/hdb8 &gt; /etc/mdadm.conf
[root@node1 ~]# mdadm -A -s
mdadm: /dev/md0 has been started with 2 drives.
[root@node1 ~]# cat /proc/mdstat
Personalities : [raid1]
md0 : active raid1 hdd1[0] hdb8[1]
475136 blocks [2/2] [UU]</pre>
<p>The new device has no influence on system behavior at all. Result is similar to previous one.</p>
<h3 style="text-align: center;"><strong>3. Delete whole storage device from the system and restart computer.</strong></h3>
<p>During this test the <strong>md0</strong> was restored and mounted during system boot without any problem or delays. Also next notice message were generated and put into the syslog facility <strong>kernel</strong>:</p>
<pre>kernel: raid1: raid set md0 active with 1 out of 2 mirrors</pre>
<h3 style="text-align: center;"><strong>4. Delete and create whole storage device from the system and restart computer.</h3>
<p></strong><br />
During boot raid wasn&#8217;t rebuilt by itself: </p>
<pre>
[root@node1 ~]# cat /proc/mdstat
Personalities : [raid1]
md0 : active raid1 hdb8[1]
      475136 blocks [2/1] [_U]
</pre>
<p>And has to be re-built manually :</p>
<pre>
[root@node1 ~]# mdadm -a /dev/md0 /dev/hdd1
mdadm: re-added /dev/hdd1
</pre>
<p>Still recovering :) : </p>
<pre>
[root@node1 ~]# cat /proc/mdstat
Personalities : [raid1]
md0 : active raid1 hdd1[0] hdb8[1]
      475136 blocks [2/1] [_U]
      [====>................]  recovery = 21.5% (103296/475136) finish=0.4min speed=12912K/sec
</pre>
<p><strong>NOTE: partition type for new partition should be set to &#8216;Linux raid autodetect&#8217; (FD in a hex code). Frankly speaking I didn&#8217;t test whether it works without that, that&#8217;s why it may be or may _not_ useless procedure. My advice is: just do it! </strong></p>
<pre>
[root@node1 ~]# fdisk -l /dev/hdd

Disk /dev/hdd: 4294 MB, 4294967296 bytes
16 heads, 63 sectors/track, 8322 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/hdd1               1         943      475240+  fd  Linux raid autodetect
</pre>
<h3><strong>P.S. System information:</strong></h3>
<p>Tests were performed at virtual machine:<br />
<strong>virtualbox-2.1.4<br />
virtualbox-ose-guest-modules-2.6.26-1-686</strong><br />
Software installed inside VM:<br />
<strong>CentOS(kernel-2.6.18-128.el5)<br />
mdadm-2.6.9-2.el5</strong></p>
<p></strong></p>
]]></content:encoded>
			<wfw:commentRss>http://andriigrytsenko.net/2010/07/software-raid-level-1-behavior/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Trick: DOC to PDF on Linux</title>
		<link>http://andriigrytsenko.net/2010/07/trick-doc-to-pdf-on-linux/</link>
		<comments>http://andriigrytsenko.net/2010/07/trick-doc-to-pdf-on-linux/#comments</comments>
		<pubDate>Fri, 16 Jul 2010 12:07:39 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://andriigrytsenko.net/?p=814</guid>
		<description><![CDATA[Here is little trick how to convert *.doc files into the *.pdf on Linux.

PRE-REQUIREMENTS: 
oowriter has to be already installed. It is provided by Open Office system(for Debian its openoffice.org-writer package).
Unfortunately, I can&#8217;t remember the source where this macros is came from. Anyway here my script:
#!/bin/bash
# Written by Andrii Grytsenko
# pp: AndriiGrytsenko.net

if [ $# -lt [...]]]></description>
			<content:encoded><![CDATA[<p>Here is little trick how to convert *.doc files into the *.pdf on Linux.</p>
<p><span id="more-814"></span></p>
<p><span style="color: #ff0000;">PRE-REQUIREMENTS: </p>
<p><strong>oowriter</strong> has to be already installed. It is provided by Open Office system(for Debian its <strong>openoffice.org-writer</strong> package).</span></p>
<p>Unfortunately, I can&#8217;t remember the source where this macros is came from. Anyway here my script:</p>
<pre>#!/bin/bash
# Written by Andrii Grytsenko
# pp: AndriiGrytsenko.net

if [ $# -lt 1 ]; then
    echo "Example: pdf2doc [doc_file] [output_dir]"
    echo "in case output_dir is missing generate into current dir"
fi

DOCDIR=$(dirname $1)
DOCFILE=$(basename $1)
PDFFILE=$(echo $DOCFILE | sed -e 's/\.doc$/\.pdf/g')
CURRENT_DIR=$(pwd)
OUT_DIR=$2

# if output_dir is missing set current
if [ -z $OUT_DIR ]; then
    OUT_DIR=$CURRENT_DIR
fi

if  echo $DOCDIR | grep -E "^\.$" &gt; /dev/null; then
        DOCDIR=$CURRENT_DIR
elif ! echo $DOCDIR | grep -E "^/" &gt; /dev/null; then
        DOCDIR=$CURRENT_DIR/$DOCDIR
fi

cd $DOCDIR
/usr/bin/oowriter -invisible "macro:///Standard.Module1.ConvertWordToPDF($DOCDIR/$DOCFILE)"
sleep 2 # for big files generation can take more time
mv $PDFFILE $OUT_DIR/
cd $CURRENT_DIR</pre>
<p>Put file into the catalog from PATH env variable, into the /usr/bin for example. And call doc2pdf.</p>
<p>To generate question.pdf from question.doc and put it into the /tmp, run this:</p>
<pre>doc2pdf ~/tmp2/questions.doc /tmp/</pre>
<p><span style="color: #ff0000;"><strong>PROFIT:</strong></span><span style="color: #ff0000;"><strong> </strong></span></p>
<pre>andrii@agrytsenko:~$ ls -l /tmp/questions.pdf
-rw-r--r-- 1 andrii vboxusers 53226 Jul 16 14:17 /tmp/questions.pdf</pre>
]]></content:encoded>
			<wfw:commentRss>http://andriigrytsenko.net/2010/07/trick-doc-to-pdf-on-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Get system temperature in Linux</title>
		<link>http://andriigrytsenko.net/2010/01/get-system-temperature-in-linux/</link>
		<comments>http://andriigrytsenko.net/2010/01/get-system-temperature-in-linux/#comments</comments>
		<pubDate>Sun, 24 Jan 2010 13:17:15 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://andriigrytsenko.net/?p=624</guid>
		<description><![CDATA[How to get online temperature status on your linux box.

There is one good package which allow you to control and check your computer temperature in online mode. To install  For debian:
apt-get install lm-sensors
for CentOS or RH:
yum install lm-sensors
Next software should discover all sensors in your PC, run sensors-detect:
agrytsenko:~# sensors-detect
# sensors-detect revision 5729 (2009-06-02 15:51:29 [...]]]></description>
			<content:encoded><![CDATA[<p>How to get online temperature status on your linux box.<br />
<span id="more-624"></span></p>
<p>There is one good package which allow you to control and check your computer temperature in online mode. To install  For debian:</p>
<pre>apt-get install lm-sensors</pre>
<p>for CentOS or RH:</p>
<pre>yum install lm-sensors</pre>
<p>Next software should discover all sensors in your PC, run <em>sensors-detect</em>:</p>
<pre>agrytsenko:~# sensors-detect
# sensors-detect revision 5729 (2009-06-02 15:51:29 +0200)
# System: Hewlett-Packard HP Compaq 6510b (GB866EA#ACB) (laptop)
# Board: Hewlett-Packard 30C0                                   

This program will help you determine which kernel modules you need
to load to use lm_sensors most effectively. It is generally safe
and recommended to accept the default answers to all questions,
unless you know what you're doing.                                

Some south bridges, CPUs or memory controllers contain embedded sensors.
Do you want to scan for them? This is totally safe. (YES/no):
Silicon Integrated Systems SIS5595...                       No
VIA VT82C686 Integrated Sensors...                          No
VIA VT8231 Integrated Sensors...                            No
AMD K8 thermal sensors...                                   No
AMD K10 thermal sensors...                                  No
Intel Core family thermal sensor...                         Success!
    (driver `coretemp')
Intel AMB FB-DIMM thermal sensor...                         No
VIA C7 thermal and voltage sensors...                       No          

Some Super I/O chips contain embedded sensors. We have to write to
standard I/O ports to probe them. This is usually safe.
Do you want to scan for Super I/O sensors? (YES/no):
Probing for Super-I/O at 0x2e/0x2f
Trying family `National Semiconductor'...                   No
Trying family `SMSC'...                                     Yes
Found unknown chip with ID 0x3600
Probing for Super-I/O at 0x4e/0x4f
Trying family `National Semiconductor'...                   No
Trying family `SMSC'...                                     Yes
Found unknown non-standard chip with ID 0x7a                      

Some hardware monitoring chips are accessible through the ISA I/O ports.
We have to write to arbitrary I/O ports to probe them. This is usually
safe though. Yes, you do have ISA I/O ports even if you do not have any
ISA slots! Do you want to scan the ISA I/O ports? (YES/no):
Probing for `National Semiconductor LM78' at 0x290...       No
Probing for `National Semiconductor LM79' at 0x290...       No
Probing for `Winbond W83781D' at 0x290...                   No
Probing for `Winbond W83782D' at 0x290...                   No          

Lastly, we can probe the I2C/SMBus adapters for connected hardware
monitoring devices. This is the most risky part, and while it works
reasonably well on most systems, it has been reported to cause trouble
on some systems.
Do you want to probe the I2C/SMBus adapters now? (YES/no):
Sorry, no supported PCI bus adapters found.
Module i2c-dev loaded successfully.

Now follows a summary of the probes I have just done.
Just press ENTER to continue:

Driver `coretemp':
  * Chip `Intel Core family thermal sensor' (confidence: 9)

To load everything that is needed, add this to /etc/modules:
#----cut here----
# Chip drivers
coretemp
#----cut here----
If you have some drivers built into your kernel, the list above will
contain too many modules. Skip the appropriate ones!

Do you want to add these lines automatically to /etc/modules? (yes/NO)yes
Successful!

Monitoring programs won't work until the needed modules are
loaded. You may want to run '/etc/init.d/module-init-tools start'
to load them.

Unloading i2c-dev... OK</pre>
<p>If you have choosen &#8220;yes&#8221; on last question then all needed kernel modules were added to your module config file. In my case only one module is found, here is it:</p>
<pre>agrytsenko:~# grep temp /etc/modules
coretemp</pre>
<p>To get sensors status and data run <em>sensors</em>:</p>
<pre>agrytsenko:~# sensors
acpitz-virtual-0
Adapter: Virtual device
temp1:       +60.0°C  (crit = +256.0°C)
temp2:       +58.0°C  (crit = +108.0°C)
temp3:       +45.0°C  (crit = +105.0°C)
temp4:       +32.5°C  (crit = +108.0°C)
temp5:       +65.0°C  (crit = +110.0°C)

coretemp-isa-0000
Adapter: ISA adapter
Core 0:      +59.0°C  (high = +100.0°C, crit = +100.0°C)

coretemp-isa-0001
Adapter: ISA adapter
Core 1:      +61.0°C  (high = +100.0°C, crit = +100.0°C)
</pre>
<p>The output depends on your hardware sensors. This output from my another PC:</p>
<pre>w83627hf-isa-0290
Adapter: ISA adapter
VCore 1:   +1.47 V  (min =  +1.30 V, max =  +1.71 V)
VCore 2:   +1.82 V  (min =  +1.30 V, max =  +1.71 V)       ALARM
+3.3V:     +3.25 V  (min =  +2.82 V, max =  +3.79 V)
+5V:       +4.89 V  (min =  +4.06 V, max =  +5.70 V)
+12V:     +12.28 V  (min =  +7.24 V, max =  +9.97 V)       ALARM
-12V:     -11.95 V  (min =  +4.58 V, max = -11.87 V)       ALARM
-5V:       -5.20 V  (min =  +2.09 V, max =  -4.39 V)       ALARM
V5SB:      +5.46 V  (min =  +5.99 V, max =  +5.19 V)       ALARM
VBat:      +2.85 V  (min =  +3.54 V, max =  +3.49 V)       ALARM
fan1:        0 RPM  (min = 10887 RPM, div = 2)              ALARM
fan2:        0 RPM  (min = 3947 RPM, div = 2)              ALARM
fan3:        0 RPM  (min = 4411 RPM, div = 2)              ALARM
temp1:       +28 C  (high =   +68 C, hyst =   +48 C)   sensor = thermistor
temp2:     +43.0 C  (high =   +70 C, hyst =   +65 C)   sensor = diode(beep)
temp3:      -1.5 C  (high =   +70 C, hyst =   +65 C)   sensor = diode
vid:      +1.500 V  (VRM Version 8.5)
alarms:
beep_enable:
          Sound alarm enabled
</pre>
<p>Now you can do with these info whatever you want, for instance put into the file as plain text or excel document or even storage in RDBMS. I prefer to store these data&#8217;s in Round Robin Database and draw nice graphs by <strong>rrdtool</strong> util.</p>
]]></content:encoded>
			<wfw:commentRss>http://andriigrytsenko.net/2010/01/get-system-temperature-in-linux/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>D-link dwa-110 on Debian Box</title>
		<link>http://andriigrytsenko.net/2009/12/d-link-dwa-110-on-debian-box/</link>
		<comments>http://andriigrytsenko.net/2009/12/d-link-dwa-110-on-debian-box/#comments</comments>
		<pubDate>Wed, 23 Dec 2009 12:23:04 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://andriigrytsenko.net/?p=524</guid>
		<description><![CDATA[Here some manual how to set up wireless usb stick(D-link dwa-110) on Debian Linux box step-by-step.

First you need to get Windows drivers from your drivers CD(you can find this stuff in your modem&#8217;s box). Also you need to install ndiswrapper.
Put directory with drivers to /root/Drivers/ and install ndiswrapper:
apt-get install ndiswrapper-common ndiswrapper-utils-1.9 rt73-common
Make ndiswrapper work with [...]]]></description>
			<content:encoded><![CDATA[<p>Here some manual how to set up wireless usb stick(D-link dwa-110) on Debian Linux box step-by-step.</p>
<p><span id="more-524"></span></p>
<p>First you need to get Windows drivers from your drivers CD(you can find this stuff in your modem&#8217;s box). Also you need to install <em>ndiswrapper</em>.</p>
<p>Put directory with drivers to /root/Drivers/ and install ndiswrapper:</p>
<pre>apt-get install ndiswrapper-common ndiswrapper-utils-1.9 rt73-common</pre>
<p>Make ndiswrapper work with your windows driver:</p>
<pre>ndiswrapper -i /root/Drivers/WinXP_2K_9X/Dr71WU.inf</pre>
<p>in case of previous step was successfully done, generate new configuration for modprobe:</p>
<pre>ndiswrapper -m</pre>
<p>Try to determine what name has you wireless interface:</p>
<pre>ifconfig -a</pre>
<p>By default it&#8217;s <em>wlan0</em> , but in my case it&#8217;s <em>wlan1</em>. Let&#8217;s bring it up:</p>
<pre>ifconfig wlan1 up</pre>
<p>Add interface configuration to your <em>/etc/network/interfaces</em>. In case you have no dhcpd server inside the network set your settings statically :</p>
<pre>auto wlan1
allow-hotplug wlan1
iface wlan1 inet static
    address 192.168.0.3
    network 192.168.0.0
    gateway 192.168.0.1
    netmask 255.255.255.0
    wireless-essid Homeee
    wireless-mode Managed
    wireless-key DFFB9E2CC1</pre>
<p>Or if you have dynamic server inside:</p>
<pre>auto wlan1
iface wlan1 inet dhcp
    wireless-essid amber
    wireless-mode managed
    wireless-key 6170-706C-65
    wireless-rate 54M</pre>
<p>Restart your computer and enjoy. Or at least run :</p>
<pre>/etc/init.d/networking restart</pre>
<p>Also below some tips how to make manual configuration:</p>
<pre>ifconfig wlan1 192.168.0.1 netmask 255.255.255.0 up</pre>
<p>- bring network up with defined ip and net mask.</p>
<pre>iwconfig wlan1 essid "name of network"</pre>
<p>- to set network name</p>
<pre>iwconfig wlan1 mode "new_mode"</pre>
<p>- set mode there is 7 modes are present. See <em>man iwconfig</em> to get more details.</p>
<pre>iwconfig wlan1 key "key string"</pre>
<p>- to set key up</p>
<p>or</p>
<pre>iwconfig wlan1 key "s:key_string"</pre>
<p>- to WEP ascii key.</p>
<pre>iwconfig wlan1 rate 54M</pre>
<p>- to set up spesific transfer date speed</p>
<pre>iwlist wlan1 scan</pre>
<p>- to get all available networks and its parameters.</p>
<p>UPDATE:<br />
You can create little script which will be able restart ot start you wifi connection.</p>
<pre>cat &gt; /bin/wifi-restart </pre>
<pre>#!/bin/bash

ifconfig wlan1 down
sleep 5
iwconfig wlan1 essid amber
iwconfig wlan1 key s:apple
iwconfig wlan1 rate 54M
ifconfig wlan1 up
dhclient3 wlan1</pre>
<p>Now set executable  bit on it:</p>
<pre>chmod +x /bin/wifi-restart</pre>
<p>To start or restart wifi, run it: </p>
<pre>wifi-restart</pre>
]]></content:encoded>
			<wfw:commentRss>http://andriigrytsenko.net/2009/12/d-link-dwa-110-on-debian-box/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Wireless connection issue</title>
		<link>http://andriigrytsenko.net/2009/12/wireless-connection-issue/</link>
		<comments>http://andriigrytsenko.net/2009/12/wireless-connection-issue/#comments</comments>
		<pubDate>Wed, 23 Dec 2009 11:10:35 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[wifi]]></category>

		<guid isPermaLink="false">http://andriigrytsenko.net/?p=529</guid>
		<description><![CDATA[Recently I have faced with the next problem-&#62; my wireless connection time-to-time became unavailable.

I was starting investigation and figure out that my problem was the same as this. There is also workaround solution was found. First, let me describe my hardware and symptom data.
I have usb wireless adapter  D-link  DWA-110.
#lsusb
....
Bus 002 Device 004: [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I have faced with the next problem-&gt; my wireless connection time-to-time became unavailable.</p>
<p><span id="more-529"></span></p>
<p>I was starting investigation and figure out that my problem was the same as <a href="https://bugs.launchpad.net/ubuntu/+source/linux/+bug/200500">this</a>. There is also workaround solution was found. First, let me describe my hardware and symptom data.</p>
<p>I have usb wireless adapter  D-link  DWA-110.</p>
<pre>#lsusb
....
Bus 002 Device 004: ID 07d1:3c07 D-Link System Wireless G DWA-110 Adapter </pre>
<p>Linux kernel:</p>
<pre># uname -r
2.6.30-1-686</pre>
<p>Sometimes I observed that my network going to hung. In my logs I observer such messages:</p>
<pre>Dec 22 21:45:36 agrytsenko kernel: [52190.300066] wlan1: no probe response from AP 00:26:5a:95:8b:cc - disassociating
Dec 22 21:46:56 agrytsenko kernel: [52269.860040] wlan1: direct probe to AP 00:26:5a:95:8b:cc try 1
Dec 22 21:46:56 agrytsenko kernel: [52270.060080] wlan1: direct probe to AP 00:26:5a:95:8b:cc try 2</pre>
<p>I have written little script which restart my network:</p>
<pre>#!/bin/bash
ifconfig wlan1 down
sleep 5
iwconfig wlan1 essid amber
iwconfig wlan1 key s:apple
iwconfig wlan1 rate 54M
ifconfig wlan1 up
dhclient3 wlan1
</pre>
<p>But this way is not good idea at all. So after googling I find next solution(it&#8217;s also not complete solution, but quite better then my previous). This solution involve kernel sources. Therefore you should download it. After downloading you need to compile and install new kernel. Here is good <a href="http://andriigrytsenko.net/2009/07/linux-kernel-from-sources-for-debian/">how to</a> for Debian users.</p>
<p>Before you begin to compile new kernel and after unpacking the sources you should change one line in your sources. First, try to find it:</p>
<pre>cd /usr/src/linux
# grep -r IEEE80211_MONITORING_INTERVAL *
debian/linux-image-2.6.30/lib/modules/2.6.30/build/net/mac80211/mlme.c:#define IEEE80211_MONITORING_INTERVAL (2 * HZ)
.......</pre>
<p>So our line is found. Go there and set value to 100. Ex.:<br />
from</p>
<pre>#define IEEE80211_MONITORING_INTERVAL (2 * HZ)</pre>
<p>to</p>
<pre>#define IEEE80211_MONITORING_INTERVAL (100 * HZ)</pre>
<p>After new kernel installed and loaded my problem disappeared.</p>
]]></content:encoded>
			<wfw:commentRss>http://andriigrytsenko.net/2009/12/wireless-connection-issue/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Wireless internet AP based on RedHat linux</title>
		<link>http://andriigrytsenko.net/2009/11/wireless-internet-ap-based-on-linux/</link>
		<comments>http://andriigrytsenko.net/2009/11/wireless-internet-ap-based-on-linux/#comments</comments>
		<pubDate>Sun, 08 Nov 2009 02:36:27 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[redhat]]></category>
		<category><![CDATA[router]]></category>
		<category><![CDATA[wireless]]></category>

		<guid isPermaLink="false">http://andriigrytsenko.net/?p=498</guid>
		<description><![CDATA[I will try to describe how to make own home wireless access point based on RedHat linux machine.

This post include 2 part. In first one I&#8217;ll describe step which should be taken on linux machine and in second one step for windows client.
Linux(server side)
We use this host to share internet connection between users over wireless [...]]]></description>
			<content:encoded><![CDATA[<p>I will try to describe how to make own home wireless access point based on RedHat linux machine.</p>
<p><span id="more-498"></span></p>
<p>This post include 2 part. In first one I&#8217;ll describe step which should be taken on linux machine and in second one step for windows client.</p>
<h2 style="text-align: center;">Linux(server side)</h2>
<p>We use this host to share internet connection between users over wireless network, so the machine has to have at least two connection:</p>
<ol>
<li>Internet ( regular ethernet connection)</li>
<li>Wireless connection( provided by wi-fi card)</li>
</ol>
<p>I will skip how to setup your Internet connection, therefore make sure its work properly.<br />
If you mounted your wi-fi card to pci slot use <em>lspci</em> to check it out:</p>
<pre>[root@localhost ~]# lspci  | grep -i wireless
02:01.0 Ethernet controller: Atheros Communications Inc. Atheros AR5001X+ Wireless Network Adapter (rev 01)</pre>
<p>For this card kernel module <em>ath5k</em> should be loaded into the kernel. Check it:</p>
<pre>lsmod | grep ath5k</pre>
<p>Use <em>modprobe</em> unless module is not loaded.</p>
<pre>modprobe ath5k</pre>
<p>If you done it without any problem I will able to set up the wi-fi card. Here is network configuration file for interface wlan0 with some comments:</p>
<pre>[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-wlan0# Atheros Communications Inc. Atheros AR5001X+ Wireless Network Adapter
DEVICE=wlan0
ONBOOT=yes
IPADDR=192.168.0.1
NETMASK=255.255.255.0
HWADDR=00:17:9a:b7:d6:01
TYPE=Wireless
MODE=Ad-Hoc  # set this mode if want to make this card as access point
ESSID=homeee # the name of this connection which will be displayed for users
KEY=dffb9e2cc2 # secret key for connection</pre>
<p>To generate connection key run:</p>
<pre>dd if=/dev/random bs=1 count=5| xxd -ps</pre>
<p>Now restart the network service:</p>
<pre>service network restart</pre>
<p>and verify:</p>
<pre>iwconfig wlan0</pre>
<p>and</p>
<pre>ifconfig wlan0</pre>
<p>So 50% of linux part is done. Tune your kernel to make it forward ip traffic:</p>
<pre>vi /etc/sysctl.conf</pre>
<p>and set
<pre>net.ipv4.ip_forward</pre>
<p> to 1:<br />
<em>net.ipv4.ip_forward = <strong>1</strong></em><br />
Make changes affected:</p>
<pre>sysctl -p /etc/sysctl.conf</pre>
<p>Verify:</p>
<pre>sysctl -a | grep all.forwarding | grep ipv4</pre>
<p>And last but very important step. Its firewall and nat settings:<br />
!!! Be careful because this command flush all your rules in OUTPUT chain</p>
<pre>iptables -F OUTPUT</pre>
<p>turn masquerading on:</p>
<pre> iptables -t nat -I POSTROUTING -s 192.168.0.2/32 -o eth0 -j MASQUERADE</pre>
<p>where <em>eth0</em> your interface for share.<br />
save it all:</p>
<pre>service iptables save</pre>
<p>The linux router is ready on all 100%.</p>
<h2 style="text-align: center;">Windows(client side)</h2>
<p>I use windows Vista for this, but this steps can be used to Windows XP as well. Go to:<br />
<em>Start-&gt;Control Panel-&gt;Network and Internet-&gt; Network and Sharing center -&gt;  manage network connections </em><br />
Click right button on your <em>Wireless Network Connection</em> and choose <em>Properties</em>.<br />
Make double click on <em>Internet Protocol Version 4</em>.<br />
When new window is appear fill it up:<br />
<em>Ip address: 192.168.0.2<br />
Subnet mask: 255.255.255.0<br />
Default gateway: 192.168.0.1</em><br />
Also you need to specify you DNS server. Put the ip address of DNS server provided by your ISP.</p>
]]></content:encoded>
			<wfw:commentRss>http://andriigrytsenko.net/2009/11/wireless-internet-ap-based-on-linux/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Local Cent-OS repository step-by-step</title>
		<link>http://andriigrytsenko.net/2009/10/local-cent-os-repository-step-by-step/</link>
		<comments>http://andriigrytsenko.net/2009/10/local-cent-os-repository-step-by-step/#comments</comments>
		<pubDate>Wed, 21 Oct 2009 14:28:39 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://andriigrytsenko.net/?p=486</guid>
		<description><![CDATA[There is some instruction how to make centralized repository for CentOS software.

As repository I have used my own Debian machine. Firstly, I have installed createrepo. This program generate some metadata which is necessary for RPM repository. Run
apt-get install createrepo
to install it from yum repository.  Create two directories in the DocumentRoot environment. In my case [...]]]></description>
			<content:encoded><![CDATA[<p>There is some instruction how to make centralized repository for CentOS software.</p>
<p><span id="more-486"></span></p>
<p>As repository I have used my own Debian machine. Firstly, I have installed <em>createrepo</em>. This program generate some metadata which is necessary for RPM repository. Run</p>
<pre>apt-get install createrepo</pre>
<p>to install it from yum repository.  Create two directories in the <em>DocumentRoot</em> environment. In my case its <em>/var/www/html/</em> :</p>
<pre>mkdir -pv /var/www/html/centos/5/{os,updates}/i386</pre>
<p>Now  copy packages from your CD/DVD installation disk to <em>./centos/5/os/i386</em> directory.<br />
As I have an image file I should mount it first:</p>
<pre>mount -o loop ~/CentOS-5.3-i386-bin-DVD.iso /mnt/dvd/</pre>
<p>Only after you may start to copy:</p>
<pre>cp /mnt/dvd/CentOS/* /var/www/html/centos/5/os/i386/</pre>
<p>Its can take a while.<br />
Also you need to get updates for your repository:</p>
<pre>rsync -avrt rsync://mirror.web-ster.com/centos/5/updates/i386  --exclude=debug/</pre>
<p>Take a look about more suitable rsync mirror for you <a href="http://www.centos.org/modules/tinycontent/index.php?id=30">here</a>. It&#8217;s good idea to keep this directory updated all the time via cron. </p>
<p>Generate metadata for both directories.</p>
<pre>cd /var/www/html/centos/5/os/i386/ &#038;&#038; createrepo . </pre>
<pre>cd /var/www/html/centos/5/updates/i386/ &#038;&#038; createrepo . </pre>
<p>For server side is done. Please pay attention that your web-server should be run to keep the repository available. </p>
<h3>Client side:</h3>
<p>Backup your *.repo files in your <em>/etc/yum.repos.d</em>: </p>
<pre>for i in *.repo; do mv $i $i.bak; done</pre>
<p>And new one <em>CentOS-Base.repo</em> config with next context:</p>
<pre>[base]
name=CentOS-$releasever - Base
baseurl=http://{IP address of your server}/centos/$releasever/os/$basearch/
gpgcheck=0
[update]
name=CentOS-$releasever - Updates
baseurl=http://{IP address of your server}/centos/$releasever/updates/$basearch/
gpgcheck=0</pre>
<p>This steps should be repeated for each client machine.  </p>
]]></content:encoded>
			<wfw:commentRss>http://andriigrytsenko.net/2009/10/local-cent-os-repository-step-by-step/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux hard reboot and System Request Key</title>
		<link>http://andriigrytsenko.net/2009/10/linux-hard-reboot-and-system-request-key/</link>
		<comments>http://andriigrytsenko.net/2009/10/linux-hard-reboot-and-system-request-key/#comments</comments>
		<pubDate>Thu, 15 Oct 2009 12:14:05 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://andriigrytsenko.net/?p=482</guid>
		<description><![CDATA[Sometimes we need to reboot remote machine. But all we get an error in console.

The most popular reason of this disk problems. To perform force rebooting turn on SRK feature in the kernel via proc VFS:
# sysctl -w kernel.sysrq=1 
and send command to kernel to reboot the system without unmounting file systems:
echo b > /proc/sysrq-trigger
Here [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes we need to reboot remote machine. But all we get an error in console.<br />
<span id="more-482"></span><br />
The most popular reason of this disk problems. To perform force rebooting turn on SRK feature in the kernel via proc VFS:</p>
<pre># sysctl -w kernel.sysrq=1 </pre>
<p>and send command to kernel to reboot the system without unmounting file systems:</p>
<pre>echo b > /proc/sysrq-trigger</pre>
<p>Here is some additional SRK features:<br />
• <strong>r</strong> — Disables raw mode for the keyboard and sets it to XLATE (a limited keyboard mode which<br />
  does not recognize modifiers such as Alt, Ctrl, or Shift for all keys).<br />
• <strong>k</strong> — Kills all processes active in a virtual console. Also called Secure Access Key (SAK), it is<br />
  often used to verify that the login prompt is spawned from init and not a trojan copy designed to<br />
  capture usernames and passwords.<br />
• <strong>b</strong> — Reboots the kernel without first unmounting file systems or syncing disks attached to the<br />
  system.<br />
• <strong>c</strong> — Crashes the system without first unmounting file systems or syncing disks attached to the<br />
  system.<br />
• <strong>o</strong> — Shuts off the system.<br />
• <strong>s</strong> — Attempts to sync disks attached to the system.<br />
• <strong>u</strong> — Attempts to unmount and remount all file systems as read-only.<br />
• <strong>p</strong> — Outputs all flags and registers to the console.<br />
• <strong>t</strong> — Outputs a list of processes to the console.<br />
• <strong>m</strong> — Outputs memory statistics to the console.<br />
• <strong>0-9</strong> — Sets the log level for the console.<br />
• <strong>i</strong> — Kills all processes except init using SIGKILL.<br />
• <strong>l</strong> — Kills all processes using SIGKILL (including init). The system is unusable after issuing this SR Key pre.<br />
• <strong>h</strong> — Displays help text.</p>
]]></content:encoded>
			<wfw:commentRss>http://andriigrytsenko.net/2009/10/linux-hard-reboot-and-system-request-key/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Testing IMAP and POP3 servers over the telnet</title>
		<link>http://andriigrytsenko.net/2009/09/testing-imap-and-pop3-servers-over-the-telnet/</link>
		<comments>http://andriigrytsenko.net/2009/09/testing-imap-and-pop3-servers-over-the-telnet/#comments</comments>
		<pubDate>Fri, 25 Sep 2009 12:49:53 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[*nix]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[imap]]></category>
		<category><![CDATA[mail]]></category>
		<category><![CDATA[pop3]]></category>

		<guid isPermaLink="false">http://andriigrytsenko.net/?p=456</guid>
		<description><![CDATA[Command list of IMAP and POP3 protocols. They can be used to test your server remotely over telnet connection.

Assume you set up pop3 and imap and want to check it out. 
POP3 
POP3 is quite simple protocol. I think you will make out how it&#8217;s work without any problem. 
First, let&#8217;s go to check the [...]]]></description>
			<content:encoded><![CDATA[<p>Command list of IMAP and POP3 protocols. They can be used to test your server remotely over telnet connection.<br />
<span id="more-456"></span></p>
<p>Assume you set up pop3 and imap and want to check it out. </p>
<p><center><strong>POP3 </strong></center><br />
POP3 is quite simple protocol. I think you will make out how it&#8217;s work without any problem. </p>
<p>First, let&#8217;s go to check the POP3 server. Make sure that it bound at port 110: </p>
<pre># netstat -lnp | grep 110
tcp        0      0 0.0.0.0:110                 0.0.0.0:*                   LISTEN      2779/dovecot</pre>
<p>As you can see I use dovecot as server application and it&#8217;s works on all interfaces.<br />
Next, make connection attempt:</p>
<pre># telnet 127.0.0.1 110
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
+OK Dovecot ready.</pre>
<p>Now, we got server answer. Do authorization with command <em>user</em> and <em>pass</em></p>
<pre>USER user1
+OK
PASS qwe
+OK Logged in.</pre>
<p>and <em>LIST</em> to see headers of all inbox mails:</p>
<pre>LIST
+OK 1 messages:
1 306
.</pre>
<p>We have only one mail. First field of answer means
<pre>mail_id</pre>
<p>.<br />
To see whole mail use <em>RETR mail_id</em>: </p>
<pre>RETR 1
+OK 306 octets
Return-Path: <fd@test.com>
Received: from d (node1 [10.0.30.1])
        by mail.test.com (8.13.8/8.13.8) with SMTP id n8ONtVLG011279
        for user1@test.com; Fri, 25 Sep 2009 03:04:08 +0300
Date: Fri, 25 Sep 2009 03:04:08 +0300
From: fd@test.com
Message-Id: <200909250004.n8ONtVLG011279@mail.test.com>
test</pre>
<p>To delete it:</p>
<pre>DELE 1
+OK Marked to be deleted.</pre>
<p>This message marked as deleted and will be removed when you send command <em>QUIT</em> to server. To unmark messages use command <em>RSET</em> without any arguments:</p>
<pre>RSET
+OK</pre>
<p>Use command <em>QUIT</em> to leave the server.</p>
<pre>QUIT
+OK Logging out.</pre>
<p>Refer to <a href="http://www.faqs.org/rfcs/rfc1939.html">RFC 1939</a> for more details.</p>
<p><center><strong>IMAP</strong></center><br />
By default IMAP listen port 143. Therefore let&#8217;s check it first:
<pre>
# netstat -lnp | grep 143
tcp        0      0 0.0.0.0:143                 0.0.0.0:*                   LISTEN      2779/dovecot</pre>
<p>Try to connect: </p>
<pre># telnet localhost 143
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
* OK Dovecot ready.</pre>
<p>Okay, we have got good answer. Now, we should authorize on server. Syntax is:<br />
<em>? LOGIN USER/ALIAS PASSWORD</em></p>
<p>For example:</p>
<pre>? login user1 qwe
? OK Logged in.</pre>
<p>To get folders list make: </p>
<pre>? LIST "" "*"
* LIST (\NoInferiors \UnMarked) "/" "INBOX"
? OK List completed.</pre>
<p>In folder INBOX contain all incoming messages. To select it: </p>
<pre>? SELECT INBOX
* FLAGS (\Answered \Flagged \Deleted \Seen \Draft)
* OK [PERMANENTFLAGS (\Answered \Flagged \Deleted \Seen \Draft \*)] Flags permitted.
* 1 EXISTS
* 0 RECENT
* OK [UNSEEN 1] First unseen.
* OK [UIDVALIDITY 1253837819] UIDs valid
* OK [UIDNEXT 2] Predicted next UID
? OK [READ-WRITE] Select completed.</pre>
<p><em>1 EXISTS</em> &#8211; means 1 incoming message. You can choose between see full message or only message body instead:<br />
<em>? FETCH message_number All</em><br />
OR<br />
<em>? FETCH message_number Body</em></p>
<p>Let&#8217;s see whole message:</p>
<pre>? FETCH 1 all
* 1 FETCH (FLAGS () INTERNALDATE "25-Sep-2009 03:04:12 +0300" RFC822.SIZE 306 ENVELOPE ("Fri, 25 Sep 2009 03:04:08 +0300" NIL ((NIL NIL "fd" "test.com")) ((NIL NIL "fd" "test.com")) ((NIL NIL "fd" "test.com")) NIL NIL NIL NIL "<200909250004.n8ONtVLG011279@mail.test.com>"))
? OK Fetch completed.</pre>
<p>Exit user command  is <em>? LOGOUT</em>. </p>
<p>To learn more about IMAP refer to <a href="http://www.faqs.org/rfcs/rfc3501.html">RFC 3501</a>. </p>
]]></content:encoded>
			<wfw:commentRss>http://andriigrytsenko.net/2009/09/testing-imap-and-pop3-servers-over-the-telnet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Login restriction by time over pam.d</title>
		<link>http://andriigrytsenko.net/2009/08/login-restriction-by-time-over-pam-d/</link>
		<comments>http://andriigrytsenko.net/2009/08/login-restriction-by-time-over-pam-d/#comments</comments>
		<pubDate>Fri, 21 Aug 2009 15:53:36 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[pam]]></category>
		<category><![CDATA[redhat]]></category>

		<guid isPermaLink="false">http://andriigrytsenko.net/?p=423</guid>
		<description><![CDATA[If you I want to allow users log in in to system only at working hours use pam_time.so module. This example works on CentOS and I suspect that it will be work at RHEL as well.

We should edit to files for this:
/etc/pam.d/login
/etc/security/time.conf
Let&#8217;s begin from first one. Put next line into the file:
account    [...]]]></description>
			<content:encoded><![CDATA[<p>If you I want to allow users log in in to system only at working hours use pam_time.so module. This example works on CentOS and I suspect that it will be work at RHEL as well.</p>
<p><span id="more-423"></span></p>
<p>We should edit to files for this:<br />
<em>/etc/pam.d/login<br />
/etc/security/time.conf</em></p>
<p>Let&#8217;s begin from first one. Put next line into the file:</p>
<pre>account    required     pam_time.so</pre>
<p>after that go to the <em>/etc/security/time.conf</em>, and insert next:</p>
<pre>login;tty*;user1|user2|user3;Wk0009-1800 &amp; !Wd0000-2400</pre>
<p>where<br />
<em>login</em> &#8211; the type of pam service<br />
<em>tty*</em> &#8211; terminal name(in this case all terminal ttyXXX, you also specify defined terminal as well)<br />
<em>user1|user2|user3</em> &#8211; users or user name which should be restricted<br />
<em>Wk0009-1800 &amp; !Wd0000-2400</em> &#8211; time frame. Time where actions is allowed. To inverse it put &#8220;!&#8221; before.  There is 7 types of day:<br />
<em>Mo Tu We Th Fr Sa Su Wk Wd Al</em><br />
First seven is according to weeks day.<br />
<em>Wk</em> &#8211; means all work days(Mo-Fr)<br />
<em>Wd</em> &#8211; it&#8217;s week end(Sa,SU)<br />
<em>Al</em> &#8211; all days of week.</p>
<p>Now, you new rules was applied. And users user1, user2, user3 can&#8217;t log on system at no working time. No restart is required.</p>
<p>But we still have one problem. Users which logined at work time can be continuous use system without problem. To prevent this situation I have written little <a href="http://andriigrytsenko.net/files/time.txt">script</a>.</p>
<p>Rename it to <em>time.sh</em> and put anywhere at your system. After this new crontab entry should be added:</p>
<pre>crontab -e</pre>
<pre>55 17 * * 1-5    /path/to/time.sh</pre>
<p>Now all session will be destroyed at the end of working day and script notify user via user&#8217;s terminal 5 minutes before this. After that nobody from specified users willn&#8217;t be able to login on the system.</p>
]]></content:encoded>
			<wfw:commentRss>http://andriigrytsenko.net/2009/08/login-restriction-by-time-over-pam-d/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How to export NFS home directories over the Autofs</title>
		<link>http://andriigrytsenko.net/2009/08/how-to-export-nfs-home-directories-over-the-autofs/</link>
		<comments>http://andriigrytsenko.net/2009/08/how-to-export-nfs-home-directories-over-the-autofs/#comments</comments>
		<pubDate>Thu, 20 Aug 2009 03:16:03 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[autofs]]></category>
		<category><![CDATA[nfs]]></category>

		<guid isPermaLink="false">http://andriigrytsenko.net/?p=417</guid>
		<description><![CDATA[Step-by-step instruction to get benefits from NFS and Autofs.

We have two machines as always:

srv2: has NFS server and a lot of disk space.(IP 10.0.30.2)
srv1: has users and autofs daemon(IP 10.0.30.1)

Go to srv1 and make new user: 
srv1#adduser user1
Get id: 
srv1#id user1
uid=500(user1) gid=500(user1) groups=500(user1)
Open console on srv2 and make directory for home&#8217;s directoies:
srv2#mkdir /export_home
now make directory [...]]]></description>
			<content:encoded><![CDATA[<p>Step-by-step instruction to get benefits from NFS and Autofs.</p>
<p><span id="more-417"></span></p>
<p>We have two machines as always:</p>
<ul>
<li>srv2: has NFS server and a lot of disk space.(IP 10.0.30.2)</li>
<li>srv1: has users and autofs daemon(IP 10.0.30.1)</li>
</ul>
<p>Go to srv1 and make new user: </p>
<pre>srv1#adduser user1</pre>
<p>Get id: </p>
<pre>srv1#id user1
uid=500(user1) gid=500(user1) groups=500(user1)</pre>
<p>Open console on srv2 and make directory for home&#8217;s directoies:</p>
<pre>srv2#mkdir /export_home</pre>
<p>now make directory for specific user(user1):</p>
<pre>srv2#mkdir /export_home/user1</pre>
<p>and set proper owner:</p>
<pre>srv2#chown 501 /export_home/user1</pre>
<p>!!!where 501 owner ID which is got  from srv1.</p>
<p>Next step is NFS configuration at srv2. Open <em>/etc/exports</em> and add new share point:</p>
<pre>/export_home/user1     10.0.30.1(rw)</pre>
<p>After changes is done reload services and put into boot:</p>
<pre>/etc/init.d/nfs reload
chkconfig --level 45 nfs on</pre>
<p>srv2 is completely done. Back to srv1:<br />
Add new line into <em>/etc/auto.master</em>:</p>
<pre>/home   /etc/auto.home</pre>
<p>It&#8217;s pointed at new configuration file which will define mount point for /home directory. Put next line into it(<em>/etc/auto.home</em>):</p>
<pre>user1            -rw,soft,intr           10.0.30.2:/export_home/user1</pre>
<p>This line means mount NFS share <em>/export_home/user1</em> from server 10.0.30.2 into local directory <em>/home/user1</em>. Restart autofs daemon to make changes take effect:</p>
<pre>/etc/init.d/autofs restart</pre>
<p>Now when you log in into system as user1 the NFS share from remote host will mount as your home directory. And will be unmount in timeout(300 seconds by default) after you have logged out.</p>
<p>Also you can put together this system with NIS so as to use common user database. As benefits you will get very flexible system and simplified user management.</p>
]]></content:encoded>
			<wfw:commentRss>http://andriigrytsenko.net/2009/08/how-to-export-nfs-home-directories-over-the-autofs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SSH connection without password</title>
		<link>http://andriigrytsenko.net/2009/08/ssh-connection-without-password/</link>
		<comments>http://andriigrytsenko.net/2009/08/ssh-connection-without-password/#comments</comments>
		<pubDate>Fri, 14 Aug 2009 14:53:04 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://andriigrytsenko.net/?p=400</guid>
		<description><![CDATA[SSH password-less log in method.

Let&#8217;s imagine that we have 2 hosts.

 Host A with user1 is your local host from which you will connect to remote.
Host B with user2 is remote host where you want to log in as user2.

Run
ssh-keygen
 as user1 on Host A to generate keys unless old one is exist. When I [...]]]></description>
			<content:encoded><![CDATA[<p>SSH password-less log in method.<br />
<span id="more-400"></span></p>
<p>Let&#8217;s imagine that we have 2 hosts.</p>
<ul>
<li> Host A with user1 is your local host from which you will connect to remote.</li>
<li>Host B with user2 is remote host where you want to log in as user2.</li>
</ul>
<p>Run
<pre>ssh-keygen</pre>
<p> as user1 on Host A to generate keys unless old one is exist. When I will be prompted to enter  passphrase just keep it blank. This command generate RSA key with long in 2048 bit:</p>
<pre>ssh-keygen -b 2048
Generating public/private rsa key pair.
Enter file in which to save the key (/home/user1/.ssh/id_rsa):
/home/user1/.ssh/id_rsa already exists.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/user1/.ssh/id_rsa.
Your public key has been saved in /home/user1/.ssh/id_rsa.pub.
The key fingerprint is:
9e:f0:44:4a:e2:81:72:02:0b:3c:b5:3d:be:a7:c2:95 user1@host_a
The key's randomart image is:
+--[ RSA 2048]----+
...
+-----------------+
</pre>
<p>After it&#8217;s done check content of your <em>id_rsa.pub</em> file:</p>
<pre>host_a:~# cat .ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAzU6SlO7EZksPGmLTz3EcMpFQXME9otJ4vWqQ1Nnzd0g0FX5MS
/H1m2xJWCLfgsWTWyOP7hHQufPrzY5kqJkeF0tgOSPHnzDQt4YBE1Xi0ihR/cDK+KHOlIFG4kHlEs/ThTDpD0mwgBC755Tu5g2GOW3ogsrViZbyfa72HJQaEbISZwfiPnJUwmtGJ/+PQiEoN8cgK1zrk8oVnlguK0V52ZygFuvNKd6jmKIiDKOcQ2ZIobu6jYVd/Nit1gg+9llbuAdXDFn24AdNHatBzvlwb76yYa/ZAwZQKzytWca0NnMMwMeQ== user1@host_a</pre>
<p>Copy it and log in remote Host B as user2. And append it to <em>authorized_keys</em> file:</p>
<pre>$ cat &gt;&gt; /home/grytsenko/.ssh/authorized_keys
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAzU6SlO7EZksPGmLTz3EcMpFQXME9otJ4vWqQ1Nnzd0g0FX5MS
/H1m2xJWCLfgsWTWyOP7hHQufPrzY5kqJkeF0tgOSPHnzDQt4YBE1Xi0ihR/cDK+KHOlIFG4kHlEs/ThTDpD0mwgBC755Tu5g2GOW3ogsrViZbyfa72HJQaEbISZwfiPnJUwmtGJ/+PQiEoN8cgK1zrk8oVnlguK0V52ZygFuvNKd6jmKIiDKOcQ2ZIobu6jYVd/Nit1gg+9llbuAdXDFn24AdNHatBzvlwb76yYa/ZAwZQKzytWca0NnMMwMeQ== user1@host_a</pre>
<p>Set proper permissions for file:</p>
<pre>user2@host_b:~$ chmod 600 ~/.ssh/authorized_keys</pre>
<p>Now you are ready to log in without password from Host A:</p>
<pre>host_a~# ssh -p 443 user2@host_b
Linux host_b 2.6.18-5-686 #1 SMP Fri Jun 1 00:47:00 UTC 2007 i686</pre>
<p>That&#8217;s all folks:).</p>
]]></content:encoded>
			<wfw:commentRss>http://andriigrytsenko.net/2009/08/ssh-connection-without-password/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quickstart: backup on hard disk with AMANDA</title>
		<link>http://andriigrytsenko.net/2009/07/quick-start-backup-on-hard-disk-with-amanda/</link>
		<comments>http://andriigrytsenko.net/2009/07/quick-start-backup-on-hard-disk-with-amanda/#comments</comments>
		<pubDate>Fri, 31 Jul 2009 12:10:58 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[amanda]]></category>
		<category><![CDATA[backup]]></category>

		<guid isPermaLink="false">http://andriigrytsenko.net/?p=370</guid>
		<description><![CDATA[In this post I will explain how to backup data to hard disk instead of tape with amanda backup tools over the network.

!!!CATION: Use this information on your own risk. Please remember that every step should be double checked unless you want to lose your data.
Preamble
I have two host and one of them will be [...]]]></description>
			<content:encoded><![CDATA[<p>In this post I will explain how to backup data to hard disk instead of tape with amanda backup tools over the network.<br />
<span id="more-370"></span></p>
<p><span style="color: #ff0000;">!!!CATION: Use this information on your own risk. Please remember that every step should be double checked unless you want to lose your data.</span></p>
<p><strong>Preamble</strong><br />
I have two host and one of them will be used as backup server another as backup client:</p>
<ul>
<li>node1 &#8211; uses as client it will be backuped side. It&#8217;s critical server and directory <em>/etc</em> should be backuped as well.</li>
<li>node2 &#8211; backup server which has good RAID equipment for backup mounted at <em>/opt/backups</em>.</li>
</ul>
<p>Let&#8217;s start from server side:</p>
<p><strong>SERVER SIDE</strong></p>
<p>Go to the node2 and get all needed software</p>
<pre>yum install amanda
yum install amanda-client
yum install amanda-server</pre>
<p>After that we are ready to start server in over xinetd. Go to the <em>/etc/xinetd.d</em> directory and set directive
<pre>disable</pre>
<p> to
<pre>no</pre>
<p> in files : amanda, amandaidx and amidxtape.</p>
<pre>service amanda
{
socket_type             = dgram
protocol                = udp
wait                    = yes
user                    = amanda
group                   = disk
server                  = /usr/lib/amanda/amandad
disable                 = no
}
service amandaidx
{
socket_type             = stream
protocol                = tcp
wait                    = no
user                    = amanda
group                   = disk
server                  = /usr/lib/amanda/amindexd
disable                 = no
}
service amidxtape
{
socket_type             = stream
protocol                = tcp
wait                    = no
user                    = amanda
group                   = disk
server                  = /usr/lib/amanda/amidxtaped
disable                 = no
}</pre>
<p>to make new configuration works, restart xinted daemon:</p>
<pre>/etc/init.d/xinetd restart</pre>
<p>Check that everything is running:</p>
<pre>netstat -a | grep amand</pre>
<p>You should get something like that:</p>
<pre>tcp        0      0 *:amandaidx                 *:*                         LISTEN
udp        0      0 *:amanda                    *:*</pre>
<p>Make changes at .amandahosts allow users  amanda and root from host localhost connect to server:</p>
<pre>cat /var/lib/amanda/.amandahosts
localhost amanda  amindexd amidxtaped amdump
localhost.localdomain amanda  amindexd amidxtaped amdump
localhost root amindexd amidxtaped
localhost.localdomain root amindexd amidxtaped
node1 root  amindexd amidxtaped amdump</pre>
<p>Set properly permissions to protect config from illegal access :</p>
<pre>chmod 600 /var/lib/amanda/.amandahosts</pre>
<p>I will store backups at local hard disk.Mount point is <em>/opt/backups</em>. First, make directory with read-write permissions for user amanda:</p>
<pre>mkdir /opt/backups
chown amanda /opt/backups</pre>
<p>Next step, check value in
<pre>tapecycle</pre>
<p> at your <em>amanda.conf</em>. In my case it&#8217;s 25. That means that I should have 25 virtual tapes at my <em>/opt/backups</em>. Let&#8217;s create it and label, put in console next line:</p>
<pre>i=1; while [ $i -lt 26 ]; do mkdir -v /opt/backups/slot$i; let i=i+1; done</pre>
<p>also make symlink to first tape:</p>
<pre>ln -s /opt/backups/slot1 /opt/backups/data</pre>
<p>and set owner:</p>
<pre>chown -R amanda.disk /opt/backups/</pre>
<p>Now, login as amanda and label slots:</p>
<pre>su - amanda
i=1; while [ $i -lt 26 ]; do /usr/sbin/amlabel DailySet1 DailySet1-$i slot $i; let i=i+1;  done</pre>
<p>Check is everything labeled properly:</p>
<pre>/usr/sbin/amtape DailySet1 show</pre>
<p>Let&#8217;s take a look at amanda.conf. It&#8217;s located at <em>/etc/amanda/DailySet1</em>.</p>
<p>Below describe some change in configuration file which should be done.<br />
Add new section into your amanda.conf :</p>
<pre>define tapetype HARD-DISK {
comment "On Hard Disk"
length 3000 mbytes
}</pre>
<p>Specify directory for backups:</p>
<pre>tapedev "file:/opt/backups"</pre>
<p>and change
<pre>tapetype</pre>
<p> to
<pre>HARD-DISK</pre>
<pre>tapetype HARD-DISK</pre>
<p>In section
<pre>define dumptype global</pre>
<p> comment out and set to yes next:</p>
<pre>index yes
record yes
</pre>
<p>Change
<pre>tpchanger</pre>
<p> to this:</p>
<pre>tpchanger "chg-disk"</pre>
<p>If you have CentOS and Amanda Version 2.5.0p2  set chunksize to 0:</p>
<pre>chunksize 0</pre>
<p>to prevent errors concerning with recovery.</p>
<p>There is listing of main configuration file <a href="http://andriigrytsenko.net/files/amanda.conf">amanda.conf</a>:</p>
<p>Next files and directories should be created set owner to user amanda:</p>
<pre>touch /etc/amanda/DailySet1/tapelist
chown amanda /etc/amanda/DailySet1/tapelist
mkdir -p /dumps/amanda
chown amanda /dumps/amanda
mkdir /etc/amanda/DailySet1/curinfo
mkdir /etc/amanda/DailySet1/index
chown amanda /etc/amanda/DailySet1/index
chown amanda /etc/amanda/DailySet1/curinfo
mkdir  /etc/amanda/DailySet1/curinfo/localhost
chown amanda /etc/amanda/DailySet1/curinfo/localhost
mkdir  /etc/amanda/DailySet1/index/localhost
chown amanda /etc/amanda/DailySet1/index/localhost
mkdir /etc/amanda/DailySet1/curinfo/localhost/_etc
mkdir  /etc/amanda/DailySet1/index/localhost/_etc
chown amanda  /etc/amanda/DailySet1/index/localhost/_etc
chown amanda  /etc/amanda/DailySet1/curinfo/localhost/_etc
touch /etc/amanda/DailySet1/curinfo/localhost/_etc/info
chown amanda  /etc/amanda/DailySet1/curinfo/localhost/_etc/info</pre>
<p>Also very important file disklist located at <em>/etc/amanda/DailySet1</em>. Its consist all targets which have to backuped.</p>
<pre>cat disklist
node1 /etc comp-root-tar</pre>
<p><strong>CLIENT SIDE</strong></p>
<p>First, you should install software:</p>
<pre>yum install amanda-client</pre>
<p>and edit access file:</p>
<pre>cat /var/lib/amanda/.amandahosts
localhost amanda amindexd amidxtaped amdump
localhost  root amindexd amidxtaped
node2 amanda amindexd amidxtaped amdump
node2 root amindexd amidxtaped</pre>
<p>Set properly permissions:</p>
<pre>chmod 600 /var/lib/amanda/.amandahosts</pre>
<p>And last step enable amanda in xinetd as was mentioned above. Set
<pre>disable = no</pre>
<p> at <em>/etc/xinetd.d/amanda</em> and restart xinetd:</p>
<pre>/etc/init.d/xinetd restart</pre>
<p><strong>LITTLE PRACTISE</strong></p>
<p>Make test file at client side(node1) :</p>
<pre>echo "test"  &gt; /etc/testing</pre>
<p>To make backup go to the node2 login as amanda and run
<pre>amdump</pre>
<pre>su - amanda
/usr/sbin/amdump  DailySet1 node1</pre>
<p>Now you are ready to restore any file from backup. Go back to node1 and delete test file:</p>
<pre>rm /etc/testing</pre>
<p>Try to restart it over the amrecovery.</p>
<pre>amrecovery -t node2 -s node2</pre>
<p>if you get interactive mode type:
<pre>
&gt; sethost node1
&gt; setdisk /etc
&gt; add testing
&gt; lcd /etc
&gt; extract </pre>
<p>type &#8220;y&#8221; twice when you be prompted. Go to the <em>/etc</em> and check if was file restored:</p>
<pre>cat /etc/testing
test</pre>
<p>As you can see we successfully recover file which was mistaken delete.</p>
<p>!!!Keep in mind that in case of node1 will be failed date could be recovered from node2 as well.</p>
]]></content:encoded>
			<wfw:commentRss>http://andriigrytsenko.net/2009/07/quick-start-backup-on-hard-disk-with-amanda/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>SElinux tips and tricks</title>
		<link>http://andriigrytsenko.net/2009/07/selinux-tips-and-tricks/</link>
		<comments>http://andriigrytsenko.net/2009/07/selinux-tips-and-tricks/#comments</comments>
		<pubDate>Mon, 27 Jul 2009 13:55:23 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[selinux]]></category>

		<guid isPermaLink="false">http://andriigrytsenko.net/?p=358</guid>
		<description><![CDATA[Short notes about base SELinux commands.

The SELinux technology allow you to improve security level of your system. You can restrict access to the ports, files, directories, process and so on.  There are a lot of tools involved in this process and I will try to make little overview about most of they.
setenforce uses to [...]]]></description>
			<content:encoded><![CDATA[<p>Short notes about base SELinux commands.<br />
<span id="more-358"></span></p>
<p>The SELinux technology allow you to improve security level of your system. You can restrict access to the ports, files, directories, process and so on.  There are a lot of tools involved in this process and I will try to make little overview about most of they.</p>
<p><strong>setenforce</strong> uses to set SELinux mode. There are two basic mode: Enforcing and Permissive. First mode makes SELinux turn on. Another one is turn off SELinux.<br />
!!! Caution this tools doesn&#8217;t make changes at /etc/selinux/config file. Its means that SELinux will back to previous mode after reboot. To make permanent change of mode edit /etc/selinux/config directly.</p>
<p>The management mechanism of SELinuxfs (/selinux mount point by default) a slightly alike to the procfs. You can easily change any parameter just put bool value into the file. It&#8217;s an alternative way to change different options of SELinux. As example use <b>echo</b> to change SELinux mode:</p>
<pre>[root@node2 ~]# getenforce
Enforcing
[root@node2 ~]# echo 0 > /selinux/enforce
[root@node2 ~]# getenforce
Permissive</pre>
<p><strong>getenforce</strong> &#8211; check current SELinux mode.</p>
<p><strong>sestatus</strong> &#8211; output current SELinux status.  </p>
<p><strong>setroubleshootd</strong> &#8211; is located in setroubleshoot* rpm&#8217;s which is not installed by default. Use yum to install it: </p>
<pre>yum install setroubleshoot</pre>
<p>This daemon running with system from /etc/init.d/setroubleshoot and put all SELinux messages into the log file. </p>
<p><strong>secon</strong> &#8211; allow to see SELinux attributes for object(file, directory, process and so on). </p>
<p><strong>chcon</strong>  &#8211; changes SELinux attributes for object</p>
<p><strong>sealert </strong> &#8211; It&#8217;s GUI tool which works in co-operation with setroubleshootd. It&#8217;s display all SELinux message and give some explanation concerning its.</p>
<p><strong>restorecon</strong> &#8211; restore defaults attribute for given object.</p>
<p><strong>setsebool</strong> &#8211; allow to set bool variable. Use with option &#8220;-P&#8221; to make change permanently. Ex. : </p>
<pre>setsebool -P allow_ftpd_anon_write  1 </pre>
<p>This command allow anonymous user write into the ftp directory which open for write. </p>
<p><strong>getsebool</strong> &#8211; with option &#8220;-a&#8221; get all possible variables with current value for each.</p>
<p><strong>semanage</strong> &#8211; most powerful tools which can configure any element without policy sources recompilation. </p>
<p>Also SELinux writes messages into the
<pre>/var/log/messages</pre>
<p>.<br />
SELinux also update coreutils and add to this utils option &#8220;-Z&#8221;. For example we use ordinary coreutils tool <b>ls</b> to check SELinux attribtes for files:</p>
<pre>[root@node2 ~]# ls -Z
-rw-------  root root  system_u:object_r:user_home_t    anaconda-ks.cfg
-rw-r--r--  root root  root:object_r:user_home_t        install.log.syslog
.....
</pre>
<p>Every user in SELinux has at least one role. To list all SELinux roles, run : </p>
<pre>semanage user -l</pre>
<p>To make copy of existing file with new SELinux attributes, use <b>ls</b>:</p>
<pre>cp -Z user:role:type old_file new_file</pre>
<p>To find difference between current attributes and defaults one for an object: </p>
<pre>matchpathcon -V [object] </pre>
<p>To show current user attributes, type . </p>
<pre>id -Z</pre>
<p>To create user with attributes: </p>
<pre>useradd -Z ..</pre>
<p>in case user is already exist:</p>
<pre>semanage login -a -s user_roles user</pre>
<p>To change directory attributes: </p>
<pre>
semanage fcontext -a -t httpd_sys_content_t /www
restorecon -R -v /www/</pre>
<p>To list all port restriction, run </p>
<pre>semanage port -l</pre>
<p>if you want your service listen on non-ordinary port. First, check if the port is not already declared by SELinux. The command described above in cooperation with
<pre>grep</pre>
<p> can help you:</p>
<pre>semanage port -l | grep <your port></pre>
<p>If nothing is appear you can skip next step. Otherwise, delete port from existing group:</p>
<pre>semanage port -d -p tcp 9050</pre>
<p>and put it into your service&#8217;s group:</p>
<pre>semanage port -a -t httpd_port_t -p tcp 9050 </pre>
<p>, where <em>httpd_port_t</em> &#8211; your service&#8217;s group and <em>9050</em> you port.</p>
]]></content:encoded>
			<wfw:commentRss>http://andriigrytsenko.net/2009/07/selinux-tips-and-tricks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OpenVPN connection between two points</title>
		<link>http://andriigrytsenko.net/2009/07/openvpn-connection-between-two-hosts/</link>
		<comments>http://andriigrytsenko.net/2009/07/openvpn-connection-between-two-hosts/#comments</comments>
		<pubDate>Thu, 23 Jul 2009 13:57:49 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[openvpn]]></category>
		<category><![CDATA[vpn]]></category>

		<guid isPermaLink="false">http://andriigrytsenko.net/?p=341</guid>
		<description><![CDATA[We have two host which have to be connected by VPN connection. For our connect I am going to use OpenVPN software.

You can download it here. If you are going to look at OpenVPN more deeply than this post I would like to advice you get information from this source.
There is two machines:

 host node1 [...]]]></description>
			<content:encoded><![CDATA[<p>We have two host which have to be connected by VPN connection. For our connect I am going to use OpenVPN software.</p>
<p><span id="more-341"></span><br />
You can download it <a href="http://openvpn.net/download.html">here</a>. If you are going to look at OpenVPN more deeply than this post I would like to advice you get information from this <a href="http://openvpn.net/index.php/open-source/documentation.html">source</a>.</p>
<p>There is two machines:</p>
<ul>
<li> host node1 server side with debian on board (10.0.2.2)</li>
<li> host node2 client side with centos  (without visible for node1  IP address )</li>
</ul>
<p>First, install and setting up server side:</p>
<pre>node1# apt-get install openvpn
node1# cd /usr/share/doc/openvpn/examples/easy-rsa/2.0
node1# . ./vars</pre>
<p>On next step you will be prompted to ask on simple question before your certificates be generated.</p>
<pre>node1# ./build-ca</pre>
<p>Next generate certificate for server :</p>
<pre>node1# ./build-key-server node1</pre>
<p>I left password request line empty.</p>
<p>Next generate certificate for client:</p>
<pre>node1# ./build-key node2</pre>
<p>The  same actions as for previous step exclude &#8220;Common name&#8221;. Its should be the same to you hostname.</p>
<p>Now generate Diffie Hellman parameters</p>
<pre>node1# ./build-dh</pre>
<p>Here is table about where should be stored certificates and keys files. Which was got by me from official documentation.</p>
<table border="1" cellspacing="0" cellpadding="8">
<tbody>
<tr>
<td><strong>Filename</strong></td>
<td><strong>Needed By</strong></td>
<td><strong>Purpose</strong></td>
<td><strong>Secret</strong></td>
</tr>
<tr>
<td>ca.crt</td>
<td>server + all clients</td>
<td>Root CA certificate</td>
<td>NO</td>
</tr>
<tr>
<td>ca.key</td>
<td>key signing machine only</td>
<td>Root CA key</td>
<td>YES</td>
</tr>
<tr>
<td>dh{n}.pem</td>
<td>server only</td>
<td>Diffie Hellman parameters</td>
<td>NO</td>
</tr>
<tr>
<td>server.crt</td>
<td>server only</td>
<td>Server Certificate</td>
<td>NO</td>
</tr>
<tr>
<td>server.key</td>
<td>server only</td>
<td>Server Key</td>
<td>YES</td>
</tr>
<tr>
<td>client1.crt</td>
<td>client1 only</td>
<td>Client1 Certificate</td>
<td>NO</td>
</tr>
<tr>
<td>client1.key</td>
<td>client1 only</td>
<td>Client1 Key</td>
<td>YES</td>
</tr>
<tr>
<td>client2.crt</td>
<td>client2 only</td>
<td>Client2 Certificate</td>
<td>NO</td>
</tr>
<tr>
<td>client2.key</td>
<td>client2 only</td>
<td>Client2 Key</td>
<td>YES</td>
</tr>
<tr>
<td>client3.crt</td>
<td>client3 only</td>
<td>Client3 Certificate</td>
<td>NO</td>
</tr>
<tr>
<td>client3.key</td>
<td>client3 only</td>
<td>Client3 Key</td>
<td>YES</td>
</tr>
</tbody>
</table>
<p>!!! According to this make sure that all you files located at properly place.</p>
<p>Copy sample config file into the /etc/openvpn:</p>
<pre>node1:# cp /usr/share/doc/openvpn/examples/sample-config-files/server.conf.gz /etc/openvpn/
node1:# cd /etc/openvpn/
node1:# gunzip server.conf.gz</pre>
<p>Also keys and certificates should be copied too:</p>
<pre>node1:# cp /usr/share/doc/openvpn/examples/easy-rsa/2.0/keys/ca.* .
node1:# cp /usr/share/doc/openvpn/examples/easy-rsa/2.0/keys/dh1024.pem .
node1:# cp /usr/share/doc/openvpn/examples/easy-rsa/2.0/keys/node1* .</pre>
<p>Comment out or change value for next lines:</p>
<pre>local 10.0.2.2
cert node1.crt
key node1.key
user nobody
group nogroup
log /var/log/openvpn.log # in this case openvpn doesn't use syslog daemon for logging</pre>
<p>Now it&#8217;s time to start our daemon.</p>
<pre>node1:# /etc/init.d/openvpn start
Starting virtual private network daemon: server.</pre>
<p>If no errors occurred. Check whether interface is up:</p>
<pre>node1:# /sbin/ifconfig tun0
tun0      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet addr:10.8.0.1  P-t-P:10.8.0.2  Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)</pre>
<p>Also it&#8217;s a good idea to check /var/log/openvpn.</p>
<p>Don&#8217;t forget to put daemon start into the boot:</p>
<pre>node1:# update-rc.d openvpn defaults</pre>
<p>Looks like good for server side. Go to the client.</p>
<p>Before you start to install openvpn make sure that next software have been already installed at your box.</p>
<ol>
<li><em>openssl</em></li>
<li><em>lzo</em></li>
<li><em> </em><em>pam</em></li>
</ol>
<p>In my CentOS repository I could not find lzo package :( . Therefore I had to compile it from sources:</p>
<pre>[root@node2]#  wget http://www.oberhumer.com/opensource/lzo/download/lzo-2.03.tar.gz
[root@node2]# tar -xzvf lzo-2.03.tar.gz
[root@node2]# ./configure --enable-shared
[root@node2]# make
[root@node2]# make install</pre>
<p>Now add new path to library&#8217;s paths:</p>
<pre>[root@node2]# echo "/usr/local/lib" &gt; /etc/ld.so.conf.d/lzo.conf
[root@node2]# ldconfig</pre>
<p>Get latest openvpn version from site :</p>
<pre>[root@node2]# wget http://dag.wieers.com/rpm/packages/openvpn/openvpn-2.0.9-1.el5.rf.i386.rpm
[root@node2]# rpm -Uhv --nodeps openvpn-2.0.9-1.el5.rf.i386.rpm</pre>
<p>After this copy config file and edit it:</p>
<pre>[root@node2]# cp /usr/share/doc/openvpn-2.0.9/sample-config-files/client.conf /etc/openvpn/</pre>
<p>copy clients cert and key from server:</p>
<pre>[root@node2]cd /etc/openvpn/
[root@node2]# scp root@node1:/usr/share/doc/openvpn/examples/easy-rsa/2.0/keys/node2* .</pre>
<p>Next lines should be edited:</p>
<pre>remote 10.0.2.2 1194
user nobody
group nobody
cert node2.crt
key node2.key</pre>
<p>Now system is ready to start:</p>
<pre>[root@node2]# /etc/init.d/openvpn start
Starting openvpn:                                          [  OK  ]</pre>
<p>To check is everithing works fine. Identify ip address of virtual interface:</p>
<pre>[root@node2]# ifconfig tun0
tun0      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet addr:10.8.0.6  P-t-P:10.8.0.5  Mask:255.255.255.255
&lt; skipped &gt;</pre>
<p>As you can see it&#8217;s 10.8.0.6. Now try to ping it from server side :</p>
<pre>node1:# ping 10.8.0.6
PING 10.8.0.6 (10.8.0.6) 56(84) bytes of data.
64 bytes from 10.8.0.6: icmp_seq=1 ttl=64 time=0.692 ms</pre>
<p>If you all checks done successful than put script into the autoload:</p>
<pre>[root@node2]# chkconfig --level 35 openvpn on</pre>
<p>To double check it reboot both systems and check that connection is established.</p>
<h3><strong>UPDATE:</strong></h3>
<p>Sometimes you face with the problem when your server located at client side(yes, it&#8217;s really happens time to time) . Therefore you should have some mechanism to keep your connection alive all time. I use next script to do this(please pay attention on red parts &#8211; they must be changed to your conditions):</p>
<pre>#!/bin/bash

function start_vpn {
        cd <span style="color: #ff0000;">/path/where/client.conf/is/located</span>
        sudo /usr/sbin/openvpn --config client.conf &amp;&gt;/dev/null &amp;
        echo "vpn was started at `date +%H:%M:%S' '%d/%m/%y`" &gt;&gt; /var/log/vpn.log
}

server_ext_ip=<span style="color: #ff0000;">/you server external ip/</span>
server_int_ip=<span style="color: #ff0000;">/you server internal ip/</span>
avaib=$(nc -w 5 -z $server_ext_ip 80 &amp;&gt;/dev/null; echo $?)

if [ $avaib -eq 0 ] &amp;&amp; [ ! ping -c 5 $server_int_ip &amp;&gt;/dev/null ]; then
    if ! ps uax | grep -v grep| grep openvpn &amp;&gt;/dev/null; then
        start_vpn
    else
        pid=$(ps uax | grep -v grep| grep openvpn| awk '{print $2}')
        sudo kill $pid
        start_vpn
    fi
fi</pre>
<p>Please make sure that this line is commented out in your /etc/sudoers:</p>
<pre>#Defaults    requiretty</pre>
<p>It&#8217;s makes your sudo works without tty(mean from crontab).</p>
<p>And add new entry to your crontab to run check every minutes.</p>
<pre>crontab -l
*/1 * * * *     /path/to/open.sh</pre>
]]></content:encoded>
			<wfw:commentRss>http://andriigrytsenko.net/2009/07/openvpn-connection-between-two-hosts/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Bash hotkeys</title>
		<link>http://andriigrytsenko.net/2009/07/bash-hotkeys/</link>
		<comments>http://andriigrytsenko.net/2009/07/bash-hotkeys/#comments</comments>
		<pubDate>Wed, 22 Jul 2009 08:39:03 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[*nix]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[bash]]></category>

		<guid isPermaLink="false">http://andriigrytsenko.net/?p=333</guid>
		<description><![CDATA[Here is the table of bash hotkeys.




Hotkey
Function


ctrl-l
clear screen


ctrl-f
forward character


ctrl-b
back character


esc-b
move cursor back by one word


esc-f
move cursor forward by one word


ctrl-r
search backward starting at the current line and moving `up&#8217; through the history as necessary.


ctrl-s
search forward starting at the current line and moving `down&#8217; through the history as necessary.


ctrl-p
fetch the previous command from the history list, [...]]]></description>
			<content:encoded><![CDATA[<p>Here is the table of bash hotkeys.</p>
<p><span id="more-333"></span></p>
<table border="1">
<tbody>
<tr>
<td>Hotkey</td>
<td>Function</td>
</tr>
<tr>
<td>ctrl-l</td>
<td>clear screen</td>
</tr>
<tr>
<td>ctrl-f</td>
<td>forward character</td>
</tr>
<tr>
<td>ctrl-b</td>
<td>back character</td>
</tr>
<tr>
<td>esc-b</td>
<td>move cursor back by one word</td>
</tr>
<tr>
<td>esc-f</td>
<td>move cursor forward by one word</td>
</tr>
<tr>
<td>ctrl-r</td>
<td>search backward starting at the current line and moving `up&#8217; through the history as necessary.</td>
</tr>
<tr>
<td>ctrl-s</td>
<td>search forward starting at the current line and moving `down&#8217; through the history as necessary.</td>
</tr>
<tr>
<td>ctrl-p</td>
<td>fetch the previous command from the history list, moving back in the list.</td>
</tr>
<tr>
<td>ctrl-n</td>
<td>fetch the next command from the history list, moving forward in the list.</td>
</tr>
<tr>
<td>esc-&lt;</td>
<td>move to the first line in the history.</td>
</tr>
<tr>
<td>esc-&gt;</td>
<td>Move to the end line in the history.</td>
</tr>
<tr>
<td>ctrl-u</td>
<td>clear all text from cursor to start of line</td>
</tr>
<tr>
<td>ctrl-a</td>
<td>move to the start of command</td>
</tr>
<tr>
<td>ctrl-e</td>
<td>move to the end of command</td>
</tr>
<tr>
<td>ctrl-w</td>
<td>clear one word back</td>
</tr>
<tr>
<td>esc-\</td>
<td>delete all spaces and tabs around point.</td>
</tr>
<tr>
<td>ctrl-y</td>
<td>yank last cleared word</td>
</tr>
<tr>
<td>esc-y</td>
<td>yank first cleared word</td>
</tr>
<tr>
<td>esc-?</td>
<td>list of possible completions of the text before point. (like double TAB)</td>
</tr>
<tr>
<td>esc-*</td>
<td>insert all possible completions into the line</td>
</tr>
<tr>
<td>ctrl-c</td>
<td>send signal SIGINT to the current process which is interrupt the command</td>
</tr>
<tr>
<td>ctrl-d</td>
<td>kills the shell</td>
</tr>
<tr>
<td>ctrl-h</td>
<td>delete one letter back</td>
</tr>
<tr>
<td>ctrl-z</td>
<td>put process into the background</td>
</tr>
<tr>
<td>esc-p</td>
<td>like ctrl-r lets you search through the previously given commands.</td>
</tr>
<tr>
<td>esc-.</td>
<td>gives the last command you typed.</td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://andriigrytsenko.net/2009/07/bash-hotkeys/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>LVM resizing</title>
		<link>http://andriigrytsenko.net/2009/07/lvm-resizing/</link>
		<comments>http://andriigrytsenko.net/2009/07/lvm-resizing/#comments</comments>
		<pubDate>Mon, 20 Jul 2009 16:15:05 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[fs]]></category>
		<category><![CDATA[lvm]]></category>

		<guid isPermaLink="false">http://andriigrytsenko.net/?p=311</guid>
		<description><![CDATA[How to increase or decrease size of existing lvm partitions step-by-step

!!!Please be very careful with your data. My advice is back your data up before you start 
This tutorial describe only ext3 filesystem. 
REDUCING 
To reduce your lvm partition first of all you have to unmount you partition, re-size filesystem and lvm partition.
Here is our [...]]]></description>
			<content:encoded><![CDATA[<p>How to increase or decrease size of existing lvm partitions step-by-step<br />
<span id="more-311"></span></p>
<p><strong><span style="color: #ff0000;">!!!Please be very careful with your data. My advice is back your data up before you start</span></strong><strong><span style="color: #ff0000;"> </span></strong></p>
<p>This tutorial describe only <span style="color: #ff0000;">ext3 <span style="color: #000000;">filesystem. </span></span></p>
<p style="text-align: center;"><strong><span style="color: #ff0000;"><span style="color: #000000;">REDUCING</span> </span></strong></p>
<p>To reduce your lvm partition first of all you have to unmount you partition, re-size filesystem and lvm partition.</p>
<p>Here is our filesystems:</p>
<pre>[root@lvm ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
2.2G  1.1G  976M  53% /
/dev/hda1              99M   12M   82M  13% /boot
tmpfs                  94M     0   94M   0% /dev/shm
/dev/mapper/VolGroup00-home
1.5G   35M  1.4G   3% /home </pre>
<p>Let&#8217;s reduce our /home partition by 200 MB:</p>
<p>Unmount you partition:</p>
<pre>[root@lvm ~]# umount /home </pre>
<p>Double check that it&#8217;s really unmounted. Its should not appear at
<pre>df</pre>
<p> listing :</p>
<pre>[root@lvm ~]# df -h   |grep home
1.5G 35M 1.4G 3% /home
</pre>
<p>Run check fs tool before you start:</p>
<pre>[root@lvm ~]# e2fsck -f /dev/VolGroup00/home
e2fsck 1.39 (29-May-2006)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/VolGroup00/home: 11/192768 files (9.1% non-contiguous), 14826/385024 blocks</pre>
<p>Now is time for reducing fs:</p>
<pre>[root@lvm ~]# resize2fs /dev/VolGroup00/home 200M
resize2fs 1.39 (29-May-2006)
Resizing the filesystem on /dev/VolGroup00/home to 327680 (4k) blocks.
The filesystem on /dev/VolGroup00/home is now 327680 blocks long.</pre>
<p>Where, last value in command is size.  Its should be equal the total size of partition after reducing(<em>Total_space &#8211; reduced_space = OUR_SIZE</em>).</p>
<p>Now you are ready to run lvm reduce tool:<br />
<em>!!!Be careful on this step and always make backups before you start.</em></p>
<pre>[root@lvm ~]# lvresize -L -200Mg /dev/VolGroup00/home
/dev/hdc: open failed: No medium found
Rounding up size to full physical extent 192.00 MB
WARNING: Reducing active logical volume to 1.28 GB
THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce home? [y/n]: y
Reducing logical volume home to 1.28 GB
Logical volume home successfully resized
</pre>
<p>mount your partition :</p>
<pre>[root@lvm ~]# mount /home</pre>
<p>and check it:</p>
<pre>[root@node2 ~]# [root@lvm ~]# df -h /home
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-home  1.3G   35M  1.2G   3% /home
</pre>
<p>As you can see now our partition is 1.3G. Its on 200MB less then old one.</p>
<p style="text-align: center;"><strong> INCREASING</strong></p>
<p>Currently we have 200MB of unallocated space. Next we divide it on two pieces. From first we make new one partition and second one add to existing root(/) partition.</p>
<p>First lets try to make new one:</p>
<pre>[root@lvm ~]# lvcreate -l 50%FREE --name test VolGroup00
/dev/hdc: open failed: No medium found
Logical volume "test" created
</pre>
<p>And make fs:</p>
<pre>[root@lvm ~]# mkfs -t ext3 /dev/VolGroup00/test
mke2fs 1.39 (29-May-2006)
THE OUTPUT IS SKIPPED.</pre>
<p>Mount and check size of new partition:</p>
<pre>[root@lvm ~]# mkdir /mnt/test
[root@lvm ~]# mount /dev/VolGroup00/test /mnt/test/
[root@lvm ~]# df -h | grep test
/dev/mapper/VolGroup00-test  93M  5.6M   83M   7% /mnt/test
</pre>
<p>Ok. This part is done. Back to our tasks. Lets try to add unallocated  space to root partition:</p>
<pre>[root@lvm ~]# lvextend -l +100%FREE /dev/VolGroup00/LogVol00
/dev/hdc: open failed: No medium found
Extending logical volume LogVol00 to 2.28 GB
Logical volume LogVol00 successfully resized</pre>
<p>TO increase file system, do:</p>
<pre>[root@lvm ~]# resize2fs /dev/VolGroup00/LogVol00
resize2fs 1.39 (29-May-2006)
Filesystem at /dev/VolGroup00/LogVol00 is mounted on /; on-line resizing required
Performing an on-line resize of /dev/VolGroup00/LogVol00 to 598016 (4k) blocks.
The filesystem on /dev/VolGroup00/LogVol00 is now 598016 blocks long.</pre>
<p>And last one steps remount and check:</p>
<pre>[root@lvm ~]# mount -o remount /
[root@lvm ~]# df -h /
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00  2.3G  1.1G  1.1G  51% /</pre>
<p>As we can see in the begging of the actions our root partition was 2.2G and now it&#8217;s 2.3G. This means that it was increased by 100Mb.</p>
]]></content:encoded>
			<wfw:commentRss>http://andriigrytsenko.net/2009/07/lvm-resizing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>NIS and RedHat Linux Mini-HOWTO</title>
		<link>http://andriigrytsenko.net/2009/07/nis-for-redhat-mini-howto/</link>
		<comments>http://andriigrytsenko.net/2009/07/nis-for-redhat-mini-howto/#comments</comments>
		<pubDate>Fri, 17 Jul 2009 10:22:27 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[nis]]></category>
		<category><![CDATA[redhat]]></category>

		<guid isPermaLink="false">http://andriigrytsenko.net/?p=302</guid>
		<description><![CDATA[Here is describe how to configure NIS for the RedHat Linux.

The Network Information Service or NIS (originally called Yellow Pages or YP) consists of a client-server directory service protocol for distributing system configuration data such as user and host names between computers on a computer network.
Before we start  I would like to say couple [...]]]></description>
			<content:encoded><![CDATA[<p>Here is describe how to configure NIS for the RedHat Linux.</p>
<p><span id="more-302"></span></p>
<p>The Network Information Service or NIS (originally called Yellow Pages or YP) consists of a client-server directory service protocol for distributing system configuration data such as user and host names between computers on a computer network.</p>
<p>Before we start  I would like to say couple words about my environment:<br />
- I have to boxes (node2 has ip address 10.0.30.2 and node1 with ip 10.0.30.1)<br />
- node2 used as NIS server and node1 as NIS client<br />
- Both machines uses CentOS</p>
<p>I will divide post on two part. First part will be describe what have to done on the server side and second on the client side.</p>
<p>Let&#8217;s get nis software over yum:</p>
<pre>yum install ypbind
yum install ypserv
yum install yp-tools</pre>
<p>And configure ypserv configuration files:</p>
<pre>vi /etc/ypserv.conf</pre>
<p>The main line is :<br />
<em>Host : Domain : Map : Security </em> , it&#8217;s commented by default<br />
In our server we have next lines:</p>
<pre>10.0.30. : my-net : * : port </pre>
<p>It&#8217;s means that:<br />
- we allow access to our database all machines in subnet 10.0.30.0/24 .<br />
- the name of our nis domain is <em>&#8220;my-net&#8221;</em><br />
- we allow for replicate all files which described at /var/yp/Makefile<br />
- allow access if source port &lt; 1024. Otherwise deny access.</p>
<p>If you want to get more information concerning ypserv.conf, type:</p>
<pre>man ypserv.conf </pre>
<p>Do not forget set variable NISDOMAIN at file /etc/syconfig/network, because your service will not start at next boot:</p>
<pre>echo "NISDOMAIN=\"my_net\"" &gt;&gt; /etc/syconfig/network</pre>
<p>Start server services :</p>
<pre>/etc/init.d/ypserv start
/etc/init.d/yppasswdd start</pre>
<p>and add its to loading scripts :</p>
<pre>chkconfig --level 345 ypserv on
chkconfig --level 345 yppasswdd on</pre>
<p>Where ,<br />
ypserv &#8211; main server<br />
yppasswdd &#8211; password daemon, which allows users change their password in NIS database</p>
<p>Also you need to create <em>/var/yp/securenets</em> file restrict access to your NIS server. To allow acces for subnet 10.0.30.0/24, put next in file:</p>
<pre>255.255.255.0   10.0.30.0</pre>
<p>Use
<pre>man securenets</pre>
<p> to get more details.</p>
<p>Next, generate nis database :</p>
<pre>cd /usr/lib/yp/
./ypinit -m </pre>
<p>you will be prompted to input the name of client servers(they should be declared at <em>/etc/hosts</em>)</p>
<p>Make these steps every time after updating of maped files:</p>
<pre>cd /var/yp/
make </pre>
<p>That all for the first part. Now your server should be work.</p>
<p>Go to the client side.</p>
<p>Install nis client software:</p>
<pre>yum install ypbind</pre>
<p>and switch off SELinux rule which block ypbind running:</p>
<pre># setsebool -P allow_ypbind on</pre>
<p>Edit /etc/yp.conf file. Put into it next string:</p>
<pre>domain my_net server node2</pre>
<p>!!Please make sure that <em>node2</em> is declared at your <em>/etc/hosts</em> file.</p>
<p>Edit lines you want to effected in /etc/nsswitch.conf, like</p>
<pre>passwd: nis files
shadow: nis files</pre>
<p>if you want make common account database for all.</p>
<p>Also as in server side you need to set variable NISDOMAIN at file /etc/syconfig/network:</p>
<pre>echo "NISDOMAIN=\"my_net\"" &gt;&gt; /etc/syconfig/network</pre>
<p>Now, you are ready to run nis client :</p>
<pre>/etc/init.d/ypbind start</pre>
<p>If its started without errors put it in autoload:</p>
<pre>chkconfig --level 345 ypbind on</pre>
<p>Let&#8217;s check out if everything work fine. Go to the server and create new nis user <strong>nis_test_user</strong>:</p>
<pre>adduser nis_test_user
passwd nis_test_user
cd /var/yp
make</pre>
<p>Back to client box and type:</p>
<pre>ypmatch nis_test_user passwd </pre>
<p>and if its work you will get something like that:</p>
<pre>nis_test_user:$1$qMB3FqLy$XbzjESg3Uuse/.5PTRgPJ1:1000:1000::/home/nis_test_user:/bin/bash</pre>
<p>Also you will be able to login as <em>nis_test_user</em> at your box.</p>
<p>To change password for it use:</p>
<pre>yppasswd user</pre>
<p>!!To use this feature daemon yppasswdd on server side has to be running.</p>
<p>The end.</p>
<p>UPD:<br />
use
<pre>ypwhich -m </pre>
<p> to print all mapping files</p>
<pre>ypcat [mapping file]</pre>
<p> &#8211; to print file</p>
]]></content:encoded>
			<wfw:commentRss>http://andriigrytsenko.net/2009/07/nis-for-redhat-mini-howto/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux Kernel from sources for Debian</title>
		<link>http://andriigrytsenko.net/2009/07/linux-kernel-from-sources-for-debian/</link>
		<comments>http://andriigrytsenko.net/2009/07/linux-kernel-from-sources-for-debian/#comments</comments>
		<pubDate>Wed, 15 Jul 2009 10:41:20 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[kernel]]></category>

		<guid isPermaLink="false">http://andriigrytsenko.net/?p=275</guid>
		<description><![CDATA[It&#8217;s useful manual if you want to compile kernel from sources in Debian environment. 

Get all required software over apt-get:
# apt-get install kernel-package ncurses-dev fakeroot wget bzip2 module-init-tools initrd-tools procps
Next, get latest linux kernel from kernel.org : 
# cd /usr/src
# wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.30.tar.bz2
you can also done it over apt-get as well:
# apt-get install linux-source
Extract it: 
# [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s useful manual if you want to compile kernel from sources in Debian environment. </p>
<p><span id="more-275"></span></p>
<p>Get all required software over apt-get:</p>
<pre># apt-get install kernel-package ncurses-dev fakeroot wget bzip2 module-init-tools initrd-tools procps</pre>
<p>Next, get latest linux kernel from kernel.org : </p>
<pre># cd /usr/src
# wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.30.tar.bz2</pre>
<p>you can also done it over apt-get as well:</p>
<pre># apt-get install linux-source</pre>
<p>Extract it: </p>
<pre># tar -xjvf linux-2.6.30.tar.bz2</pre>
<p>and make symbolic link pointed out your sources and go there:</p>
<pre># ln -s linux-2.6.30.tar.bz2 linux
# cd linux</pre>
<p>Configure your new kernel with
<pre>make menuconfig</pre>
<p> or
<pre>make oldconfig</pre>
<p> or
<pre># make xconfig</pre>
<p> and so on. </p>
<p>After you will finished. Run :</p>
<pre># make-kpkg clean
# fakeroot make-kpkg --revision=<em>kernel_name-version</em> kernel_image</pre>
<p>Where is <em>kernel_name-version</em> &#8211; kernel name and version(e.g.: custom-1.0).</p>
<p>If compilation done without errors. Go to the /usr/src and install new kernel over
<pre>dpkg</pre>
<p> tool:</p>
<pre># cd /usr/src
# dpkg -i kernel-image-2.6.30.2_custom-1.0_i386.deb</pre>
<p>Create ramdisk  from new kernel : </p>
<pre># cd /boot/
# mkinitramfs -o /boot/initrd.img-2.6.30 2.6.30</pre>
<p>Last one step is loader configuration. I will describe how to do this for two most popular(grub and lilo) loaders. If you have lilo loader just add new section into the /etc/lilo.conf and edit directive <em>default</em>. Like this: </p>
<pre>default=MYKERN
image=/vmlinuz
        label=MYKERN
        read-only
        initrd=/boot/initrd.img-2.6.30</pre>
<p>Now, install new loader at boot sector: </p>
<pre># lilo -c /etc/lilo.conf</pre>
<p>In case of GRUB loader. Put next section into the <em>/boot/grub/menu.lst</em> file: </p>
<pre>title           My Debian GNU/Linux, kernel 2.6.30
root            (hd0,0)
kernel          /boot/vmlinuz-2.6.30 root=/dev/sda1 ro
initrd          /boot/initrd.img-2.6.30</pre>
<p>For GRUB loader no installs is require. </p>
<p>After loader section done well you have to restart you machine:</p>
<pre># reboot</pre>
<p>Check you current kernel version with <em>uname</em> if during your booting time no problems were occurred:
<pre>
# uname -r
2.6.30</pre>
<p>If it&#8217;s matched with you installed kernel version then you done everything right.   </p>
]]></content:encoded>
			<wfw:commentRss>http://andriigrytsenko.net/2009/07/linux-kernel-from-sources-for-debian/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to compile VirtualBox module</title>
		<link>http://andriigrytsenko.net/2009/07/how-to-make-virtualbox-module/</link>
		<comments>http://andriigrytsenko.net/2009/07/how-to-make-virtualbox-module/#comments</comments>
		<pubDate>Wed, 15 Jul 2009 08:59:24 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[kernel]]></category>
		<category><![CDATA[virtualbox]]></category>

		<guid isPermaLink="false">http://andriigrytsenko.net/?p=271</guid>
		<description><![CDATA[In the event of you repository doesn&#8217;t consist VirtualBox&#8217;s kernel module for your current kernel version. In this post I will describe how to make it manually.

NOTICE: In my case distro is Debian.
My current kernel version is :
# uname -r
2.6.30-1-686
Let&#8217;s  have a look about virtualbox module :
# apt-cache search virtualbox &#124; grep [you_kernel_version]
# 
Nothing [...]]]></description>
			<content:encoded><![CDATA[<p>In the event of you repository doesn&#8217;t consist VirtualBox&#8217;s kernel module for your current kernel version. In this post I will describe how to make it manually.<br />
<span id="more-271"></span></p>
<p>NOTICE: In my case distro is Debian.</p>
<p>My current kernel version is :</p>
<pre># uname -r
2.6.30-1-686</pre>
<p>Let&#8217;s  have a look about virtualbox module :</p>
<pre># apt-cache search virtualbox | grep [you_kernel_version]
# </pre>
<p>Nothing was found. </p>
<p>First of all we have to get kernel sources: </p>
<pre># apt-get install linux-source-[you_kernel_version]</pre>
<p>Go to /usr/src and delete symbolic link <em>linux</em> if it exist: </p>
<pre># cd /usr/src
# rm linux </pre>
<p>extract files from archive and make new one linx:</p>
<pre># tar -xjvf linux-source-2.6.30.tar.bz2
# ln -s linux-source-2.6.30 linux</pre>
<p>Now go to sources and set current configuration:</p>
<pre># cd linux
# make oldconfig &#038;&#038; make prepare</pre>
<p>After finished, run : </p>
<pre># /etc/init.d/vboxdrv setup
Stopping VirtualBox kernel module:done..
Recompiling VirtualBox kernel module:done..
Starting VirtualBox kernel module:done..</pre>
<p>Check is everything done right: </p>
<pre># lsmod | grep -i vbox</pre>
<p>It&#8217;s okay if you get something like this: </p>
<pre>vboxdrv                63936  0</pre>
<p>Now you are ready to run VirtualBox. </p>
]]></content:encoded>
			<wfw:commentRss>http://andriigrytsenko.net/2009/07/how-to-make-virtualbox-module/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
