<?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>Jeroen&#039;s weblog &#187; Linux</title>
	<atom:link href="http://blog.hendricksen.eu/category/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.hendricksen.eu</link>
	<description></description>
	<lastBuildDate>Mon, 05 Dec 2011 07:52:12 +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>Route NNTP traffic via specific ISP with iptables</title>
		<link>http://blog.hendricksen.eu/2011/02/12/route-nntp-traffic-via-specific-isp-with-iptables/</link>
		<comments>http://blog.hendricksen.eu/2011/02/12/route-nntp-traffic-via-specific-isp-with-iptables/#comments</comments>
		<pubDate>Sat, 12 Feb 2011 17:37:24 +0000</pubDate>
		<dc:creator>Jeroen</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[gateway]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[internet connection]]></category>
		<category><![CDATA[iptables]]></category>
		<category><![CDATA[isp]]></category>
		<category><![CDATA[newsgroup]]></category>
		<category><![CDATA[nntp]]></category>
		<category><![CDATA[sabnzbd]]></category>
		<category><![CDATA[traffic]]></category>
		<category><![CDATA[ubuntu]]></category>
		<guid isPermaLink="false">http://blog.hendricksen.eu/?p=775</guid>
		<description><![CDATA[Instructions on using iptables to route specific traffic (like nntp) via a specific gateway in your network. <a href="http://blog.hendricksen.eu/2011/02/12/route-nntp-traffic-via-specific-isp-with-iptables/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I use a newsgroup provider for exchanging content with the <a href="http://en.wikipedia.org/wiki/Usenet_newsgroup" target="_blank">Usenet newsgroup</a>. My newsgroup provider restricts connections to be originating from the same IP for a specific account. I have a machine in my network that is always on and therefore perfectly suited to be serving as a download machine. The problem however is that this machine is providing other services (shell, webserver, mail) via the slower, but more stable ISP connection with a static IP. My preference is to keep it connected this way for obvious reasons.</p>
<p>I can use ISP1&#8242; connection for downloading via the newsgroup, bu the newsgroup provider does not allow traffic to its servers from more then one IP. If violated this results in the following message:</p>
<div class="codecolorer-container text vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Failed login for server [482 You are already connected from a different host]</div></td></tr></tbody></table></div>
<p>Besides I also use the ISP with the fast connection to download from the newsgroups, and when using both ISPs at the same time it causes the above &#8216;failed login&#8217; message.</p>
<p style="text-align: center;">
<a class="highslide img_1" href="http://blog.hendricksen.eu/wp-content/gallery/multiple-gateways/network_diagram_multiple_gateways_smaller.jpg" title=""   onclick="return hs.expand(this)">
	<img class="ngg-singlepic" src="http://blog.hendricksen.eu/wp-content/gallery/cache/61__400x_network_diagram_multiple_gateways_smaller.jpg" alt="Network diagram with multiple gateways" title="Network diagram with multiple gateways" />
</a>
</p>
<p>My situation summed up:</p>
<ul>
<li>Server running Ubuntu 10.04 LTS running my favorite newsgroup download tool <a href="http://www.sabnzbd.org/" target="_blank">SABNZBD</a></li>
<li>Two ISP&#8217;s on my local network.<br />
ISP1: slow but stable connection with static IP<br />
ISP2: fast, but less reliable connection with dynamic IP</li>
<li>Server connected to the Internet via ISP1 (default gateway)</li>
<li>Both gateways are on the same local network (192.168.2.0/24)</li>
</ul>
<p><strong>The solution</strong><br />
I want traffic that is using 119 as destination port to be routed via ISP2, while other traffic should be routed via ISP1, which is the default gateway for the server. To accomplish this, I created a script that allows you to redirect specific traffic to a specific port to be redirected via a different gateway then the default gateway:</p>
<div class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;">#!/bin/sh</span><br />
<span style="color: #007800;">ISP2_GATEWAY</span>=192.168.2.253<br />
<span style="color: #007800;">PORT_TO_REDIRECT</span>=<span style="color: #000000;">119</span><br />
<br />
<span style="color: #666666; font-style: italic;">#Create a table</span><br />
<span style="color: #c20cb9; font-weight: bold;">ip route</span> del table webtraffic<br />
<span style="color: #c20cb9; font-weight: bold;">ip route</span> add default table webtraffic via <span style="color: #007800;">$ISP2_GATEWAY</span><br />
<span style="color: #c20cb9; font-weight: bold;">ip rule</span> add fwmark <span style="color: #000000;">1</span> table webtraffic<br />
<br />
<span style="color: #666666; font-style: italic;">#Redirect all traffic outgoing to the specified port to be routed via the above specified gateway</span><br />
iptables <span style="color: #660033;">-t</span> mangle <span style="color: #660033;">-A</span> OUTPUT <span style="color: #660033;">-p</span> tcp <span style="color: #660033;">-m</span> tcp <span style="color: #660033;">--dport</span> <span style="color: #007800;">$PORT_TO_REDIRECT</span> <span style="color: #660033;">-j</span> MARK <span style="color: #660033;">--set-mark</span> <span style="color: #000000;">1</span></div></td></tr></tbody></table></div>
<p>Just adapt this script to your needs and execute it on the server machine.</p>
<p>This solution can be used for other ports and other kinds of traffic as well that is going outward from your local unix machine, for example secure nntp traffic via port 563.</p>
<p><strong>References</strong><br />
These sources have inspired me to find this solution:</p>
<ul>
<li><a href="http://serverfault.com/questions/225185/route-return-traffic-to-correct-gateway-depending-on-service" target="_blank">Route return traffic to correct gateway depending on service (serverfault.com)</a></li>
<li><a href="http://linux-ip.net/html/adv-multi-internet.html" target="_blank">10.4. Multiple Connections to the Internet</a></li>
</ul>
<p>Hope this helps anyone.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.hendricksen.eu/2011/02/12/route-nntp-traffic-via-specific-isp-with-iptables/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Get a root shell on a Lacie Network Space device without physically opening the device</title>
		<link>http://blog.hendricksen.eu/2009/07/29/get-a-root-shell-on-lacie-network-space-device-without-physically-opening-the-device/</link>
		<comments>http://blog.hendricksen.eu/2009/07/29/get-a-root-shell-on-lacie-network-space-device-without-physically-opening-the-device/#comments</comments>
		<pubDate>Wed, 29 Jul 2009 20:36:12 +0000</pubDate>
		<dc:creator>Jeroen</dc:creator>
				<category><![CDATA[Hardware]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[arm]]></category>
		<category><![CDATA[lacie]]></category>
		<category><![CDATA[nas]]></category>
		<category><![CDATA[root]]></category>
		<category><![CDATA[root shell]]></category>
		<guid isPermaLink="false">http://blog.hendricksen.eu/?p=230</guid>
		<description><![CDATA[How to get a root shell on a Lacie Network Space device without physically opening the Lacie Network Space device. <a href="http://blog.hendricksen.eu/2009/07/29/get-a-root-shell-on-lacie-network-space-device-without-physically-opening-the-device/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><strong>About the NAS</strong></p>
<p>
<a class="highslide img_2" href="http://blog.hendricksen.eu/wp-content/gallery/lacienas/lacie_ethernet_storage.jpg" title=""   onclick="return hs.expand(this)">
	<img class="ngg-singlepic ngg-right" src="http://blog.hendricksen.eu/wp-content/gallery/cache/63_web20_150x_lacie_ethernet_storage.jpg" alt="LaCie Network Space" title="LaCie Network Space" />
</a>
 I own a 1 TB Lacie Network Space  device. This device, also called Network Attached Storage (NAS), enables you to hook it onto your (local) network and access files via file -and print sharing, ftp and other protocols. Very handy, if it works as you expect it to.<br />
The NAS has an <a title="ARM926EJ-S" href="http://www.arm.com/products/CPUs/ARM926EJ-S.html" target="_blank">ARM926EJ-S</a> processor, a 1TB hard disk, 16MB of memory, an USB port and no fan (which makes it pretty quiet).</p>
<p><strong>Problem</strong></p>
<p>My problem with the NAS is that the kernel running on the device starts killing processes when I copy very large (2 GB+) files to the NAS via file -and print-sharing (using the samba server). This broke my device in such a way that it would become unusable (no admin panel, though still pingable). Therefore I sent the device for RMA to Lacie&#8217;s service desk where it was repaired.<br />
At least I thought it was, because after copying those large files again, the device broke again, but this time  I was luckily still able to reboot and keep the device up a little while before it required a new reboot. <img src='http://blog.hendricksen.eu/wp-includes/images/smilies/icon_neutral.gif' alt=':|' class='wp-smiley' /><br />
The system log showed a kernel that was randomly killing processes. I expect this might be caused by the autoscan feature that indexes the media on the device, or maybe the device just doesn&#8217;t have enough memory to cope with the continuous transfer of big files. Not funny for a € 160,- device.</p>
<p><strong>Getting root</strong></p>
<p>I decided I didn&#8217;t want to submit the device for RMA again and wanted to get root access to the device and repair it (read: make it more stable) myself. However I didn&#8217;t want to physically open the device and void the warrant. Luckily you don&#8217;t have to, at least not when your device is running <strong>firmware 1.1.8</strong>, as I found out thanks to a post from user &#8216;hardel09&#8242; (read <a title="here" href="http://forum.nas-central.org/viewtopic.php?f=221&amp;t=1181&amp;start=15#p4812" target="_blank">here</a>). <strong>You should only proceed when you understand what you are doing. If you do anything wrong, it can break your device.</strong></p>
<p>Take the following steps:</p>
<ol>
<li>Save the content below to a HTML page, as it allows you to send commands that allow you to abuse cron for executing the tasks you want:
<div class="codecolorer-container html4strict vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br /></div></td><td><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">html</span>&gt;</span><br />
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">head</span>&gt;</span><br />
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">meta</span> <span style="color: #000066;">http-equiv</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Content-Type&quot;</span> <span style="color: #000066;">content</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/html; charset=iso-8859-1&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span><br />
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">title</span>&gt;</span>Hack the NAS<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">title</span>&gt;</span><br />
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">head</span>&gt;</span><br />
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">body</span>&gt;</span><br />
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">form</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">'edit_form'</span> <span style="color: #000066;">method</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">'post'</span> <span style="color: #000066;">action</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">'http://YOURDEVICE/cgi-bin/admin/media'</span>&gt;</span><br />
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">'hidden'</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">'autoscn'</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">'autoscn'</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">'true'</span> <span style="color: #66cc66;">/</span>&gt;</span><br />
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">'hidden'</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">'modified'</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">'modified'</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">'true'</span> <span style="color: #66cc66;">/</span>&gt;</span><br />
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">'hour'</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">'12'</span><span style="color: #66cc66;">/</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">'minute'</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">'50 12 * * * chmod 755 /home/openshare/utelnetd; /home/openshare/utelnetd &amp;'</span><span style="color: #66cc66;">/</span>&gt;</span><br />
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span>submit <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">'SET CRONTAB'</span><span style="color: #66cc66;">/</span>&gt;</span><br />
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">form</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">body</span>&gt;</span><br />
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">html</span>&gt;</span></div></td></tr></tbody></table></div>
</li>
<li>Change the YOURDEVICE in the HTML-file to use the right IP-address or hostname of the NAS</li>
<li>Copy <a href="http://downloads.nas-central.org/Uploads/LSPro/Binaries/utelnetd">utelnetd</a> to \\YOURDEVICE\openshare\utelnetd</li>
<li>Open the HTML file with your favorite browser and fill the current hour in the hour input field and fill the minute input field with the value below. Change the &#8220;HOUR&#8221; string to the current hour and change the &#8220;MINUTE&#8221; string to the next minute plus 2 minutes or so (leaving existing spaces intact), assuming the time on your NAS is correctly set (if not, make it correct by using the admin panel). Now click the SET CRONTAB button and after a few seconds you should end up at the administrator media page with the autoscan checkbox selected.
<div class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">MINUTE HOUR <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #000000;">755</span> <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>openshare<span style="color: #000000; font-weight: bold;">/</span>utelnetd; &nbsp;<span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>openshare<span style="color: #000000; font-weight: bold;">/</span>utelnetd <span style="color: #000000; font-weight: bold;">&amp;</span></div></td></tr></tbody></table></div>
</li>
<li>Now wait a few minutes,  start you favorite network scanner tool and check if port 23 on the NAS has yet appeared as open. If this is not the case, try again from step 4.</li>
<li>If so, you can almost log in, if you set a (empty) password for the root user. Get to the HTML page again, change the &#8220;MINUTE&#8221; and &#8220;HOUR&#8221; strings again (leaving existing spaces intact) and add a command that makes root&#8217;s password empty:
<div class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">MINUTE HOUR <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #c20cb9; font-weight: bold;">passwd</span> <span style="color: #660033;">-d</span> root</div></td></tr></tbody></table></div>
</li>
<li> Login with user root via telnet to get your root shell:
<p>
<a class="highslide img_3" href="http://blog.hendricksen.eu/wp-content/gallery/lacienas/root_shell_lacie.png" title=""   onclick="return hs.expand(this)">
	<img class="ngg-singlepic" src="http://blog.hendricksen.eu/wp-content/gallery/cache/62__x_root_shell_lacie.png" alt="root shell" title="root shell" />
</a>
</li>
<li>If you got a shell, congratulations, you did it! Now continue to make it permanent. Disable the cleanConf daemon, so your changes won&#8217;t be reversed when the NAS is rebooted:
<div class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>rc.d<span style="color: #000000; font-weight: bold;">/</span>rc3.d<br />
<span style="color: #c20cb9; font-weight: bold;">mkdir</span> disabled<br />
<span style="color: #c20cb9; font-weight: bold;">mv</span> S12cleanConf disabled</div></td></tr></tbody></table></div>
</li>
<li>Fix the hacked crontab by executing the command below and clear the first line in the editor (which will disable autoscan)
<div class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">crontab <span style="color: #660033;">-e</span></div></td></tr></tbody></table></div>
</li>
<li>Copy /home/openshare/utelnetd to /usr/bin and make it executable:
<div class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>openshare<span style="color: #000000; font-weight: bold;">/</span>utelnetd <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<br />
<span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #000000;">755</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>utelnetd</div></td></tr></tbody></table></div>
</li>
<li> Add a script in /etc/init.d/telnetd for starting utelnetd automatically. Mine looks like this:
<div class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;">#!/bin/sh</span><br />
<span style="color: #666666; font-style: italic;"># Begin $rc_base/init.d/telnetd</span><br />
<br />
. <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>sysconfig<span style="color: #000000; font-weight: bold;">/</span>rc<br />
. <span style="color: #007800;">$rc_functions</span><br />
<br />
<span style="color: #000000; font-weight: bold;">case</span> <span style="color: #ff0000;">&quot;$1&quot;</span> <span style="color: #000000; font-weight: bold;">in</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; start<span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Starting telnetd server...&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>utelnetd <span style="color: #000000; font-weight: bold;">&amp;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">;;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; stop<span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Stopping telnetd server...&quot;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #c20cb9; font-weight: bold;">killall</span> utelnetd<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">;;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; restart<span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #007800;">$0</span> stop<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #c20cb9; font-weight: bold;">sleep</span> <span style="color: #000000;">1</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #007800;">$0</span> start<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">;;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; status<span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; statusproc utelnetd<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">;;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Usage: $0 {start|stop|restart|status}&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">;;</span><br />
<span style="color: #000000; font-weight: bold;">esac</span><br />
<br />
<span style="color: #666666; font-style: italic;"># End $rc_base/init.d/telnetd</span></div></td></tr></tbody></table></div>
</li>
<li>Enable the script by making a symbolic link that points to the telnetd script:
<div class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>rc.d<span style="color: #000000; font-weight: bold;">/</span>rc3.d<br />
<span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</span> ..<span style="color: #000000; font-weight: bold;">/</span>..<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>telnetd S18telnetd<br />
<span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>rc.d<span style="color: #000000; font-weight: bold;">/</span>rc6.d<br />
<span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</span> ..<span style="color: #000000; font-weight: bold;">/</span>..<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>telnetd K12telnetd</div></td></tr></tbody></table></div>
</li>
<li>Make the script executable:
<div class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">chmod</span> +x <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>telnetd</div></td></tr></tbody></table></div>
</li>
</ol>
<p>That&#8217;s it. You can now reboot the device and utelnetd is automatically started after the reboot.</p>
<p><strong>Now we have root</strong></p>
<p>So what can you do with the device now you have root access to it?</p>
<ul>
<li>Secure it. Anyone in your network who can access the device via IP can currently connect to it without a password, so you might consider using openssh instead of telnet as described <a href="http://www.psykocybernetik.com/blog/?q=content/add-ssh-lacie-edmini-v2" target="_blank">here</a>. You might want to secure the /www/cgi-bin/admin/media script as well, as it can be easily used to  hack into the device.</li>
<li>Fix other problems with the software on the NAS that bother you.</li>
<li>Mount (multiple) partitions from an external mass-storage device and make it available on the network.</li>
<li>Use it as bittorrent client.</li>
<li>Run other (light-weighted / self-compiled) applications on it.</li>
</ul>
<p>I hope this has helped anyone in any way <img src='http://blog.hendricksen.eu/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.hendricksen.eu/2009/07/29/get-a-root-shell-on-lacie-network-space-device-without-physically-opening-the-device/feed/</wfw:commentRss>
		<slash:comments>92</slash:comments>
		</item>
	</channel>
</rss>
<!-- This Quick Cache file was built for (  blog.hendricksen.eu/category/linux/feed/ ) in 0.75263 seconds, on Feb 6th, 2012 at 10:57 pm UTC. -->
<!-- This Quick Cache file will automatically expire ( and be re-built automatically ) on Feb 6th, 2012 at 11:57 pm UTC -->
