<?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>scienceoss.com &#187; linux</title>
	<atom:link href="http://scienceoss.com/categories/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://scienceoss.com</link>
	<description>useful tidbits for using open source software in science</description>
	<lastBuildDate>Wed, 26 May 2010 03:34:19 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Persistent SSH sessions</title>
		<link>http://scienceoss.com/persistent-ssh-sessions/</link>
		<comments>http://scienceoss.com/persistent-ssh-sessions/#comments</comments>
		<pubDate>Thu, 13 Mar 2008 03:41:47 +0000</pubDate>
		<dc:creator>ryan</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[utilities]]></category>
		<category><![CDATA[screen]]></category>

		<guid isPermaLink="false">http://scienceoss.com/persistent-ssh-sessions/</guid>
		<description><![CDATA[The screen program, among other useful things, lets you keep an SSH session running even after you disconnect from SSH. Here&#8217;s how to use it. SSH in. ssh user@hostname.com Once on the remote machine, set up a named screen: screen -S myscreen In another terminal, open another SSH connnection and start another screen: screen -S [...]]]></description>
			<content:encoded><![CDATA[<p>The <span class="c">screen</span> program, among other useful things, lets you keep an SSH session running even after you disconnect from SSH.  Here&#8217;s how to use it.</p>
<p>SSH in.</p>
<pre class="prettyprint"><code class="code">ssh user@hostname.com</code></pre>
<p>Once on the remote machine, set up a named screen:</p>
<pre class="prettyprint"><code class="code">screen -S myscreen</code></pre>
<p>In another terminal, open another SSH connnection and start another screen:</p>
<pre class="prettyprint"><code class="code">screen -S mysecondscreen</code></pre>
<p>You can see they are there by using, in either of the terminals,</p>
<pre class="prettyprint"><code class="code">screen -ls</code></pre>
<p>This does NOT start screen, just lists the different screens.</p>
<p>You can now disconnect the SSH connections.  When you reconnect, you can use</p>
<pre class="prettyprint"><code class="code">screen -r myscreen</code></pre>
<p>or</p>
<pre class="prettyprint"><code class="code">screen -r mysecondscreen</code></pre>
<p>to reconnect to the one you want.</p>
]]></content:encoded>
			<wfw:commentRss>http://scienceoss.com/persistent-ssh-sessions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting up and using an SVN repository</title>
		<link>http://scienceoss.com/setting-up-and-using-an-svn-repository/</link>
		<comments>http://scienceoss.com/setting-up-and-using-an-svn-repository/#comments</comments>
		<pubDate>Thu, 13 Mar 2008 03:36:40 +0000</pubDate>
		<dc:creator>ryan</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[utilities]]></category>
		<category><![CDATA[revision control]]></category>
		<category><![CDATA[svn]]></category>

		<guid isPermaLink="false">http://scienceoss.com/setting-up-and-using-an-svn-repository/</guid>
		<description><![CDATA[Install subversion (Ubuntu) sudo apt-get install subversion Make a directory to store the repositories mkdir /path/to/repository Create the repository svnadmin create /path/to/repository Import existing files into repository svn import /path/name/to/foo file:///path/to/repository when you checkout this repository, it will create the directory foo. So to get the svn repository in my ~/work directory as ~/work/foo I [...]]]></description>
			<content:encoded><![CDATA[<p>Install subversion (Ubuntu)</p>
<pre class="prettyprint"><code class="code">sudo apt-get install subversion</code></pre>
<p>Make a directory to store the repositories</p>
<pre class="prettyprint"><code class="code">mkdir /path/to/repository</code></pre>
<p>Create the repository</p>
<pre class="prettyprint"><code class="code">svnadmin create /path/to/repository</code></pre>
<p>Import existing files into repository</p>
<pre class="prettyprint"><code class="code">svn import /path/name/to/foo file:///path/to/repository</code></pre>
<p>when you checkout this repository, it will create the directory <span class="c">foo</span>. So to get the svn repository in my<span class="c"> ~/work</span> directory as <span class="c">~/work/foo</span> I would go to <span class="c">~/work</span>, then</p>
<pre class="prettyprint"><code class="code">svn co file:///path/to/repository</code></pre>
<p>that is, don&#8217;t make a new dir dir called <span class="c">foo</span> and import into there . . . it will make its own dir.</p>
<p>Check out locally</p>
<pre class="prettyprint"><code class="code">svn checkout file:///path/to/repository /local/workdir</code></pre>
<p>Check out remotely through an ssh connection</p>
<pre class="prettyprint"><code class="code">svn checkout svn+ssh://user@hostname/path/to/repository/on/remotehost /local/workdir</code></pre>
<p>Update local copy from SVN</p>
<pre class="prettyprint"><code class="code">svn update</code></pre>
<p>Check what&#8217;s been changed</p>
<pre class="prettyprint"><code class="code">svn status</code></pre>
<p>Resolve a conflict</p>
<pre class="prettyprint"><code class="code">svn resolved filename</code></pre>
<p>Send these changes to SVN (editor will prompt for revision notes, must be non-empty)</p>
<pre class="prettyprint"><code class="code">svn commit</code></pre>
<p>Send these changes to SVN, and specify logfile to send as comments</p>
<pre class="prettyprint"><code class="code">svn commit -F logfile</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://scienceoss.com/setting-up-and-using-an-svn-repository/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A more secure SSH configuration</title>
		<link>http://scienceoss.com/a-more-secure-ssh-configuration/</link>
		<comments>http://scienceoss.com/a-more-secure-ssh-configuration/#comments</comments>
		<pubDate>Thu, 13 Mar 2008 03:25:49 +0000</pubDate>
		<dc:creator>ryan</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[utilities]]></category>
		<category><![CDATA[config]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://scienceoss.com/a-more-secure-ssh-configuration/</guid>
		<description><![CDATA[Some easy ways to configure SSH to be a little more secure: Edit /etc/ssh/sshd_config as root. Change the port (default is 22) Change “PermitRootLogin yes” to “PermitRootLogin no” AddUser username save and quit restart the ssh server: sudo /etc/init.d/ssh restart More info here: http://ubuntu-tutorials.com/2007/02/14/what-you-ought-to-know-about-securing-ssh/]]></description>
			<content:encoded><![CDATA[<p>Some easy ways to configure SSH to be a little more secure:</p>
<p>Edit <span class="c">/etc/ssh/sshd_config</span> as root.</p>
<ul>
<li>Change the port (default is 22)</li>
<li>Change “PermitRootLogin yes” to “PermitRootLogin no”</li>
<li>AddUser username</li>
<li>save and quit</li>
<li>restart the ssh server: <span class="c">sudo /etc/init.d/ssh restart</span></li>
</ul>
<p>More info here:<br />
<a href="http://ubuntu-tutorials.com/2007/02/14/what-you-ought-to-know-about-securing-ssh/">http://ubuntu-tutorials.com/2007/02/14/what-you-ought-to-know-about-securing-ssh/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://scienceoss.com/a-more-secure-ssh-configuration/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SSH: Add public key to remote server</title>
		<link>http://scienceoss.com/ssh-add-public-key-to-remote-server/</link>
		<comments>http://scienceoss.com/ssh-add-public-key-to-remote-server/#comments</comments>
		<pubDate>Thu, 13 Mar 2008 03:20:41 +0000</pubDate>
		<dc:creator>ryan</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[utilities]]></category>
		<category><![CDATA[public key]]></category>

		<guid isPermaLink="false">http://scienceoss.com/ssh-add-public-key-to-remote-server/</guid>
		<description><![CDATA[Easy way to add public key of this machine to a remote machine: ssh-copy-id -i ~/.ssh/id_dsa.pub root@fileserver01 More good info here: http://ubuntu-tutorials.com/2007/02/05/unattended-ssh-login-public-key-ssh-authorization-ssh-automatic-login/]]></description>
			<content:encoded><![CDATA[<p>Easy way to add public key of this machine to a remote machine:</p>
<pre class="prettyprint"><code class="code">ssh-copy-id -i ~/.ssh/id_dsa.pub root@fileserver01</code></pre>
<p>More good info here:<br />
<a href="http://ubuntu-tutorials.com/2007/02/05/unattended-ssh-login-public-key-ssh-authorization-ssh-automatic-login/">http://ubuntu-tutorials.com/2007/02/05/unattended-ssh-login-public-key-ssh-authorization-ssh-automatic-login/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://scienceoss.com/ssh-add-public-key-to-remote-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Remote MySQL using SSH</title>
		<link>http://scienceoss.com/remote-mysql-using-ssh/</link>
		<comments>http://scienceoss.com/remote-mysql-using-ssh/#comments</comments>
		<pubDate>Thu, 13 Mar 2008 03:19:32 +0000</pubDate>
		<dc:creator>ryan</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[utilities]]></category>
		<category><![CDATA[bind]]></category>
		<category><![CDATA[port forwarding]]></category>
		<category><![CDATA[remote]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://scienceoss.com/remote-mysql-using-ssh/</guid>
		<description><![CDATA[Step 1: SSH forwarding First, forward the local port 3307 to 3306. That is, when you access the local port 3307, it will redirect it to port 3306 on the remote host. ssh -fNg4 -L 3307:127.0.0.1:3306 user@hostname -f sends SSH to the background -g allows remote hosts to connect to local forwarded ports -N don&#8217;t [...]]]></description>
			<content:encoded><![CDATA[<h2>Step 1: SSH forwarding</h2>
<p>First, forward the local port 3307 to 3306. That is, when you access the local port 3307, it will redirect it to port 3306 on the remote host.</p>
<pre class="prettyprint"><code class="code">ssh -fNg4 -L 3307:127.0.0.1:3306 user@hostname</code></pre>
<p><span class="c">-f</span> sends SSH to the background<br />
<span class="c">-g</span> allows remote hosts to connect to local forwarded ports<br />
<span class="c">-N</span> don&#8217;t execute a remote command<br />
<span class="c">-4</span> this was key! Forces IPv4. Kept getting &#8220;bind: Address already in use&#8221; errors because I didn&#8217;t have this.<br />
<span class="c">-L</span> the forwarding magic happens here . . . syntax is localport:localhost:remoteport</p>
<h2>Step 2: Connect to mysql on port 3307</h2>
<p>. . . which will redirect to port 3306 on remote host.</p>
<pre class="prettyprint"><code class="code">mysql -u root -h 127.0.0.1 -P 3307 -p</code></pre>
<p>and you&#8217;re in!</p>
]]></content:encoded>
			<wfw:commentRss>http://scienceoss.com/remote-mysql-using-ssh/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Check open ports</title>
		<link>http://scienceoss.com/check-open-ports/</link>
		<comments>http://scienceoss.com/check-open-ports/#comments</comments>
		<pubDate>Thu, 13 Mar 2008 03:17:23 +0000</pubDate>
		<dc:creator>ryan</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[network]]></category>
		<category><![CDATA[ports]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://scienceoss.com/check-open-ports/</guid>
		<description><![CDATA[Are there any open ports that shouldn&#8217;t be open? Check with: sudo netstat -tupl Results in something like: Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 localhost:mysql *:* LISTEN 5077/mysqld tcp 0 0 localhost:ipp *:* LISTEN 5001/cupsd udp 0 0 *:32768 *:* 5324/avahi-daemon: udp 0 [...]]]></description>
			<content:encoded><![CDATA[<p>Are there any open ports that shouldn&#8217;t be open?  Check with:</p>
<pre class="prettyprint"><code class="code">sudo netstat -tupl</code></pre>
<p>Results in something like:</p>
<pre class="prettyprint"><code class="code">
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address    Foreign Address  State    PID/Program name
tcp        0      0 localhost:mysql  *:*              LISTEN  5077/mysqld
tcp        0      0 localhost:ipp    *:*              LISTEN  5001/cupsd
udp        0      0 *:32768          *:*                      5324/avahi-daemon:
udp        0      0 *:bootpc         *:*                      5875/dhclient
udp        0      0 *:mdns           *:*                      5324/avahi-daemon: </code></pre>
<p>Kill the process that is using the port</p>
<pre class="prettyprint"><code class="code">kill (PID here)</code></pre>
<p>List open files:</p>
<pre class="prettyprint"><code class="code">lsof -i</code></pre>
<p>where the -i makes it list internet files.</p>
]]></content:encoded>
			<wfw:commentRss>http://scienceoss.com/check-open-ports/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>bash script: convert images</title>
		<link>http://scienceoss.com/bash-script-convert-images/</link>
		<comments>http://scienceoss.com/bash-script-convert-images/#comments</comments>
		<pubDate>Thu, 13 Mar 2008 03:12:29 +0000</pubDate>
		<dc:creator>ryan</dc:creator>
				<category><![CDATA[bash]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[convert]]></category>
		<category><![CDATA[image]]></category>

		<guid isPermaLink="false">http://scienceoss.com/bash-script-convert-images/</guid>
		<description><![CDATA[Convert all eps files into jpeg copies in current directory and lower. #!/usr/bin/bash for f in $(find -type f -iname '*.eps') do dest=`echo ${f%.*}` echo "${f} to ${dest}.jpg" convert "${f}" "${dest}.jpg" done]]></description>
			<content:encoded><![CDATA[<p>Convert all eps files into jpeg copies in current directory and lower.</p>
<pre class="prettyprint"><code class="code">#!/usr/bin/bash
for f in $(find -type f -iname '*.eps')
do
     dest=`echo ${f%.*}`
     echo "${f} to ${dest}.jpg"
     convert "${f}" "${dest}.jpg"
done</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://scienceoss.com/bash-script-convert-images/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>bash script: find and remove files</title>
		<link>http://scienceoss.com/bash-script-find-and-remove-files/</link>
		<comments>http://scienceoss.com/bash-script-find-and-remove-files/#comments</comments>
		<pubDate>Thu, 13 Mar 2008 03:10:09 +0000</pubDate>
		<dc:creator>ryan</dc:creator>
				<category><![CDATA[bash]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[deleting files]]></category>

		<guid isPermaLink="false">http://scienceoss.com/bash-script-find-and-remove-files/</guid>
		<description><![CDATA[This bash script will find all the files matching the pattern *foo.txt. #!/usr/bin/bash for f in $(find -type f -name '*foo.txt') do echo "removing ${f}." rm "${f}" done Use -iname for case-insensitive, which will even match hidden files (files with a leading dot). The -type f means only find regular files.]]></description>
			<content:encoded><![CDATA[<p>This bash script will find all the files matching the pattern <span class="c">*foo.txt</span>.</p>
<pre class="prettyprint"><code class="code">#!/usr/bin/bash
for f in $(find -type f -name '*foo.txt')
do
    echo "removing ${f}."
    rm "${f}"
done</code></pre>
<p>Use <span class="c">-iname</span> for case-insensitive, which will even match hidden files (files with a leading dot).<br />
The <span class="c">-type f</span> means only find regular files.</p>
]]></content:encoded>
			<wfw:commentRss>http://scienceoss.com/bash-script-find-and-remove-files/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Configure SSH</title>
		<link>http://scienceoss.com/configure-ssh/</link>
		<comments>http://scienceoss.com/configure-ssh/#comments</comments>
		<pubDate>Wed, 09 Jan 2008 20:42:28 +0000</pubDate>
		<dc:creator>ryan</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://scienceoss.com/?p=57</guid>
		<description><![CDATA[sudo vim /etc/ssh/sshd_config]]></description>
			<content:encoded><![CDATA[<pre class = "prettyprint"><code class = "code">sudo vim /etc/ssh/sshd_config </code></pre>
]]></content:encoded>
			<wfw:commentRss>http://scienceoss.com/configure-ssh/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Restart SSH</title>
		<link>http://scienceoss.com/restart-ssh/</link>
		<comments>http://scienceoss.com/restart-ssh/#comments</comments>
		<pubDate>Wed, 09 Jan 2008 20:42:04 +0000</pubDate>
		<dc:creator>ryan</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://scienceoss.com/?p=56</guid>
		<description><![CDATA[sudo /etc/init.d/ssh restart]]></description>
			<content:encoded><![CDATA[<pre class = "prettyprint"><code class = "code">sudo /etc/init.d/ssh restart</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://scienceoss.com/restart-ssh/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

