<?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>jon zobrist (dot) com &#187; Linux Command of the Day</title>
	<atom:link href="http://www.jonzobrist.com/category/linux/lcod/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.jonzobrist.com</link>
	<description>Unix, Linux, IT, Cloud, Meat</description>
	<lastBuildDate>Fri, 06 Jan 2012 18:59:34 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>LCOD &#8211; 7.24.10 &#8211; Get su to respect /etc/security/limits.conf</title>
		<link>http://www.jonzobrist.com/2010/07/24/lcod-7-24-10-get-su-to-respect-etcsecuritylimits-conf/</link>
		<comments>http://www.jonzobrist.com/2010/07/24/lcod-7-24-10-get-su-to-respect-etcsecuritylimits-conf/#comments</comments>
		<pubDate>Sat, 24 Jul 2010 14:00:29 +0000</pubDate>
		<dc:creator>Jon Zobrist</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Linux Command of the Day]]></category>
		<category><![CDATA[Linux Support - Servers]]></category>
		<category><![CDATA[authentication]]></category>
		<category><![CDATA[pam]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://jonzobrist.com/?p=151</guid>
		<description><![CDATA[Get su to respect settings in /etc/security/limits.conf
No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:none;height:30px;'><a class='shareaholic-fblike' data-shr_layout='button_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2010%2F07%2F24%2Flcod-7-24-10-get-su-to-respect-etcsecuritylimits-conf%2F' data-shr_title='LCOD+-+7.24.10+-+Get+su+to+respect+%2Fetc%2Fsecurity%2Flimits.conf'></a><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2010%2F07%2F24%2Flcod-7-24-10-get-su-to-respect-etcsecuritylimits-conf%2F' data-shr_title='LCOD+-+7.24.10+-+Get+su+to+respect+%2Fetc%2Fsecurity%2Flimits.conf'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetTop Automatic --><p>No idea why this isn&#8217;t the default on the latest Ubuntu, as it is for every other service in /etc/pam.d/</p>
<p>Edit /etc/pam.d/su</p>
<p>Find, and uncomment the line that says</p>
<p># session    required   pam_limits.so</p>
<p>Changes take effect on use, so you&#8217;ll have to re-su to get this to take effect.</p>
<div class="shr-publisher-151"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:none;height:30px;'><a class='shareaholic-fblike' data-shr_layout='button_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2010%2F07%2F24%2Flcod-7-24-10-get-su-to-respect-etcsecuritylimits-conf%2F' data-shr_title='LCOD+-+7.24.10+-+Get+su+to+respect+%2Fetc%2Fsecurity%2Flimits.conf'></a><a class='shareaholic-fbsend' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2010%2F07%2F24%2Flcod-7-24-10-get-su-to-respect-etcsecuritylimits-conf%2F'></a><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2010%2F07%2F24%2Flcod-7-24-10-get-su-to-respect-etcsecuritylimits-conf%2F' data-shr_title='LCOD+-+7.24.10+-+Get+su+to+respect+%2Fetc%2Fsecurity%2Flimits.conf'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetBottom Automatic --><p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.jonzobrist.com/2010/07/24/lcod-7-24-10-get-su-to-respect-etcsecuritylimits-conf/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>LCOD &#8211; 7.7.10 &#8211; Rebuilding and checking a Linux software RAID array</title>
		<link>http://www.jonzobrist.com/2010/07/07/lcod-7-7-10-rebuilding-and-checking-a-linux-software-raid-array/</link>
		<comments>http://www.jonzobrist.com/2010/07/07/lcod-7-7-10-rebuilding-and-checking-a-linux-software-raid-array/#comments</comments>
		<pubDate>Wed, 07 Jul 2010 09:26:26 +0000</pubDate>
		<dc:creator>Jon Zobrist</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Linux Command of the Day]]></category>
		<category><![CDATA[Linux Support - Servers]]></category>

		<guid isPermaLink="false">http://jonzobrist.com/?p=144</guid>
		<description><![CDATA[Recovering an unclean ext3 or reiserfs partition when it's on a software RAID array in Linux - HOWTO.
No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:none;height:30px;'><a class='shareaholic-fblike' data-shr_layout='button_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2010%2F07%2F07%2Flcod-7-7-10-rebuilding-and-checking-a-linux-software-raid-array%2F' data-shr_title='LCOD+-+7.7.10+-+Rebuilding+and+checking+a+Linux+software+RAID+array'></a><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2010%2F07%2F07%2Flcod-7-7-10-rebuilding-and-checking-a-linux-software-raid-array%2F' data-shr_title='LCOD+-+7.7.10+-+Rebuilding+and+checking+a+Linux+software+RAID+array'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetTop Automatic --><p>Often times you need to recover a disk manually, as the automatic disk check (fsck) is not willing to risk data deletion. I have yet to find an instance where answering no to it&#8217;s (fsck&#8217;s) many requests to fix things has helped in getting data back, or in getting a server back up and running.</p>
<p>With that in mind, I pretty much always run fsck -y on a filesystem when it&#8217;s unwilling to mount due to an unclean mount (hard reboot/power failure/etc). This has always been done with ext3 or resierfs journaling file systems, and I&#8217;ve yet to notice any data loss, although the risk always exists.</p>
<p>As with any tip online, you proceed at your own risk.</p>
<p>So the standard procedure to recover a disk that won&#8217;t fsck on it&#8217;s own is simple, during it&#8217;s boot process it detects the drive was unmounted uncleanly (this is the default, and every ext2 or 3 drive is marked unclean when it is mounted, and only marked unclean when it is unmounted, the theory being that if it&#8217;s not unmounted then there is potentially lost or corrupt data.), and it starts running fsck on it. It will usually give you a progress indicator, and if fsck finds any problems it drops you to a shell, where you can manually repair the disk, with fsck -y /dev/XXX.</p>
<p>However, it seems, that often if the drive is a Linux software RAID partition, then it simply reboots, and trying to boot into single user mode, or with the drive in read only mode, all fail, and the system either loops a failing fsck, or reboots, or both, ad nausea m.</p>
<p>To the rescue is any Linux live CD. Lately, I prefer a Ubuntu install in live mode, but previously to that I really liked Knoppix. Boot it up, get to a command line, and follow these steps.</p>
<p>Overview is :</p>
<ol>
<li>Boot up and get a root command line, (sudo su / su / single user mode)</li>
<li>Scan the RAID devices and build mdadm.conf file</li>
<li>Assemble each RAID device</li>
<li>fsck -y each RAID device</li>
<li>Reboot into normal / non-live CD mode</li>
<li>Success!</li>
</ol>
<p>Most newer Linux store mdadm.conf in /etc/mdadm/mdadm.conf, some will have it in /etc/mdadm.conf, and some simply won&#8217;t have it.</p>
<p>Use ls to find which one your live CD is using, and then make sure to redirect the output there. This will assume it&#8217;s /etc/mdadm/mdadm.conf</p>
<p>Once booted, at the command prompt, as root, type (assuming you&#8217;re using either RAID-0 or RAID-1, and you have 3 partitions)</p>
<pre>modprobe md
modprobe raid1
modprobe raid0
mdadm --examine --scan &gt;&gt; /etc/mdadm/mdadm.conf
mdadm /dev/md2 --assemble
mdadm /dev/md1 --assemble
mdadm /dev/md0 --assemble
cat /proc/mdstat
#verify your RAID arrays are all disks complete (should show UU)
#now check each one
fsck -y /dev/md0
fsck -y /dev/md1
fsck -y /dev/md2
#now reboot and cross your fingers it all comes up good
reboot
</pre>
<p>Some notes:<br />
If the disk isn&#8217;t heavily used, or you are using ext3 or resierfs, then you stand a decent chance of not losing any data with a fsck -y of the file system.</p>
<p>If the power was lost, or the machine locked up you may lose the last little bit of data, even on a journaled file system.</p>
<p>RAID-1 is awesome, and this can be done with a software RAID-1 even if one of the drives is failed. You can also just mount the disk without RAID, and operate as if it never was in an array.</p>
<p>You can do other maintenance on the drives, such as mount them (mount /dev/md2 /mnt/md2) and modify/copy/backup data/etc instead of, or in addition to, fsck&#8217;ing them.</p>
<p>I&#8217;ve had the best luck with ext3 and resierfs. I&#8217;ve read bad things about XFS, JFS, and other file systems.</p>
<p>I would love for Linux to support ZFS, as I&#8217;ve played with it on Open Solaris, and Sun&#8217;s VM of their storage appliance, and it seems nice.</p>
<p>Enjoy!</p>
<div class="shr-publisher-144"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:none;height:30px;'><a class='shareaholic-fblike' data-shr_layout='button_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2010%2F07%2F07%2Flcod-7-7-10-rebuilding-and-checking-a-linux-software-raid-array%2F' data-shr_title='LCOD+-+7.7.10+-+Rebuilding+and+checking+a+Linux+software+RAID+array'></a><a class='shareaholic-fbsend' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2010%2F07%2F07%2Flcod-7-7-10-rebuilding-and-checking-a-linux-software-raid-array%2F'></a><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2010%2F07%2F07%2Flcod-7-7-10-rebuilding-and-checking-a-linux-software-raid-array%2F' data-shr_title='LCOD+-+7.7.10+-+Rebuilding+and+checking+a+Linux+software+RAID+array'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetBottom Automatic --><p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.jonzobrist.com/2010/07/07/lcod-7-7-10-rebuilding-and-checking-a-linux-software-raid-array/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>LCOD – 5.26.10 – Compare 2 directories</title>
		<link>http://www.jonzobrist.com/2010/05/26/lcod-5-26-10-compare-2-directories/</link>
		<comments>http://www.jonzobrist.com/2010/05/26/lcod-5-26-10-compare-2-directories/#comments</comments>
		<pubDate>Wed, 26 May 2010 22:50:04 +0000</pubDate>
		<dc:creator>Jon Zobrist</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Linux Command of the Day]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[compare]]></category>
		<category><![CDATA[md5]]></category>
		<category><![CDATA[md5sum]]></category>
		<category><![CDATA[rsync]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[sync]]></category>

		<guid isPermaLink="false">http://jonzobrist.com/2010/05/26/lcod-5-26-10-compare-2-directories/</guid>
		<description><![CDATA[md5sum * &#124; md5sum This will return an md5sum which will look something like 9277826461d2cb19731f6201c6b2c6b3 - Run it in 2 directories, if the sums of the sums match, the files are identical. If not, you may want to rsync between them with something like rsync-avz -e ssh localdir/ user@remotehost:/remotedir/ or rsync-avz -e ssh user@remotehost:/remotedir/ localdir/ [...]
No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:none;height:30px;'><a class='shareaholic-fblike' data-shr_layout='button_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2010%2F05%2F26%2Flcod-5-26-10-compare-2-directories%2F' data-shr_title='LCOD+%E2%80%93+5.26.10+%E2%80%93+Compare+2+directories'></a><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2010%2F05%2F26%2Flcod-5-26-10-compare-2-directories%2F' data-shr_title='LCOD+%E2%80%93+5.26.10+%E2%80%93+Compare+2+directories'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetTop Automatic --><p>md5sum * | md5sum</p>
<p>This will return an md5sum which will look something like<br />
9277826461d2cb19731f6201c6b2c6b3  -</p>
<p>Run it in 2 directories, if the sums of the sums match, the files are identical.<br />
If not, you may want to rsync between them with something like<br />
rsync-avz -e ssh localdir/ user@remotehost:/remotedir/<br />
or<br />
rsync-avz -e ssh user@remotehost:/remotedir/ localdir/</p>
<div class="shr-publisher-125"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:none;height:30px;'><a class='shareaholic-fblike' data-shr_layout='button_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2010%2F05%2F26%2Flcod-5-26-10-compare-2-directories%2F' data-shr_title='LCOD+%E2%80%93+5.26.10+%E2%80%93+Compare+2+directories'></a><a class='shareaholic-fbsend' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2010%2F05%2F26%2Flcod-5-26-10-compare-2-directories%2F'></a><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2010%2F05%2F26%2Flcod-5-26-10-compare-2-directories%2F' data-shr_title='LCOD+%E2%80%93+5.26.10+%E2%80%93+Compare+2+directories'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetBottom Automatic --><p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.jonzobrist.com/2010/05/26/lcod-5-26-10-compare-2-directories/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>LCOD – 4.12.10 – Quick Mysqlreport to e-mail setup</title>
		<link>http://www.jonzobrist.com/2010/04/12/lcod-%e2%80%93-4-12-10-%e2%80%93-quick-mysqlreport-to-e-mail-setup/</link>
		<comments>http://www.jonzobrist.com/2010/04/12/lcod-%e2%80%93-4-12-10-%e2%80%93-quick-mysqlreport-to-e-mail-setup/#comments</comments>
		<pubDate>Tue, 13 Apr 2010 00:31:57 +0000</pubDate>
		<dc:creator>Jon Zobrist</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Linux Command of the Day]]></category>
		<category><![CDATA[MySQL Server Support]]></category>
		<category><![CDATA[admin]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Perl]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[tip]]></category>

		<guid isPermaLink="false">http://jonzobrist.com/?p=118</guid>
		<description><![CDATA[This will be a quick install to setup your server to e-mail you daily mysql reports using the cool mysqlreport application at hackmysql.com
No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:none;height:30px;'><a class='shareaholic-fblike' data-shr_layout='button_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2010%2F04%2F12%2Flcod-%25e2%2580%2593-4-12-10-%25e2%2580%2593-quick-mysqlreport-to-e-mail-setup%2F' data-shr_title='LCOD+%E2%80%93+4.12.10+%E2%80%93+Quick+Mysqlreport+to+e-mail+setup'></a><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2010%2F04%2F12%2Flcod-%25e2%2580%2593-4-12-10-%25e2%2580%2593-quick-mysqlreport-to-e-mail-setup%2F' data-shr_title='LCOD+%E2%80%93+4.12.10+%E2%80%93+Quick+Mysqlreport+to+e-mail+setup'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetTop Automatic --><p>This will be a quick install to setup your server to e-mail you daily mysql reports using the cool mysqlreport application at <a title="MySQL Report" href="http://hackmysql.com/mysqlreport">hackmysql.com</a></p>
<p>As the user you want to set this up on, run the following commands.</p>
<p>(Note that I touch and then chmod og-rwx the .my.cnf file, since you&#8217;re putting your users mysql password in it, creating it and making it unreadable before editing is always a good idea.)</p>
<pre>wget http://hackmysql.com/scripts/mysqlreport
chmod uog+x mysqlreport
mkdir bin logs
mv mysqlreport bin/
touch ~/.my.cnf
chmod og-rwx ~/.my.cnf
vi ~/.my.cnf
</pre>
<p>Now, put in a client section like this in, you can find your sock file with grep sock /etc/my.cnf, or grep sock /etc/mysql/my.cnf</p>
<pre>[client]</pre>
<pre>user="root"</pre>
<pre>password="password"</pre>
<pre>socket=/var/run/mysqld/mysqld.sock</pre>
<p>Now, install perl&#8217;s DBD::MySQL</p>
<p>Debian/Ubuntu:</p>
<pre>sudo su</pre>
<pre>apt-get install libdbd-mysql-perl</pre>
<p>via CPAN/Other Linux/Generic BSD:</p>
<pre>perl -MCPAN -e shell</pre>
<p>Optional, update CPAN:</p>
<pre>install Bundle::CPAN</pre>
<pre>reload cpan</pre>
<p>(If there are errors on following some dependencies exit, and restart your CPAN shell, then start with install Bundle::CPAN)<br />
Install perl DBI</p>
<pre>install DBD::mysql
exit
</pre>
<p>Now, run it to test, you should see a bunch of text output</p>
<pre>~/bin/mysqlreport
</pre>
<p>Now, set it up to run from cron</p>
<pre>
crontab -e
</pre>
<p>Add a line like this (this will email to test@example.com a full report nightly at midnight, and put the last nights report in /home/USERNAME/logs/mysqlreport)</p>
<pre>
0 0 * * * /home/USERNAME/bin/mysqlreport --email test@example.com &gt; /home/USERNAME/logs/mysqlreport.log 2&gt;&amp;1
</pre>
<div class="shr-publisher-118"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:none;height:30px;'><a class='shareaholic-fblike' data-shr_layout='button_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2010%2F04%2F12%2Flcod-%25e2%2580%2593-4-12-10-%25e2%2580%2593-quick-mysqlreport-to-e-mail-setup%2F' data-shr_title='LCOD+%E2%80%93+4.12.10+%E2%80%93+Quick+Mysqlreport+to+e-mail+setup'></a><a class='shareaholic-fbsend' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2010%2F04%2F12%2Flcod-%25e2%2580%2593-4-12-10-%25e2%2580%2593-quick-mysqlreport-to-e-mail-setup%2F'></a><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2010%2F04%2F12%2Flcod-%25e2%2580%2593-4-12-10-%25e2%2580%2593-quick-mysqlreport-to-e-mail-setup%2F' data-shr_title='LCOD+%E2%80%93+4.12.10+%E2%80%93+Quick+Mysqlreport+to+e-mail+setup'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetBottom Automatic --><p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.jonzobrist.com/2010/04/12/lcod-%e2%80%93-4-12-10-%e2%80%93-quick-mysqlreport-to-e-mail-setup/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>LCOD &#8211; 11.17.09 &#8211; Simple page/alert email script</title>
		<link>http://www.jonzobrist.com/2009/11/17/lcod-11-17-09-simple-pagealert-email-script/</link>
		<comments>http://www.jonzobrist.com/2009/11/17/lcod-11-17-09-simple-pagealert-email-script/#comments</comments>
		<pubDate>Wed, 18 Nov 2009 05:52:37 +0000</pubDate>
		<dc:creator>Jon Zobrist</dc:creator>
				<category><![CDATA[Bash]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Linux Command of the Day]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[admin]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[cli]]></category>
		<category><![CDATA[script]]></category>

		<guid isPermaLink="false">http://jonzobrist.com/?p=100</guid>
		<description><![CDATA[Here&#8217;s a quick page script for *nix boxes with mail. I grabbed the mail / file redirect from http://theos.in/shell-scripting/send-mail-bash-script/ #!/bin/bash #Author : dougnaka@gmail.comThis e-mail address is being protected from spam bots, you need JavaScript enabled to view it #Description : Quick alert/page script, edit EMAIL="" to include a comma separated list of emails to send [...]
No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:none;height:30px;'><a class='shareaholic-fblike' data-shr_layout='button_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2009%2F11%2F17%2Flcod-11-17-09-simple-pagealert-email-script%2F' data-shr_title='+LCOD+-+11.17.09+-+Simple+page%2Falert+email+script+'></a><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2009%2F11%2F17%2Flcod-11-17-09-simple-pagealert-email-script%2F' data-shr_title='+LCOD+-+11.17.09+-+Simple+page%2Falert+email+script+'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetTop Automatic --><p>Here&#8217;s a quick page script for *nix boxes with mail.<br />
I grabbed the mail / file redirect from</p>
<p>http://theos.in/shell-scripting/send-mail-bash-script/</p>
<p><code><br />
#!/bin/bash<br />
#Author : dougnaka@gmail.comThis e-mail address is being protected from spam bots, you need JavaScript enabled to view it<br />
#Description : Quick alert/page script, edit EMAIL="" to include a comma separated list of emails to send to<br />
#Usage : page.sh "Short or long message"<br />
if [ "${1}" ]<br />
 then<br />
  SUBJECT="[ALERT] ${1}"<br />
  EMAIL=" someone@example.com"<br />
  EMAILMESSAGE="/tmp/`date +%s`-message"<br />
  echo "ALERT: at `date`" > ${EMAILMESSAGE}<br />
  echo "${1}" >> ${EMAILMESSAGE}<br />
  echo "From `hostname`" >> ${EMAILMESSAGE}<br />
  mail -s "${SUBJECT}" "${EMAIL}" < ${EMAILMESSAGE}<br />
  /bin/rm ${EMAILMESSAGE}<br />
else<br />
 echo "Usage: ${0} MESSAGE"<br />
 exit 1<br />
fi<br />
</code></p>
<div class="shr-publisher-100"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:none;height:30px;'><a class='shareaholic-fblike' data-shr_layout='button_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2009%2F11%2F17%2Flcod-11-17-09-simple-pagealert-email-script%2F' data-shr_title='+LCOD+-+11.17.09+-+Simple+page%2Falert+email+script+'></a><a class='shareaholic-fbsend' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2009%2F11%2F17%2Flcod-11-17-09-simple-pagealert-email-script%2F'></a><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2009%2F11%2F17%2Flcod-11-17-09-simple-pagealert-email-script%2F' data-shr_title='+LCOD+-+11.17.09+-+Simple+page%2Falert+email+script+'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetBottom Automatic --><p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.jonzobrist.com/2009/11/17/lcod-11-17-09-simple-pagealert-email-script/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>LCOD 10.9.09 &#8211; Script to retry command</title>
		<link>http://www.jonzobrist.com/2009/10/09/lcod-10-9-09-script-to-retry-command/</link>
		<comments>http://www.jonzobrist.com/2009/10/09/lcod-10-9-09-script-to-retry-command/#comments</comments>
		<pubDate>Sat, 10 Oct 2009 05:50:56 +0000</pubDate>
		<dc:creator>Jon Zobrist</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Linux Command of the Day]]></category>
		<category><![CDATA[cli]]></category>
		<category><![CDATA[command line]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://jonzobrist.com/?p=98</guid>
		<description><![CDATA[I use this almost exclusively with trying to ssh to a machine that&#8217;s rebooting, but it&#8217;s useful to have, and, I think, should be included as a default command in any Linux distro. Script : retry Usage : retry command [args] Code : #!/bin/bash while true do echo "trying $@ at `date`" $@ sleep 1 [...]
No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:none;height:30px;'><a class='shareaholic-fblike' data-shr_layout='button_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2009%2F10%2F09%2Flcod-10-9-09-script-to-retry-command%2F' data-shr_title='LCOD+10.9.09+-+Script+to+retry+command+'></a><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2009%2F10%2F09%2Flcod-10-9-09-script-to-retry-command%2F' data-shr_title='LCOD+10.9.09+-+Script+to+retry+command+'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetTop Automatic --><p>I use this almost exclusively with trying to ssh to a machine that&#8217;s rebooting, but it&#8217;s useful to have, and, I think, should be included as a default command in any Linux distro.</p>
<p>Script : retry<br />
Usage : retry command [args]</p>
<p>Code :<br />
<code><br />
#!/bin/bash<br />
while true<br />
 do<br />
  echo "trying $@ at `date`"<br />
  $@<br />
  sleep 1<br />
done<br />
</code></p>
<p>Enjoy.</p>
<div class="shr-publisher-98"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:none;height:30px;'><a class='shareaholic-fblike' data-shr_layout='button_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2009%2F10%2F09%2Flcod-10-9-09-script-to-retry-command%2F' data-shr_title='LCOD+10.9.09+-+Script+to+retry+command+'></a><a class='shareaholic-fbsend' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2009%2F10%2F09%2Flcod-10-9-09-script-to-retry-command%2F'></a><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2009%2F10%2F09%2Flcod-10-9-09-script-to-retry-command%2F' data-shr_title='LCOD+10.9.09+-+Script+to+retry+command+'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetBottom Automatic --><p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.jonzobrist.com/2009/10/09/lcod-10-9-09-script-to-retry-command/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>LCOD &#8211; 6.18.09 Useful command line grepping (grep!)</title>
		<link>http://www.jonzobrist.com/2009/06/18/lcod-6-18-09-useful-command-line-grepping-grep/</link>
		<comments>http://www.jonzobrist.com/2009/06/18/lcod-6-18-09-useful-command-line-grepping-grep/#comments</comments>
		<pubDate>Fri, 19 Jun 2009 05:49:45 +0000</pubDate>
		<dc:creator>Jon Zobrist</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Linux Command of the Day]]></category>
		<category><![CDATA[cli]]></category>
		<category><![CDATA[command line]]></category>
		<category><![CDATA[grep]]></category>

		<guid isPermaLink="false">http://jonzobrist.com/?p=96</guid>
		<description><![CDATA[There are a few regular expressions I find myself using all the time via grep on the command line. Here are a few, along with a few frequently used commands I can&#8217;t live without. Find the non comment parts of a file. (Useful if you want to see or compare the active parts of a [...]
No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:none;height:30px;'><a class='shareaholic-fblike' data-shr_layout='button_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2009%2F06%2F18%2Flcod-6-18-09-useful-command-line-grepping-grep%2F' data-shr_title='LCOD+-+6.18.09+Useful+command+line+grepping+%28grep%21%29+'></a><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2009%2F06%2F18%2Flcod-6-18-09-useful-command-line-grepping-grep%2F' data-shr_title='LCOD+-+6.18.09+Useful+command+line+grepping+%28grep%21%29+'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetTop Automatic --><p>There are a few regular expressions I find myself using all the time via grep on the command line. Here are a few, along with a few frequently used commands I can&#8217;t live without.</p>
<p>Find the non comment parts of a file.<br />
(Useful if you want to see or compare the active parts of a config file.)<br />
Most Unix config files use # as a comment tag, indicating everything after the # is a comment.<br />
 grep &#8216;^[^#]&#8216; filename.conf</p>
<p>To break this down, first we have grep , which is a command line program to find lines that match a regular expression pattern, and display them. The single quotes indicate that we&#8217;re passing the entire section enclosed in single quotes as the first argument, which doesn&#8217;t matter as much in this example, but it&#8217;s good to practice, so when you have a space or some other character, you won&#8217;t be confused when your shell interprits it. The regular expression used is<br />
^[^#]<br />
Which is slightly trick, as far as regular expressions go, for only one reason; the character ^ is used twice, with different meanings.<br />
Normally the ^ is regular expression for the start of a line, and we use it here as this, the first time. The second time, inside the brackets, it means NOT.<br />
Brackets in regular expressions are like a giant OR statement, with every non-escape character (like the forward slash / ) as a possible match. This can hang people up when they expect [bob] to match the full word bob, instead of just the first b.<br />
Then we have the #, which just matches our comment character, #.<br />
Then the closing bracket, since we&#8217;re not doing any other options.<br />
The net result of this is to match any line that has a # right after the start of the line.</p>
<p>To do the same thing on a config file that uses a ; as a comment indicator:<br />
grep &#8216;^[;]&#8216; filename.conf</p>
<p>OR, to be even trickier, you could just add the # and ; in the same set of brackets, like<br />
grep &#8216;^[;#] fliename.conf</p>
<p>Note the order of items inside the bracket doesn&#8217;t really matter in this case.</p>
<p>Next, often times I have a file with a bunch of empty lines in it, and I want to quickly get rid of them all. To do this I use a combination of a simple grep and a output redirect.</p>
<p>grep . filename<br />
The . character is a regular expression match for any character, but it won&#8217;t match empty lines (the regular expression ^$ does though).<br />
To get this into the file, first redirect it to a new file, then move the file back.<br />
 grep . filename > newfile<br />
mv newfile filename</p>
<p>or, if you want to sort, just run<br />
sort newfile > filename</p>
<p>perhaps you now want to just get the unique lines<br />
uniq newfile > filename</p>
<p>Of course, I should mention the very obvious ones.<br />
Grepping for words in files.</p>
<p>grep Word filename</p>
<p>Note that grep is case sensitive, but you can turn that off with the -i flag.</p>
<p> grep -i word filename</p>
<p>There is an infinite amount of uses for grep, but the foundation for grep/sed/awk/perl use for patterns is regular expressions. More than any single book I&#8217;ve read about techonlogy, the O&#8217;Reilly book &#8220;Mastering Regular Expressions&#8221;, by Jeffrey Friedl has helped me the most in my IT career. I highly suggest you buy and read it.</p>
<div class="shr-publisher-96"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:none;height:30px;'><a class='shareaholic-fblike' data-shr_layout='button_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2009%2F06%2F18%2Flcod-6-18-09-useful-command-line-grepping-grep%2F' data-shr_title='LCOD+-+6.18.09+Useful+command+line+grepping+%28grep%21%29+'></a><a class='shareaholic-fbsend' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2009%2F06%2F18%2Flcod-6-18-09-useful-command-line-grepping-grep%2F'></a><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2009%2F06%2F18%2Flcod-6-18-09-useful-command-line-grepping-grep%2F' data-shr_title='LCOD+-+6.18.09+Useful+command+line+grepping+%28grep%21%29+'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetBottom Automatic --><p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.jonzobrist.com/2009/06/18/lcod-6-18-09-useful-command-line-grepping-grep/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>LCOD 2.23.09 Setup Polycom Soundstation 6000 w/Asterisk</title>
		<link>http://www.jonzobrist.com/2009/02/23/lcod-2-23-09-setup-polycom-soundstation-6000-wasterisk/</link>
		<comments>http://www.jonzobrist.com/2009/02/23/lcod-2-23-09-setup-polycom-soundstation-6000-wasterisk/#comments</comments>
		<pubDate>Tue, 24 Feb 2009 05:48:07 +0000</pubDate>
		<dc:creator>Jon Zobrist</dc:creator>
				<category><![CDATA[Asterisk]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Linux Command of the Day]]></category>
		<category><![CDATA[VoiP]]></category>

		<guid isPermaLink="false">http://jonzobrist.com/?p=94</guid>
		<description><![CDATA[Setup/install notes, Polycom Soundstation IP 6000 with Asterisk 1.4 Have tftp setup, in this we use /tftpboot as the main tftp folder, and it&#8217;s world readable/writable, (LIMIT ACCESS VIA IPTABLES/FIREWALL/SOMETHING) Have a dhcp server setup that&#8217;s giving out the normal things for SIP phones, option tftp-server-name &#8220;[ASTERISK-SERVER-IP"; option time-offset -23400; # Mountain Standard Time option [...]
No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:none;height:30px;'><a class='shareaholic-fblike' data-shr_layout='button_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2009%2F02%2F23%2Flcod-2-23-09-setup-polycom-soundstation-6000-wasterisk%2F' data-shr_title='LCOD+2.23.09+Setup+Polycom+Soundstation+6000+w%2FAsterisk+'></a><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2009%2F02%2F23%2Flcod-2-23-09-setup-polycom-soundstation-6000-wasterisk%2F' data-shr_title='LCOD+2.23.09+Setup+Polycom+Soundstation+6000+w%2FAsterisk+'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetTop Automatic --><p>Setup/install notes, Polycom Soundstation IP 6000 with Asterisk 1.4</p>
<p>Have tftp setup, in this we use /tftpboot as the main tftp folder, and it&#8217;s world readable/writable, (LIMIT ACCESS VIA IPTABLES/FIREWALL/SOMETHING)<br />
Have a dhcp server setup that&#8217;s giving out the normal things for SIP phones,<br />
  option tftp-server-name &#8220;[ASTERISK-SERVER-IP";<br />
  option time-offset              -23400; # Mountain Standard Time<br />
  option ntp-servers              10.0.2.1;</p>
<p>Have asterisk up and running, make a SIP extension/entry like you would for a normal SIP client, although don't use type=friend, use type=peer<br />
like this for extension 101, username 101, password temp<br />
[101]<br />
type=peer<br />
username=101<br />
secret=temp<br />
host=dynamic<br />
context=[your default context for phones]<br />
qualify=150<br />
accountcode=[optional accounting code]<br />
mailbox=[extension for mailbox]</p>
<p>reload asterisk&#8217;s sip module<br />
asterisk -vvvngrd<br />
asterisk*>CLI>sip reload</p>
<p>Setup the Polycom:<br />
download the latest rpm for firmware for trixbox from</p>
<p>http://yum.trixbox.org/centos/5/RPMS/</p>
<p>this time it was:</p>
<p>http://yum.trixbox.org/centos/5/RPMS/firmware-polycom-3.0.1-2.noarch.rpm</p>
<p>unzip this, put the tftpboot files into your tftpboot dir, put the setup-polycom.rpm_tmp_update in<br />
/usr/local/sbin/setup-polycom.rpm_tmp_update</p>
<p>check which NIC your asterisk interface system is on and run<br />
/usr/local/sbin/setup-polycom.rpm_tmp_update</p>
<p>(my ntp server doesn&#8217;t like our SIP clients sntp requests, so I use time.nist.gov and nat that outbound for the phones)<br />
edit /tftpboot/server.cfg<br />
change<br />
   tcpIpApp.sntp.address=&#8221;192.43.244.18&#8243;</p>
<p>Now download the latest version of the sip firwmare from polycom</p>
<p>http://downloads.polycom.com/voice/voip/sp_ss_sip/spip_ssip_3_1_2_release_sig_combined.zip</p>
<p>unzip and put all the files in /tftpboot/</p>
<p>edit /tftpboot/000000000000.cfg<br />
add server.cfg on the CONFIG_FILES line, so mine looks like this<br />
<APPLICATION APP_FILE_PATH="sip.ld" CONFIG_FILES="server.cfg, phone1.cfg, sip.cfg" MISC_FILES="" LOG_FILE_DIRECTORY="" OVERRIDES_DIRECTORY="" CONTACTS_DIRECTORY="" LICENSE_DIRECTORY=""></p>
<p>note there were 2 other application lines but i left them the same as they looked like they were for SPIP300/500&#8242;s</p>
<p>now, per conference phone, copy the /tftpboot/000000000000.cfg to /tftpboot/[phone mac address].cfg<br />
the mac address is also the serial number of the phone (on the back!)<br />
I&#8217;m not sure if it&#8217;s case sensitive but I did all lower case and it worked, tail your tftp servers logs to see what&#8217;s getting requested.</p>
<p>edit the /tftpboot/[phone mac address].cfg<br />
on the line where you added server.cfg, add a custom config for this device, calling it whatever you want, so if you wanted, call it conference1.cfg, your application line would look like:<br />
<APPLICATION APP_FILE_PATH="sip.ld" CONFIG_FILES="conference1.cfg, server.cfg, phone1.cfg, sip.cfg" MISC_FILES="" LOG_FILE_DIRECTORY="" OVERRIDES_DIRECTORY="" CONTACTS_DIRECTORY="" LICENSE_DIRECTORY=""></p>
<p>now edit that file /tftpboot/conference1.cfg (or whatever you called it)<br />
username and password should match what you put in asterisk&#8217;s sip.conf<br />
it should look something like this</p>
<p><?xml version="1.0" encoding="UTF-8" standalone="yes"?><br />
<!-- Per-phone configuration in this file --><br />
<reginfo><br />
  <reg<br />
        reg.1.displayName="PhoneName"<br />
        reg.1.address="101"<br />
        reg.1.label="101"<br />
        reg.1.auth.userId="101"<br />
        reg.1.auth.password="password"<br />
        reg.1.lineKeys="6"<br />
   /><br />
</reginfo></p>
<p>I mostly followed the directions from here (I am using a self compiled asterisk, version 1.4.19.1 on Gentoo Linux, not trixbox)</p>
<p>http://www.sureteq.com/asterisk/polycom.htm</p>
<p>and used the following links for reference:</p>
<p>http://www.voip-info.org/wiki/view/polycom+trixbox</p>
<p>http://www.voip-info.org/wiki/view/Polycom+Phones</p>
<p>http://www.polycom.com/support/voice/soundstation_ip_series/soundstation_ip6000.html</p>
<p>http://blog.voipsupply.com/new-products/polycom-sip-firmware-31-released-whats-in-it-for-me</p>
<p>http://blog.voipsupply.com/voip-software/unleash-your-polycom-soundpoint-ip-phone%e2%80%a6introducing-the-polycom-productivity-suite-package</p>
<p>http://yum.trixbox.org/centos/5/RPMS/repodata/repoview/firmware-polycom-0-3.0.1-2.html</p>
<p>http://www.voip-info.org/wiki/view/Asterisk%40Home+Handbook+Wiki+Chapter+7#7224HowtouseProvisioningCentralBootServe</p>
<p>http://www.asteriskvoipnews.com/polycom/polycom_releases_soundstation_ip_7000_and_ip_6000_conference_phone.html</p>
<div class="shr-publisher-94"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:none;height:30px;'><a class='shareaholic-fblike' data-shr_layout='button_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2009%2F02%2F23%2Flcod-2-23-09-setup-polycom-soundstation-6000-wasterisk%2F' data-shr_title='LCOD+2.23.09+Setup+Polycom+Soundstation+6000+w%2FAsterisk+'></a><a class='shareaholic-fbsend' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2009%2F02%2F23%2Flcod-2-23-09-setup-polycom-soundstation-6000-wasterisk%2F'></a><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2009%2F02%2F23%2Flcod-2-23-09-setup-polycom-soundstation-6000-wasterisk%2F' data-shr_title='LCOD+2.23.09+Setup+Polycom+Soundstation+6000+w%2FAsterisk+'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetBottom Automatic --><p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.jonzobrist.com/2009/02/23/lcod-2-23-09-setup-polycom-soundstation-6000-wasterisk/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>LCOD &#8211; 8.3.08 Get around annoying reboot during fdisk</title>
		<link>http://www.jonzobrist.com/2008/08/03/lcod-8-3-08-get-around-annoying-reboot-during-fdisk/</link>
		<comments>http://www.jonzobrist.com/2008/08/03/lcod-8-3-08-get-around-annoying-reboot-during-fdisk/#comments</comments>
		<pubDate>Mon, 04 Aug 2008 05:47:18 +0000</pubDate>
		<dc:creator>Jon Zobrist</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Linux Command of the Day]]></category>
		<category><![CDATA[admin]]></category>
		<category><![CDATA[fdisk]]></category>

		<guid isPermaLink="false">http://jonzobrist.com/?p=92</guid>
		<description><![CDATA[Do you ever try to reformat / repartition disks and Linux complains the kernel is still using the old table and you have to REBOOT (a sin on any *NIX) to fix this? The error is &#8220;WARNING: Re-reading the partition table failed with error 16: Device or resource busy. The kernel still uses the old [...]
No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:none;height:30px;'><a class='shareaholic-fblike' data-shr_layout='button_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2008%2F08%2F03%2Flcod-8-3-08-get-around-annoying-reboot-during-fdisk%2F' data-shr_title='LCOD+-+8.3.08+Get+around+annoying+reboot+during+fdisk+'></a><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2008%2F08%2F03%2Flcod-8-3-08-get-around-annoying-reboot-during-fdisk%2F' data-shr_title='LCOD+-+8.3.08+Get+around+annoying+reboot+during+fdisk+'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetTop Automatic --><p>Do you ever try to reformat / repartition disks and Linux complains the kernel is still using the old table and you have to REBOOT (a sin on any *NIX) to fix this?<br />
The error is &#8220;WARNING: Re-reading the partition table failed with error 16: Device or resource busy.<br />
The kernel still uses the old table.<br />
The new table will be used at the next reboot.&#8221;</p>
<p>This annoys me, what was happening on my Ubuntu 7.10 computer was I had a disk that used to be Linux and I put it into a USB / Firewire enclosure and fdisk&#8217;d it and then formatted it, but the automounter sees the partition exists as soon as the kernel rereads the partition table and mounts it. This isn&#8217;t safe or a good idea really, so, if you&#8217;re going to nuke a disk you should zero out any previous partitions by nuking the master partition table.</p>
<p>THIS IS A POTENTIALLY DANGEROUS OPERATION, YOU PROCEED AT YOUR OWN RISK, I WILL NOT ASSUME LIABILITY FOR LOST DATA OR ANY DAMAGES.</p>
<p>Ok, so make 100% absolutely sure you know the drive letter you&#8217;re getting with something like</p>
<p>dmesg | tail</p>
<p>and you&#8217;ll see something like</p>
<p> sd 18:0:0:0: [sdf] 488397168 512-byte hardware sectors (250059 MB)<br />
[3010413.606563] sd 18:0:0:0: [sdf] Test WP failed, assume Write Enabled<br />
[3010413.606568] sd 18:0:0:0: [sdf] Assuming drive cache: write through<br />
[3010413.607559] sd 18:0:0:0: [sdf] 488397168 512-byte hardware sectors (250059 MB)<br />
[3010413.608807] sd 18:0:0:0: [sdf] Test WP failed, assume Write Enabled<br />
[3010413.608811] sd 18:0:0:0: [sdf] Assuming drive cache: write through<br />
[3010413.608815]  sdf: sdf1 sdf2 < sdf5 ><br />
[3010413.651837] sd 18:0:0:0: [sdf] Attached SCSI disk<br />
[3010413.651880] sd 18:0:0:0: Attached scsi generic sg5 type 0<br />
[3010415.111787] kjournald starting.  Commit interval 5 seconds</p>
<p>Now run this (as root), substitude sdf for the device you found. BE WARNED that if Linux didn&#8217;t see your disk when you just plugged it in, you may be seeing the detection of an actual file system disk. The best way to tell is to run tail -f /var/log/kern.log (or /var/log/messages or something where the kernel logs, depending on your distribution of Linux)</p>
<p>fdisk -l /dev/sdf</p>
<p>This showed me</p>
<p>Disk /dev/sdf: 250.0 GB, 250059350016 bytes</p>
<p>255 heads, 63 sectors/track, 30401 cylinders<br />
Units = cylinders of 16065 * 512 = 8225280 bytes<br />
Disk identifier: 0x000969e0</p>
<p>   Device Boot      Start         End      Blocks   Id  System<br />
/dev/sdf1   *           1       30024   241167748+  83  Linux<br />
/dev/sdf2           30025       30401     3028252+   5  Extended<br />
/dev/sdf5           30025       30401     3028221   82  Linux swap / Solaris</p>
<p>Now I check df -h and see that Ubunu already mounted /dev/sdf1 on /media/disk<br />
So I (as root) unmount it with<br />
umount /dev/sdf1</p>
<p>Now I zero the partition table, THIS CAN TOTALLY MESS UP YOUR DISK IN AN UNRECOVERABLE FASHION, SO BE REALLY REALLY REALLY SURE YOU HAVE THE  CORRECT DISK DEVICE NODE. IF YOU ARE UNSURE DO NOT PROCEED.<br />
(More info about the master boot record on the wikipedia article here. )</p>
<p>dd if=/dev/zero of=/dev/sdf bs=512 count=1</p>
<p>Now, proceed with creating the partition(s) and formatting<br />
fdisk /dev/sdf<br />
select n,p,enter,enter,w<br />
mkfs.ext3 /dev/sdf1</p>
<div class="shr-publisher-92"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:none;height:30px;'><a class='shareaholic-fblike' data-shr_layout='button_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2008%2F08%2F03%2Flcod-8-3-08-get-around-annoying-reboot-during-fdisk%2F' data-shr_title='LCOD+-+8.3.08+Get+around+annoying+reboot+during+fdisk+'></a><a class='shareaholic-fbsend' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2008%2F08%2F03%2Flcod-8-3-08-get-around-annoying-reboot-during-fdisk%2F'></a><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2008%2F08%2F03%2Flcod-8-3-08-get-around-annoying-reboot-during-fdisk%2F' data-shr_title='LCOD+-+8.3.08+Get+around+annoying+reboot+during+fdisk+'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetBottom Automatic --><p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.jonzobrist.com/2008/08/03/lcod-8-3-08-get-around-annoying-reboot-during-fdisk/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>LCOD &#8211; 5.17.08 &#8211; Locking down ssh access</title>
		<link>http://www.jonzobrist.com/2008/05/17/lcod-5-17-08-locking-down-ssh-access/</link>
		<comments>http://www.jonzobrist.com/2008/05/17/lcod-5-17-08-locking-down-ssh-access/#comments</comments>
		<pubDate>Sun, 18 May 2008 05:46:10 +0000</pubDate>
		<dc:creator>Jon Zobrist</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Linux Command of the Day]]></category>
		<category><![CDATA[admin]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://jonzobrist.com/?p=90</guid>
		<description><![CDATA[In light of an increase in ssh attacks , vulnerabilities and scans I am writing this guide to help you keep unwanted people from connecting to your server via SSH. If you have generated any of your SSH keys on a Debian or Ubuntu system they are likely very vulnerable to guessing, e.g. someone could [...]
No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:none;height:30px;'><a class='shareaholic-fblike' data-shr_layout='button_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2008%2F05%2F17%2Flcod-5-17-08-locking-down-ssh-access%2F' data-shr_title='LCOD+-+5.17.08+-+Locking+down+ssh+access+'></a><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2008%2F05%2F17%2Flcod-5-17-08-locking-down-ssh-access%2F' data-shr_title='LCOD+-+5.17.08+-+Locking+down+ssh+access+'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetTop Automatic --><p>In light of an increase in ssh attacks , vulnerabilities  and scans  I am writing this guide to help you keep unwanted people from connecting to your server via SSH.</p>
<p>If you have generated any of your SSH keys on a Debian or Ubuntu system they are likely very vulnerable to guessing, e.g. someone could login to your box if they know the name of one of your users that you allow in via ssh within 30 minutes!<br />
See here for more info: http://metasploit.com/users/hdm/tools/debian-openssl/</p>
<p>This applies to any PAM enabled Linux (or other PAM-enabled *nix like OS)</p>
<p>This guide will walk you through configuring your OpenSSH server to only allow public key authentication and limit that to specific users and groups. Errors in this guide or mistakes or differences in system configurations could lock you out of your own systems, be very careful and do not proceed unless you understand and assume the risk you are taking.</p>
<p>I assume no responsibility for YOUR actions. This guide was tested on Ubuntu 7.10 and fairly recent Gentoo system.</p>
<p>1. Limit SSH access to public/private keys only, deny X11 and TCP forwarding, and deny root ssh access<br />
Step 1 Discussion:<br />
Public/Private keys are not necessarily more secure than passwords, but it&#8217;s harder to  guess a private key, and if your users put passwords on their keys then an attacker must have or guess 2 things, the key and its password.</p>
<p>The root user is GOD on almost every Linux/*nix system out there, and nobody should be able to login directly as root remotely. In addition it&#8217;s a very common user, on almost every Linux/*nix system.</p>
<p>TCP and X11 forwarding is one of the coolest features of an ssh server. Unless you want people to be able to use your ssh server like a full access vpn to your local network, or any other network (bounce their attacks through your server), then you want this disabled. And X11 forwarding is great, but I never run an X11 server on something that is a &#8220;production&#8221; environment. If something requires an X11 server, like Oracle, then I run vncserver and allow ssh port forwarding so people can connect via ssh. I make sure to have full deny by default firewalls on all machines like this, limiting outbound access.</p>
<p>Step 1 HOWTO<br />
Edit /etc/ssh/sshd_config<br />
Make sure the following lines are not commented out, and don&#8217;t say something different</p>
<p>Protocol 2<br />
PermitRootLogin no<br />
UsePAM yes<br />
PasswordAuthentication no<br />
PubkeyAuthentication yes<br />
RSAAuthentication yes<br />
PermitEmptyPasswords no<br />
ChallengeResponseAuthentication no<br />
AllowTcpForwarding no<br />
X11Forwarding no</p>
<p>2. Create an ssh remote users group and add users to it who need remote ssh access<br />
Step 2 Discussion:<br />
The main reason I want to limit who has remote ssh access is because there are frequently system accounts or other automatically created accounts that I don&#8217;t want to have to monitor to make sure the installer didn&#8217;t just make a new user with a simple password or key. I want to have the default be nobody can ssh, and then I&#8217;ll add ssh permissions to users who need it.</p>
<p>Step 2 HOWTO:<br />
Let&#8217;s call our remote ssh users list rsshusers, we create it with the command<br />
groupadd rsshusers<br />
Now let&#8217;s say we have a user named mikey already setup, let&#8217;s add him to our new rsshusers group, with the command<br />
usermod -a -G rsshusers mikey<br />
Do this for every user you want to have ssh in remotely. Note that if you&#8217;re used to logging in remotely as root and are going to stop doing that, make sure you user can su to root with the command su.<br />
Login as the user, run<br />
su<br />
Put in your root password, if it accepts it and you are root (run whoami to verify) then you&#8217;re good to go. If it fails to let you su and you&#8217;re sure you have the password right you may need to be in the wheel group to us (default on FreeBSD and Gentoo).<br />
Back as root run the following command to add your user (again, mikey in this example) to your wheel group.<br />
usermod -a -G wheel mikey</p>
<p>Now we&#8217;re going to edit 2 files to limit remote ssh users to the group we made called rsshusers.<br />
First, edit /etc/pam.d/sshd (this was ssh on my Debian/Ubuntu systems)<br />
Add the line<br />
account    required     pam_access.so</p>
<p>This enables access accounting based on the /etc/security/access.conf file, which is the next one we are going to edit.<br />
On both my Gentoo and Debian system this file had every line commented out.<br />
At the end I added the following lines.</p>
<p>-:ALL EXCEPT root mikey:LOCAL<br />
+ : (rsshusers) : ALL<br />
- : ALL : ALL</p>
<p>Initially I tried to use a group like @rsshusers, however this didn&#8217;t seem to work, but () designates explicitly a group.</p>
<p>Restart sshd<br />
Gentoo:<br />
/etc/init.d/sshd restart<br />
Debian/Ubuntu:<br />
/etc/init.d/ssh restart</p>
<p>Now, without closing your root terminal, open a new one and make sure you can ssh in as mikey, and su to root.</p>
<p>Assuming everything went well you could try ssh&#8217;ing in as another user whose public key is correctly in place, but who isn&#8217;t in the rsshusers group.</p>
<p>Related links:</p>
<p>PAM:</p>
<p>http://devmanual.gentoo.org/tasks-reference/pam/index.html</p>
<p>http://linuxdocs.org/HOWTOs/User-Authentication-HOWTO/x101.html</p>
<p>http://tldp.org/HOWTO/User-Authentication-HOWTO/</p>
<p>http://www.faqs.org/docs/Linux-HOWTO/Secure-Programs-HOWTO.html</p>
<p>OpenSSH:</p>
<p>http://www.openssh.com/</p>
<p>http://thinkhole.org/wp/2006/10/30/five-steps-to-a-more-secure-ssh/</p>
<p>http://www.cyberciti.biz/tips/rhel-centos-linux-install-configure-rssh-shell.html</p>
<p>http://geekzine.org/2007/09/28/easy-sftp-and-chroot-sftp-with-scponly/</p>
<p>Misc:<br />
Securing RedHat</p>
<p>http://help.unc.edu/?id=1859</p>
<p>Debian SSLkeys</p>
<p>http://wiki.debian.org/SSLkeys</p>
<p>Links in post:</p>
<p>http://www.securityfocus.com/news/11518</p>
<p>http://metasploit.com/users/hdm/tools/debian-openssl/</p>
<div class="shr-publisher-90"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:none;height:30px;'><a class='shareaholic-fblike' data-shr_layout='button_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2008%2F05%2F17%2Flcod-5-17-08-locking-down-ssh-access%2F' data-shr_title='LCOD+-+5.17.08+-+Locking+down+ssh+access+'></a><a class='shareaholic-fbsend' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2008%2F05%2F17%2Flcod-5-17-08-locking-down-ssh-access%2F'></a><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2008%2F05%2F17%2Flcod-5-17-08-locking-down-ssh-access%2F' data-shr_title='LCOD+-+5.17.08+-+Locking+down+ssh+access+'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetBottom Automatic --><p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.jonzobrist.com/2008/05/17/lcod-5-17-08-locking-down-ssh-access/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

