<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Peter's Blog - Nodes for debian</title>
    <link>http://www.petersblog.org/</link>
    <description>Nodes containing the tag debian</description>
    <item>
      <title>debian update</title>
      <link>http://www.petersblog.org/node/view/1089</link>
      <description>&lt;p&gt;
After a couple of weeks of neglect I ran an update on the packages on my &lt;a href="/tag/debian"&gt;debian&lt;/a&gt; server. It gave me a few surprises: 
&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;
it upgraded mysql from 4.1 to version 5 
&lt;/li&gt;
&lt;li&gt;
it uninstalled the webmin mysql module 
&lt;/li&gt;
&lt;li&gt;
it uninstalled my vim-python version 6.3 and installed plain vim version 6.4 
&lt;/li&gt;&lt;/ul&gt;

&lt;p&gt;
The new version of mysql seems to be running smoothly (or you wouldn't be reading this). Must see if it supports cascade delete, my all-time favourite sybase sqlanywhere feature. 
&lt;/p&gt;
&lt;p&gt;
I manually installed vim-python using dselect and was happy. Installer glitch. I haven't addressed webmin-mysql yet, it wasn't obvious from what dselect showed me whether what it had would work with mysql 5. Maybe it doesn't say because it doesn't matter? I find webmin-mysql can do all the mysql database administration I need (create database, add users, set permissions, view table etc) with a much simpler interface than phpmyadmin, which is slightly ott. 
&lt;/p&gt;
&lt;p&gt;
I think vim 6.4 is a bug fix release. Upgrading on windows involves recompiling it with python support, not a big deal but it takes time that could be spent doing other things. Sometimes I contemplate hosting vim-python for windows downloads as a public service. I'll contemplate it some more. 
&lt;/p&gt;&lt;p&gt;Related Posts: &lt;a href="/tag/debian"&gt;debian&lt;/a&gt; &lt;a href="/tag/mysql"&gt;mysql&lt;/a&gt; &lt;a href="/tag/vim"&gt;vim&lt;/a&gt;&lt;/p&gt;</description>
      <guid>http://www.petersblog.org/node/view/1089</guid>
      <category domain="http://www.technorati.com/tag">debian</category>
      <category domain="http://www.technorati.com/tag">mysql</category>
      <category domain="http://www.technorati.com/tag">vim</category>
    </item>
    <item>
      <title>Easy VPN</title>
      <link>http://www.petersblog.org/node/view/1087</link>
      <description>&lt;p&gt;
Was contemplating setting up a vpn between my &lt;a href="/tag/debian"&gt;debian&lt;/a&gt; dedicated server and my home &lt;a href="/tag/windows"&gt;windows&lt;/a&gt; pc, but how to set it up? Thought about openvpn and found &lt;a href="http://www.sbeattyconsulting.com/blog/index.php?p=3"&gt;this lengthy article&lt;/a&gt; which looked like far too much hastle. 
&lt;/p&gt;
&lt;p&gt;
Then I came across mention of &lt;a href="http://www.hamachi.cc/"&gt;hamachi&lt;/a&gt;, an easy to set up vpn system. It is closed source but still free. It is a unique system that uses a &lt;a href="http://en.wikipedia.org/wiki/Hamachi"&gt;special hack&lt;/a&gt; to get through firewalls in the same way as voice-over-ip. 
&lt;/p&gt;
&lt;p&gt;
I installed it on the server first using &lt;a href="http://forums.hamachi.cc/viewtopic.php?t=3180"&gt;these instructions&lt;/a&gt; which are pretty straightforward. I then installed the windows client which was even easier to install, it starts a wizard up automatically. 
&lt;/p&gt;
&lt;p&gt;
Once connected it assigns both ends of the network static ip addresses and the windows client displays the ip addresses of both ends. From windows, just ping the ip address of the server and it worked. Add the windows ip address to the servers webmin access list and I could access webmin from the pc. Hibernate the laptop and unhibernate and it reconnects automatically. 
&lt;/p&gt;
&lt;p&gt;
Conclusion: like it says on the box, easy vpn. Now do I trust a closed source system that is begging to be abused by hackers? 
&lt;/p&gt;
&lt;p&gt;
Update: should mention that this worked despite the firewalls in my &lt;a href="/tag/di624"&gt;di624&lt;/a&gt; router, Windows XP noddy firewall and the iptables firewall on the server. I don't think it will work if the firewall blocks outgoing UDP packets. 
&lt;/p&gt;
&lt;p&gt;
I have realised that I have a full peer-peer tcp/ip network: no more fiddling with &lt;a href="/tag/ssh"&gt;ssh&lt;/a&gt; tunnels. The server can even push stuff to the client, I'm not tied down to sftp'ing from the server. Next step is to set up samba on the server: I wouldn't want this open to the internet and it can only be tunnelled through ssh if you disable file and printer sharing in windows. 
&lt;/p&gt;
&lt;p&gt;
The server could send a WOL packet to my laptop to turn it on and an xml-rpc server on the laptop can do just about anything: record tv, stream webcam, turn the lights on... This was possible before but now it can all be done in an even cooler way. 
&lt;/p&gt;
&lt;p&gt;
Update 2: next day after writing this the Hamachi servers went down, taking my vpn, and however many other hamachi vpn's, down with it. Looking at their forum, their servers do seem a slight liability, being subject to DOS attacks and whatnot. 
&lt;/p&gt;
&lt;p&gt;
The linux tools don't give much in the line of diagnostic information: if it does ever time out it just says 'Failed', no clue why. Maybe good for security to give no clues but not good for debugging. Had troubles getting three computers on the same network, getting three connected happily at the same time: one or other would be unable to ping it's peers. 
&lt;/p&gt;
&lt;p&gt;
In conclusion, I've given up on this, when it works it is nice but I want something that is more reliable and has proven security. 
&lt;/p&gt;&lt;p&gt;Related Posts: &lt;a href="/tag/debian"&gt;debian&lt;/a&gt; &lt;a href="/tag/hamachi"&gt;hamachi&lt;/a&gt; &lt;a href="/tag/vpn"&gt;vpn&lt;/a&gt; &lt;a href="/tag/windows"&gt;windows&lt;/a&gt;&lt;/p&gt;</description>
      <guid>http://www.petersblog.org/node/view/1087</guid>
      <category domain="http://www.technorati.com/tag">debian</category>
      <category domain="http://www.technorati.com/tag">hamachi</category>
      <category domain="http://www.technorati.com/tag">vpn</category>
      <category domain="http://www.technorati.com/tag">windows</category>
    </item>
    <item>
      <title>Apache Authentication</title>
      <link>http://www.petersblog.org/node/view/1069</link>
      <description>&lt;p&gt;
Playing with &lt;a href="http://trac.edgewell.com"&gt;trac&lt;/a&gt; I had to set up apache login  authentication to set up access permissions. This is good, I now know how to password protect personal areas of the site (not that personal). 
&lt;/p&gt;
&lt;p&gt;
I've used auth-digest as it's supposed to be more secure than basic authentication. It may have problems with some versions of internet explorer: no, lets rephrase that, it is better at keeping the proles out. Here is how I did it for my &lt;a href="/tag/debian"&gt;debian&lt;/a&gt; system: 
&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;
Enable the Digest Authentication module in apache2: 
&lt;pre class="lazy"&gt;sudo a2enmod
auth_digest&lt;span class="Keyword"&gt;&amp;lt;&lt;/span&gt;cr&lt;span class="Keyword"&gt;&amp;gt;&lt;/span&gt;
apache2ctl restart
&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;
Create a digest file: 
&lt;pre class="lazy"&gt;mkdir /somewhere/to/keep/it
htdigest -c /somewhere/to/keep/it/auth.htdigest Area51 me
&lt;/pre&gt;
where me is my user id. You will be prompted for password for the user. 
&lt;/li&gt;
&lt;li&gt;
Edit site configuration file: in the case of my trac url, I've protected it thusly: 
&lt;div class="verbatim-block"&gt;&lt;pre&gt;ScriptAlias /trac /usr/share/trac/cgi-bin/trac.cgi
&amp;lt;Location &amp;quot;/trac&amp;quot;&amp;gt;
    AuthType Digest
    AuthName &amp;quot;Area51&amp;quot;
    AuthDigestDomain /var/www/Trac http://www.somewhere.org/Trac
    AuthDigestFile /somewhere/to/keep/it/auth.htdigest
    Require valid-user
    SetEnv TRAC_ENV &amp;quot;/var/www/Trac&amp;quot;
&amp;lt;/Location&amp;gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/li&gt;&lt;/ul&gt;

&lt;p&gt;
Now I have to log in to get into www.somewhere.com/Trac. 
&lt;/p&gt;&lt;p&gt;Related Posts: &lt;a href="/tag/apache"&gt;apache&lt;/a&gt; &lt;a href="/tag/debian"&gt;debian&lt;/a&gt; &lt;a href="/tag/ubuntu"&gt;ubuntu&lt;/a&gt;&lt;/p&gt;</description>
      <guid>http://www.petersblog.org/node/view/1069</guid>
      <category domain="http://www.technorati.com/tag">apache</category>
      <category domain="http://www.technorati.com/tag">debian</category>
      <category domain="http://www.technorati.com/tag">ubuntu</category>
    </item>
    <item>
      <title>Subversion locale problem on ubuntu</title>
      <link>http://www.petersblog.org/node/view/975</link>
      <description>&lt;p&gt;
Trying to run &lt;a href="/tag/subversion"&gt;subversion&lt;/a&gt; on &lt;a href="/tag/ubuntu"&gt;ubuntu&lt;/a&gt;, I kept getting the error: 
&lt;/p&gt;
&lt;div class="verbatim-block"&gt;&lt;pre&gt;svn: error: cannot set LC_ALL locale
svn: error: environment variable LANG is en_GB.UTF-8
svn: error: please check that your locale name is correct
svn: Connection closed unexpectedly
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;
Googling seems to imply that this one is a bit of a mystery, svn doesn't like the LANG variable and is happier if it is not set. I found that LANG was being set in /etc/environment on my ubuntu box and that this file didn't exist on my &lt;a href="/tag/debian"&gt;debian&lt;/a&gt; server where LANG was not defined. 
&lt;/p&gt;
&lt;p&gt;
I commented it out and reconnected and joy ensued. 
&lt;/p&gt;
&lt;p&gt;
Running 
&lt;/p&gt;
&lt;pre class="lazy"&gt;sudo dpkg-reconfigure locales
&lt;/pre&gt;
&lt;p&gt;
does not break it again. 
&lt;/p&gt;
&lt;p&gt;
I did a google for LANG and found k.d.lang's website. 
&lt;/p&gt;
&lt;p&gt;
Moral: hack it out and see what breaks. 
&lt;/p&gt;&lt;p&gt;Related Posts: &lt;a href="/tag/debian"&gt;debian&lt;/a&gt; &lt;a href="/tag/subversion"&gt;subversion&lt;/a&gt; &lt;a href="/tag/ubuntu"&gt;ubuntu&lt;/a&gt;&lt;/p&gt;</description>
      <guid>http://www.petersblog.org/node/view/975</guid>
      <category domain="http://www.technorati.com/tag">debian</category>
      <category domain="http://www.technorati.com/tag">subversion</category>
      <category domain="http://www.technorati.com/tag">ubuntu</category>
    </item>
    <item>
      <title>Screen</title>
      <link>http://www.petersblog.org/node/view/970</link>
      <description>&lt;p&gt;
I bought a copy of &lt;a href="http://www.linuxformat.co.uk/"&gt;Linux Format&lt;/a&gt; magazine and found at least one useful thing in it: the screen command. This allows me to set up multiple consoles within a single ssh terminal connection: no need to open multiple terminals, I can switch between bash sessions within one terminal screen. It is even possible to split the screen into two halves and have, say, vim in the top and midnight commander in the bottom: 
&lt;/p&gt;
&lt;div style="text-align:center"&gt;&lt;img src="/images/screen.gif" alt="images/screen.gif"/&gt;&lt;/div&gt; 
&lt;p&gt;
I think I used to use this 17 years ago on a Vax cluster through a VT100 type terminal (lanpar?). I had forgotten all about it. 
&lt;/p&gt;&lt;p&gt;Related Posts: &lt;a href="/tag/debian"&gt;debian&lt;/a&gt; &lt;a href="/tag/linux"&gt;linux&lt;/a&gt; &lt;a href="/tag/ubuntu"&gt;ubuntu&lt;/a&gt;&lt;/p&gt;</description>
      <guid>http://www.petersblog.org/node/view/970</guid>
      <category domain="http://www.technorati.com/tag">debian</category>
      <category domain="http://www.technorati.com/tag">linux</category>
      <category domain="http://www.technorati.com/tag">ubuntu</category>
    </item>
    <item>
      <title>Thwarting ssh login attempts</title>
      <link>http://www.petersblog.org/node/view/968</link>
      <description>&lt;p&gt;
For my ssh server I have disabled root login and I have chosen a slightly less common username and reasonably tough password but still I get people testing the locks. In the log files it is typically shown as a burst of login failures due to unknown name/incorrect password. This is no more than an annoyance, log files full of rubbish, but I'd like to prevent it and who knows, some day someone may hit the jackpot. 
&lt;/p&gt;
&lt;p&gt;
&lt;a href="/tag/linux"&gt;Linux&lt;/a&gt; iptables has a neat trick to limit the rate of connection attempts: three failed connection attempts and you can ban whatever is trying to connect for a couple of minutes. This is cool as it will still allow you yourself in as long as you get the password right in the first attempt or two. 
&lt;/p&gt;
&lt;p&gt;
I use the firewall module in &lt;a href="/tag/webmin"&gt;webmin&lt;/a&gt; to manage iptables and I figured out how to implement this feature. It can be edited through webmin but I found it easier to edit the /etc/webmin/firewall/iptables.save file directly and to use webmin to apply it. This is the important bit: 
&lt;/p&gt;
&lt;div class="verbatim-block"&gt;&lt;pre&gt;# Allow connections to our SSH server from my IP address
-A INPUT -p tcp -m tcp -s 12.34.56.78 --dport ssh -j ACCEPT
# Allow connections to our SSH server from my other IP address
-A INPUT -p tcp -m tcp -s 65.66.67.68 --dport ssh -j ACCEPT
# Allow connections to our SSH server from localhost
-A INPUT -p tcp -m tcp -s 127.0.0.1 --dport ssh -j ACCEPT
# Allow three connection attempts in 60 seconds for anyone else
-A INPUT -p tcp -m tcp -m state -m recent --dport ssh \
   --state NEW  --set
-A INPUT -p tcp -m tcp -m state -m recent --dport ssh \
   --state NEW -j DROP  --update --seconds 60 --hitcount 3
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;
One objection I have read to this technique is that it can allow someone to lock you out of your own server by continually hitting it with spoofed IP packets of your own originating server. For this reason I added rules to let connections from my normal haunts straight in: if someone bothers to IP spoof these addresses then they are talking directly to sshd and cannot do much more than a DOS attack, no different to if the firewall was not there. This also means I can get the password wrong or open and close connections as often as I like from the computers I normally use. 
&lt;/p&gt;
&lt;p&gt;
I could simply deny access from any alien IP except that the IP address of my home PC is not technically static (although it doesn't change very often) and I don't want to lock myself out if it suddenly changes. Besides, who knows, I may be out and about and want to log in (&lt;a href="/tag/putty"&gt;putty&lt;/a&gt; and a USB memory key, the world is mine). 
&lt;/p&gt;
&lt;p&gt;
This appears to work in both &lt;a href="/tag/ubuntu"&gt;ubuntu&lt;/a&gt; and &lt;a href="/tag/debian"&gt;debian&lt;/a&gt;. 
&lt;/p&gt;&lt;p&gt;Related Posts: &lt;a href="/tag/debian"&gt;debian&lt;/a&gt; &lt;a href="/tag/linux"&gt;linux&lt;/a&gt; &lt;a href="/tag/ssh"&gt;ssh&lt;/a&gt; &lt;a href="/tag/ubuntu"&gt;ubuntu&lt;/a&gt; &lt;a href="/tag/webmin"&gt;webmin&lt;/a&gt;&lt;/p&gt;</description>
      <guid>http://www.petersblog.org/node/view/968</guid>
      <category domain="http://www.technorati.com/tag">debian</category>
      <category domain="http://www.technorati.com/tag">linux</category>
      <category domain="http://www.technorati.com/tag">ssh</category>
      <category domain="http://www.technorati.com/tag">ubuntu</category>
      <category domain="http://www.technorati.com/tag">webmin</category>
    </item>
    <item>
      <title>Linux Pocket Reference</title>
      <link>http://www.petersblog.org/node/view/966</link>
      <description>&lt;p&gt;
I bought another book, the Linux Pocket Guide (ISBN 0596006284). It is an interesting read as it is a summary of the most useful commands and utilities available in a typical linux distribution (the book is aimed at &lt;a href="/tag/fedora"&gt;fedora&lt;/a&gt; but most of it, apart from the section on upgrading packages, applies to &lt;a href="/tag/debian"&gt;debian&lt;/a&gt; and &lt;a href="/tag/ubuntu"&gt;ubuntu&lt;/a&gt; as well). 
&lt;/p&gt;
&lt;p&gt;
By summary of commands, I mean that it will describe a typical command like 'find' in a reasonable amount of detail and will describe the most useful options. It is not a reference book where you have to struggle to find the salient information: if you want to be bewildered there are always man pages to read. It is written in a clear and informative way: it is less than 200 pages and I skim-read it in an evening. 
&lt;/p&gt;
&lt;p&gt;
Things I have learnt from it: 
&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;
I use 'dig' but 'host' is a simpler alternative (no having to pick out the answer). 
&lt;/li&gt;
&lt;li&gt;
by using 
&lt;pre class="lazy"&gt;set -o vi
&lt;/pre&gt;
you can enable 'vi' editing on the bash command line &lt;img src="images/smileys/cool.png" alt="cool"/&gt; 
&lt;/li&gt;
&lt;li&gt;
why you need to use 'export' in bash: the variable is defined locally until you export it! 
&lt;/li&gt;&lt;/ul&gt;

&lt;p&gt;
It is a user level guide, there is nothing in there about system configuration, daemons, /etc/init.d etc. I would be tempted to buy other pocket references for that kind of stuff. The book is only &#163;5.56 on &lt;a href="http://www.amazon.co.uk/exec/obidos/ASIN/0596006284/ref=br_lf_b_0/026-2543230-4398005#product-details"&gt;amazon&lt;/a&gt;. 
&lt;/p&gt;&lt;p&gt;Related Posts: &lt;a href="/tag/debian"&gt;debian&lt;/a&gt; &lt;a href="/tag/fedora"&gt;fedora&lt;/a&gt; &lt;a href="/tag/linux"&gt;linux&lt;/a&gt; &lt;a href="/tag/ubuntu"&gt;ubuntu&lt;/a&gt;&lt;/p&gt;</description>
      <guid>http://www.petersblog.org/node/view/966</guid>
      <category domain="http://www.technorati.com/tag">debian</category>
      <category domain="http://www.technorati.com/tag">fedora</category>
      <category domain="http://www.technorati.com/tag">linux</category>
      <category domain="http://www.technorati.com/tag">ubuntu</category>
    </item>
    <item>
      <title>Remote server backup strategy</title>
      <link>http://www.petersblog.org/node/view/957</link>
      <description>&lt;p&gt;
This is the script I am using to back up my &lt;a href="/tag/debian"&gt;debian&lt;/a&gt; dedicated server to my &lt;a href="/tag/ubuntu"&gt;ubuntu&lt;/a&gt; desktop. It uses &lt;a href="/tag/ssh"&gt;ssh&lt;/a&gt; and &lt;a href="/tag/rsync"&gt;rsync&lt;/a&gt;. It uses the cool rsync link-dest trick so that instead of creating multiple copies of the same file, it creates only one copy of the file with multiple hard links to it. I have my ssh keys set up so I don't need to give a password to log in via ssh. 
&lt;/p&gt;
&lt;p&gt;
This uses a 'pull' technique: the desktop reads the files from the server using this script. 
&lt;/p&gt;
&lt;p&gt;
This is not entirely efficent in that it will create a new set of backup files even if nothing changes: if you run the script ten times in a row then you will end up with ten identical sets of files. However, it backs up a web site that changes every day so running it once a day is valid. 
&lt;/p&gt;
&lt;p&gt;
Next job is to put selected files within the backup set into subversion. I decided against using subversion for everything, I can't see a way to automatically delete files bit I'd like to put the main sql dump into subversion. 
&lt;/p&gt;
&lt;pre class="lazy"&gt;&lt;span class="line-numbers"&gt;   1 &lt;/span&gt; &lt;span class="Comment"&gt;&lt;span class="Comment"&gt;#&lt;/span&gt;!/bin/bash&lt;/span&gt;
&lt;span class="line-numbers"&gt;   2 &lt;/span&gt; 
&lt;span class="line-numbers"&gt;   3 &lt;/span&gt; &lt;span class="Comment"&gt;&lt;span class="Comment"&gt;#&lt;/span&gt;&lt;/span&gt;
&lt;span class="line-numbers"&gt;   4 &lt;/span&gt; &lt;span class="Comment"&gt;&lt;span class="Comment"&gt;#&lt;/span&gt; Rotate old backups:&lt;/span&gt;
&lt;span class="line-numbers"&gt;   5 &lt;/span&gt; &lt;span class="Comment"&gt;&lt;span class="Comment"&gt;#&lt;/span&gt;   $1 = remote directory to backup&lt;/span&gt;
&lt;span class="line-numbers"&gt;   6 &lt;/span&gt; &lt;span class="Comment"&gt;&lt;span class="Comment"&gt;#&lt;/span&gt;   $2 = local backup directory&lt;/span&gt;
&lt;span class="line-numbers"&gt;   7 &lt;/span&gt; &lt;span class="Comment"&gt;&lt;span class="Comment"&gt;#&lt;/span&gt;&lt;/span&gt;
&lt;span class="line-numbers"&gt;   8 &lt;/span&gt; function rotate {
&lt;span class="line-numbers"&gt;   9 &lt;/span&gt;     &lt;span class="Comment"&gt;&lt;span class="Comment"&gt;#&lt;/span&gt; Ripple old backups&lt;/span&gt;
&lt;span class="line-numbers"&gt;  10 &lt;/span&gt;     rm -rf &lt;span class="Variable"&gt;&lt;span class="Variable"&gt;$&lt;/span&gt;2&lt;/span&gt;/Backup9
&lt;span class="line-numbers"&gt;  11 &lt;/span&gt;     mv &lt;span class="Variable"&gt;&lt;span class="Variable"&gt;$&lt;/span&gt;2&lt;/span&gt;/Backup8 &lt;span class="Variable"&gt;&lt;span class="Variable"&gt;$&lt;/span&gt;2&lt;/span&gt;/Backup9
&lt;span class="line-numbers"&gt;  12 &lt;/span&gt;     mv &lt;span class="Variable"&gt;&lt;span class="Variable"&gt;$&lt;/span&gt;2&lt;/span&gt;/Backup7 &lt;span class="Variable"&gt;&lt;span class="Variable"&gt;$&lt;/span&gt;2&lt;/span&gt;/Backup8
&lt;span class="line-numbers"&gt;  13 &lt;/span&gt;     mv &lt;span class="Variable"&gt;&lt;span class="Variable"&gt;$&lt;/span&gt;2&lt;/span&gt;/Backup6 &lt;span class="Variable"&gt;&lt;span class="Variable"&gt;$&lt;/span&gt;2&lt;/span&gt;/Backup7
&lt;span class="line-numbers"&gt;  14 &lt;/span&gt;     mv &lt;span class="Variable"&gt;&lt;span class="Variable"&gt;$&lt;/span&gt;2&lt;/span&gt;/Backup5 &lt;span class="Variable"&gt;&lt;span class="Variable"&gt;$&lt;/span&gt;2&lt;/span&gt;/Backup6
&lt;span class="line-numbers"&gt;  15 &lt;/span&gt;     mv &lt;span class="Variable"&gt;&lt;span class="Variable"&gt;$&lt;/span&gt;2&lt;/span&gt;/Backup4 &lt;span class="Variable"&gt;&lt;span class="Variable"&gt;$&lt;/span&gt;2&lt;/span&gt;/Backup5
&lt;span class="line-numbers"&gt;  16 &lt;/span&gt;     mv &lt;span class="Variable"&gt;&lt;span class="Variable"&gt;$&lt;/span&gt;2&lt;/span&gt;/Backup3 &lt;span class="Variable"&gt;&lt;span class="Variable"&gt;$&lt;/span&gt;2&lt;/span&gt;/Backup4
&lt;span class="line-numbers"&gt;  17 &lt;/span&gt;     mv &lt;span class="Variable"&gt;&lt;span class="Variable"&gt;$&lt;/span&gt;2&lt;/span&gt;/Backup2 &lt;span class="Variable"&gt;&lt;span class="Variable"&gt;$&lt;/span&gt;2&lt;/span&gt;/Backup3
&lt;span class="line-numbers"&gt;  18 &lt;/span&gt;     mv &lt;span class="Variable"&gt;&lt;span class="Variable"&gt;$&lt;/span&gt;2&lt;/span&gt;/Backup1 &lt;span class="Variable"&gt;&lt;span class="Variable"&gt;$&lt;/span&gt;2&lt;/span&gt;/Backup2
&lt;span class="line-numbers"&gt;  19 &lt;/span&gt;     mv &lt;span class="Variable"&gt;&lt;span class="Variable"&gt;$&lt;/span&gt;2&lt;/span&gt;/latest &lt;span class="Variable"&gt;&lt;span class="Variable"&gt;$&lt;/span&gt;2&lt;/span&gt;/Backup1
&lt;span class="line-numbers"&gt;  20 &lt;/span&gt; 
&lt;span class="line-numbers"&gt;  21 &lt;/span&gt;     &lt;span class="Comment"&gt;&lt;span class="Comment"&gt;#&lt;/span&gt; Copy current version to latest, creating hard links where files have not changed.&lt;/span&gt;
&lt;span class="line-numbers"&gt;  22 &lt;/span&gt;     &lt;span class="Comment"&gt;&lt;span class="Comment"&gt;#&lt;/span&gt;&lt;/span&gt;
&lt;span class="line-numbers"&gt;  23 &lt;/span&gt;     rsync -avz --delete --exclude=.svn --link-dest=&lt;span class="Variable"&gt;&lt;span class="Variable"&gt;$&lt;/span&gt;2&lt;/span&gt;/Backup1 -e ssh &lt;span class="Variable"&gt;&lt;span class="Variable"&gt;$&lt;/span&gt;1&lt;/span&gt;/  &lt;span class="Variable"&gt;&lt;span class="Variable"&gt;$&lt;/span&gt;2&lt;/span&gt;/latest/
&lt;span class="line-numbers"&gt;  24 &lt;/span&gt; 
&lt;span class="line-numbers"&gt;  25 &lt;/span&gt;     &lt;span class="Comment"&gt;&lt;span class="Comment"&gt;#&lt;/span&gt;&lt;/span&gt;
&lt;span class="line-numbers"&gt;  26 &lt;/span&gt;     &lt;span class="Comment"&gt;&lt;span class="Comment"&gt;#&lt;/span&gt; Put a date stamp in the backup directory.&lt;/span&gt;
&lt;span class="line-numbers"&gt;  27 &lt;/span&gt;     &lt;span class="Comment"&gt;&lt;span class="Comment"&gt;#&lt;/span&gt;&lt;/span&gt;
&lt;span class="line-numbers"&gt;  28 &lt;/span&gt;     echo &lt;span class="Keyword"&gt;&amp;gt;&lt;/span&gt;&lt;span class="String"&gt;&lt;span class="String"&gt;`&lt;/span&gt;date +$2/latest/Backup-%Y-%m-%d&lt;span class="String"&gt;`&lt;/span&gt;&lt;/span&gt; &lt;span class="String"&gt;&lt;span class="String"&gt;&amp;quot;&lt;/span&gt;Hello Peter&lt;span class="String"&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class="line-numbers"&gt;  29 &lt;/span&gt; }
&lt;span class="line-numbers"&gt;  30 &lt;/span&gt; 
&lt;span class="line-numbers"&gt;  31 &lt;/span&gt; rotate sshusername@ssh.server.address:/var/www/petersblog.org /home/peter/Backup/petersblog.org
&lt;span class="line-numbers"&gt;  32 &lt;/span&gt; 
&lt;/pre&gt;&lt;p&gt;Related Posts: &lt;a href="/tag/backup"&gt;backup&lt;/a&gt; &lt;a href="/tag/debian"&gt;debian&lt;/a&gt; &lt;a href="/tag/rsync"&gt;rsync&lt;/a&gt; &lt;a href="/tag/ssh"&gt;ssh&lt;/a&gt; &lt;a href="/tag/ubuntu"&gt;ubuntu&lt;/a&gt;&lt;/p&gt;</description>
      <guid>http://www.petersblog.org/node/view/957</guid>
      <category domain="http://www.technorati.com/tag">backup</category>
      <category domain="http://www.technorati.com/tag">debian</category>
      <category domain="http://www.technorati.com/tag">rsync</category>
      <category domain="http://www.technorati.com/tag">ssh</category>
      <category domain="http://www.technorati.com/tag">ubuntu</category>
    </item>
    <item>
      <title>Midnight Commander</title>
      <link>http://www.petersblog.org/node/view/945</link>
      <description>&lt;p&gt;
I was missing &lt;a href="http://www.ibiblio.org/mc"&gt;Midnight Commander&lt;/a&gt; in my &lt;a href="/tag/debian"&gt;debian&lt;/a&gt; server setup. Using &lt;a href="/tag/dselect"&gt;dselect&lt;/a&gt; to try to install it and searching for 'midnight' or 'commander' did not find it. Woe. Tried downloading the source but running ./configure complained about missing glibc. Googling revealed some religious wars about gnome bloat and glibc dependancies. 
&lt;/p&gt;
&lt;p&gt;
Out of desperation went back to dselect and searched for 'mc'. This matched umpteen things but eventually I found midnight commander! Installed instantly! The description clearly called it 'midnight commander', no weird spellings, k's in odd places, l33t speak etc. 
&lt;/p&gt;
&lt;p&gt;
Searches for 'midnight' and 'commander' still fail, even after installing it, so what &lt;i&gt;does&lt;/i&gt; the search option in dselect search through? There are 17,000 packages to choose from, a decent search facility is pretty much essential. 
&lt;/p&gt;&lt;p&gt;Related Posts: &lt;a href="/tag/debian"&gt;debian&lt;/a&gt; &lt;a href="/tag/dselect"&gt;dselect&lt;/a&gt; &lt;a href="/tag/lunix"&gt;lunix&lt;/a&gt;&lt;/p&gt;</description>
      <guid>http://www.petersblog.org/node/view/945</guid>
      <category domain="http://www.technorati.com/tag">debian</category>
      <category domain="http://www.technorati.com/tag">dselect</category>
      <category domain="http://www.technorati.com/tag">lunix</category>
    </item>
    <item>
      <title>Awstats setup</title>
      <link>http://www.petersblog.org/node/view/920</link>
      <description>&lt;p&gt;
I set up &lt;a href="tags/awstats"&gt;awstats&lt;/a&gt; on my dedicated server. Awstats is a very comprehensive apache log file analyser that lets me see what has been going on at my site. I mainly use &lt;a href="tags/statcounter"&gt;statcounter&lt;/a&gt; for visitor analysis is it allows me to see precisely what they have been doing, where they came from, which pages they looked at etc. Awstats is more statistics based, giving overall averages and summaries. Also, Awstats tells me about bots and crawlers which statcounter filters out. 
&lt;/p&gt;
&lt;p&gt;
Setting it up amounted to: 
&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;
install awstats package using &lt;a href="tags/dselect"&gt;dselect&lt;/a&gt; 
&lt;/li&gt;
&lt;li&gt;
edit /etc/awstats/conf.local to customise, using settings from /etc/awstats/awstats.conf 
&lt;ul&gt;&lt;li&gt;
point it at my log file 
&lt;/li&gt;
&lt;li&gt;
give it site name 
&lt;/li&gt;
&lt;li&gt;
set log format 1 which appears to be bog standard apache 
&lt;/li&gt;
&lt;li&gt;
exclude me/my ip addresses from stats 
&lt;/li&gt;
&lt;li&gt;
enable reverse DNS to see who is accessing me, not just ip addresses 
&lt;/li&gt;&lt;/ul&gt;

&lt;/li&gt;
&lt;li&gt;
edit /etc/logrotate.d/apache2 and add: 
&lt;div class="verbatim-block"&gt;&lt;pre&gt;# pcw: from awstats faq: run awstats before log file is lost
prerotate
/usr/lib/cgi-bin/awstats.pl -update -config=petersblog.org
endscript
&lt;/pre&gt;&lt;/div&gt;
so log files get processed  before logrotate renames/deletes them 
&lt;/li&gt;
&lt;li&gt;
set up cron job to update stats every three hours. This is to keep awstats database updated and spread out the time it takes 
&lt;div class="verbatim-block"&gt;&lt;pre&gt;10 0,3,6,9,12,15,18,21 * * * /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -config=petersblog.org -update &amp;gt;/dev/null
&lt;/pre&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
set up apache to deny access to awstats from anyone but me. This is for two reasons: 
&lt;ol&gt;&lt;li&gt;
privacy 
&lt;/li&gt;
&lt;li&gt;
awstats has had at least one bad vulnerability in the past that allowed sites to be hacked 
&lt;/li&gt;&lt;/ol&gt;

&lt;/li&gt;&lt;/ul&gt;

&lt;p&gt;
This gives me a better awstats setup than &lt;a href="tags/site5"&gt;site5&lt;/a&gt; gave me as I have enabled the reverse DNS lookup, meaning I see originating site names rather than IP addresses. 
&lt;/p&gt;&lt;p&gt;Related Posts: &lt;a href="/tag/awstats"&gt;awstats&lt;/a&gt; &lt;a href="/tag/debian"&gt;debian&lt;/a&gt; &lt;a href="/tag/oneandone"&gt;oneandone&lt;/a&gt;&lt;/p&gt;</description>
      <guid>http://www.petersblog.org/node/view/920</guid>
      <category domain="http://www.technorati.com/tag">awstats</category>
      <category domain="http://www.technorati.com/tag">debian</category>
      <category domain="http://www.technorati.com/tag">oneandone</category>
    </item>
  </channel>
</rss>
