<?xml version="1.0"?>
<rss version="2.0"
     xmlns:dc="http://purl.org/dc/elements/1.1/"
     xmlns:dcterms="http://purl.org/dc/terms/" >
<channel>
<title>tips</title>
<link>http://www.lunix.com.au/tags/tips/</link>
<description>lunix</description>
<item>

	<title>Share any website in Google Reader</title>


	<guid>http://www.lunix.com.au/blog/google-reader-chrome-bookmarklet/</guid>

	<link>http://www.lunix.com.au/blog/google-reader-chrome-bookmarklet/</link>


	<category>tags/general</category>

	<category>tags/tips</category>


	<pubDate>Sun, 04 Sep 2011 13:53:31 +1000</pubDate>
	<dcterms:modified>2011-09-04T03:53:31Z</dcterms:modified>

	<description>&lt;h1&gt;Share any website in Google Reader&lt;/h1&gt;

&lt;p&gt;I read a lot of feeds and Google reader makes this easier. &lt;br /&gt;
It also allows me to &#39;share&#39; the ones I find useful/interesting as an RSS feed for others to read. &lt;br /&gt;
One thing I found is that I sometimes come across a great site or blog post from a source other than Google Reader &lt;br /&gt;
that I want to share. This small Chrome/chromium bookmarklet allows you to share any website you visit. &lt;br /&gt;
You just create a bookmark on the Chrome toolbar with the URL set to the following javascript snippet.&lt;/p&gt;

&lt;pre&gt;
javascript:var%20b=document.body;var%20GR________bookmarklet_domain=&#39;http://www.google.com&#39;;if(b&amp;&amp;!document.xmlVersion){void(z=document.createElement(&#39;script&#39;));void(z.src=&#39;http://www.google.com/reader/ui/link-bookmarklet.js&#39;);void(b.appendChild(z));}else{}
&lt;/pre&gt;
</description>


	<comments>http://www.lunix.com.au/blog/google-reader-chrome-bookmarklet/#comments</comments>

</item>
<item>

	<title>openssh and X11 forwarding</title>


	<guid>http://www.lunix.com.au/blog/openssh-and-x11-forwarding/</guid>

	<link>http://www.lunix.com.au/blog/openssh-and-x11-forwarding/</link>


	<category>tags/general</category>

	<category>tags/sysadmin</category>

	<category>tags/tips</category>


	<pubDate>Thu, 29 Jan 2009 22:17:00 +1100</pubDate>
	<dcterms:modified>2009-01-29T11:17:00Z</dcterms:modified>

	<description>&lt;p&gt;Occasionally you may come across times where you need to run an X application on a remote, headless server. &lt;br /&gt;
Today was one of those occasions for me. &lt;br /&gt;
Installing xorg etc to add X to the server is a reasonable amount of work and not really a choice. &lt;br /&gt;
openssh has an option to tunnel X11 connections and auto setup the $DISPLAY environment variable on the remote host. &lt;br /&gt;
This can be done either on the fly with a switch to the ssh client or a permenant setup by changing the config file for openssh.  &lt;/p&gt;

&lt;pre&gt;&lt;code&gt;[lunix@godzilla ~]&amp;#036; ssh -Y admin@10.20.1.254
admin@10.20.1.254&#39;s password:
Last login: Fri Jan 30 00:22:23 2009 from dynamic-20.home.lunix.com.au
/usr/bin/xauth:  creating new authority file /home/admin/.Xauthority
[admin@gateway01 ~]&amp;#036; echo &amp;#036;DISPLAY
localhost:10.0
[admin@gateway01 ~]&amp;#036;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This extract of ~/.ssh/config shows how to make the X11 forwarding more permenant.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;Host remotehost
ForwardX11 yes
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Once this has been done and the $DISPLAY env. variable is set you should be able to fire up an application that displays its output via X.  &lt;/p&gt;

&lt;pre&gt;&lt;code&gt;[lunix@godzilla ~]&amp;#036; wireshark
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This will then fire up wireshark sending its output to X via localhost:10.0 which will tunnel it across ssh to your local screen. &lt;br /&gt;
Remeber this may be a bit slower than running it locally but it works.&lt;/p&gt;

&lt;p&gt;I ran into problems this morning the first time I logged in with ssh -Y with the $DISPLAY env variable not being set. &lt;br /&gt;
To diagnose this I retried the ssh command with the extra options of -vv. Here is a snippet of the output.  &lt;/p&gt;

&lt;pre&gt;&lt;code&gt;[lunix@godzilla ~]&amp;#036; ssh -vv -Y admin@10.20.1.254
admin@10.20.1.254&#39;s password:
...
debug2: x11_get_proto: /usr/bin/xauth  list :0 2&amp;gt;/dev/null
debug1: Requesting X11 forwarding with authentication spoofing.
..
..
debug1: Remote: No xauth program; cannot forward with spoofing.
..
Last login: Fri Jan 30 06:48:28 2009 from dynamic-20.home.lunix.com.au
[admin@gateway01 ~]&amp;#036; echo &amp;#036;DISPLAY

[admin@gateway01 ~]&amp;#036;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;$DISPLAY wasn&#39;t set. In my case the debug1: line mentioning a missing xauth program was the problem. &lt;br /&gt;
A simple &lt;em&gt;yum install xorg-x11-xauth&lt;/em&gt; fixed this. ( centos 5 )&lt;/p&gt;

&lt;p&gt;Hope this helps.&lt;/p&gt;
</description>


	<comments>http://www.lunix.com.au/blog/openssh-and-x11-forwarding/#comments</comments>

</item>
<item>

	<title>Usefull strace primer</title>


	<guid>http://www.lunix.com.au/blog/usefull-strace-primer/</guid>

	<link>http://www.lunix.com.au/blog/usefull-strace-primer/</link>


	<category>tags/general</category>

	<category>tags/sysadmin</category>

	<category>tags/tips</category>


	<pubDate>Fri, 09 Jan 2009 15:09:00 +1100</pubDate>
	<dcterms:modified>2009-01-09T04:09:00Z</dcterms:modified>

	<description>&lt;p&gt;&lt;em&gt;I&#39;m posting this here for both future use by myself and in the hope it&#39;s usefull to anyone else.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Have you ever racked your brain to find that bug? You know, the bug that you can&#39;t find in the source code, &lt;br /&gt;
but which appears with deliberate consistency when your code is compiled and run. &lt;br /&gt;
Hacker, meet &lt;strong&gt;strace&lt;/strong&gt;. &lt;br /&gt;
strace is a utility that allows you to trace system calls and signals for a given command and its arguments. &lt;/p&gt;

&lt;p&gt;Full article is over at the &lt;a href=&quot;http://www.redhat.com/magazine/010aug05/features/strace/&quot;&gt;Redhat Magazine&lt;/a&gt;&lt;/p&gt;
</description>


	<comments>http://www.lunix.com.au/blog/usefull-strace-primer/#comments</comments>

</item>
<item>

	<title>Simple portscanning with bash and netcat</title>


	<guid>http://www.lunix.com.au/blog/simple-portscanning-with-bash-and-netcat/</guid>

	<link>http://www.lunix.com.au/blog/simple-portscanning-with-bash-and-netcat/</link>


	<category>tags/general</category>

	<category>tags/sysadmin</category>

	<category>tags/tips</category>


	<pubDate>Wed, 31 Dec 2008 12:05:00 +1100</pubDate>
	<dcterms:modified>2008-12-31T01:05:00Z</dcterms:modified>

	<description>&lt;p&gt;Today I was presented with the need to find all the machines on a network that have port 22 open. &lt;br /&gt;
This can easily be achieved with nmap.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;sudo nmap -sS -p22 192.168.1.0/24
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;However the only box I had was a &#39;linux router&#39; with a minimalistic linux install and no access to install extra packages. &lt;br /&gt;
What I ended up using was a very simple shell script with nothing more than a for loop and netcat.&lt;/p&gt;

&lt;pre class=&quot;hl&quot;&gt;    &lt;span class=&quot;hl slc&quot;&gt;#!/bin/bash&lt;/span&gt;
    &lt;span class=&quot;hl kwa&quot;&gt;for&lt;/span&gt; h &lt;span class=&quot;hl kwa&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;hl sym&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;hl num&quot;&gt;2&lt;/span&gt;.&lt;span class=&quot;hl num&quot;&gt;.254&lt;/span&gt;&lt;span class=&quot;hl sym&quot;&gt;};&lt;/span&gt;
    &lt;span class=&quot;hl kwa&quot;&gt;do&lt;/span&gt;
            nc &lt;span class=&quot;hl sym&quot;&gt;-&lt;/span&gt;z &lt;span class=&quot;hl num&quot;&gt;192.168.111&lt;/span&gt;.&lt;span class=&quot;hl kwb&quot;&gt;$h&lt;/span&gt; &lt;span class=&quot;hl num&quot;&gt;22&lt;/span&gt;&lt;span class=&quot;hl sym&quot;&gt;;&lt;/span&gt;
            &lt;span class=&quot;hl kwa&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;hl sym&quot;&gt;[&lt;/span&gt; $? &lt;span class=&quot;hl sym&quot;&gt;-&lt;/span&gt;eq &lt;span class=&quot;hl num&quot;&gt;0&lt;/span&gt; &lt;span class=&quot;hl sym&quot;&gt;];&lt;/span&gt; &lt;span class=&quot;hl kwa&quot;&gt;then&lt;/span&gt;
                    &lt;span class=&quot;hl kwb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;hl sym&quot;&gt;-&lt;/span&gt;e &lt;span class=&quot;hl str&quot;&gt;&amp;quot;192.168.111.$h&lt;/span&gt;&lt;span class=&quot;hl esc&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;hl str&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;hl sym&quot;&gt;;&lt;/span&gt;
            &lt;span class=&quot;hl kwa&quot;&gt;fi&lt;/span&gt;
    &lt;span class=&quot;hl kwa&quot;&gt;done&lt;/span&gt;
&lt;/pre&gt;

&lt;p&gt;The -z flag to nc ( netcat ) tells it &#39;no io&#39; then I just test for the exit code it gives. &lt;br /&gt;
Simple. &lt;/p&gt;
</description>


	<comments>http://www.lunix.com.au/blog/simple-portscanning-with-bash-and-netcat/#comments</comments>

</item>
<item>

	<title>Searching ~/.bash_history the easy way with tagging and ctrl-r </title>


	<guid>http://www.lunix.com.au/blog/searching-bash_history-the-easy-way-with-tagging-and-ctrl-r/</guid>

	<link>http://www.lunix.com.au/blog/searching-bash_history-the-easy-way-with-tagging-and-ctrl-r/</link>


	<category>tags/general</category>

	<category>tags/tips</category>


	<pubDate>Sun, 06 Jul 2008 17:54:00 +1000</pubDate>
	<dcterms:modified>2008-07-06T07:54:00Z</dcterms:modified>

	<description>&lt;p&gt;I use the bash hotkey of &lt;code&gt;&amp;lt;ctrl-r&amp;gt;&lt;/code&gt; alot to search my ~/.bash_history and then re-use the commands. &lt;br /&gt;
When I learnt about this key sequence it saved me a lot of effort. &lt;br /&gt;
Now I have found out about one little addition to this thanks to a Tech Tip in issue #170 (June 2008) of Linux Journal.  &lt;/p&gt;

&lt;p&gt;Edit your ~/.bash_history and place tags at the end of each command you use regularly by using bash comments, ala #foo.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;cd /home/httpd/html #webroot
firefox &amp;amp; #web
tail -f /var/log/everything.log #logall
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Now a simple &lt;code&gt;&amp;lt;ctrl-r&amp;gt;  web&lt;/code&gt; will search my &lt;em&gt;~/.bash_history&lt;/em&gt; for #web and hitting &lt;em&gt;enter&lt;/em&gt; will run that command again. &lt;br /&gt;
Not exactly a documented feature ( that i am aware of ) but a handy little hack.&lt;/p&gt;
</description>


	<comments>http://www.lunix.com.au/blog/searching-bash_history-the-easy-way-with-tagging-and-ctrl-r/#comments</comments>

</item>

</channel>
</rss>

