Archive for February, 2011

The 3.1 Kindle firmware update is now available. Key features of this update include: -

1. Public Notes: You now have the ability to share your book notes and highlights available for others to see.
2. Real Page Numbers: Finally. I don’t know what that location number rubbish means usually, but this is a much-needed touch.
3. Before You Go Feature: When you reach the end of the book, you can immediately rate the book, share a message about the book with your social network, get personalized recommendations for what to read next, and see more books by the same author.

So, a minor update and still no word on improving the PDF support (although I’m thankful to have it at all). See the above link for update instructions and links to the update itself.

Update 05-03-2011: Yes, the Kindle does run Linux as it’s operating system :-) Linux-2.6.10 to be exact. I only found out after catching up on my Linux Outlaws podcasts. Sorry!

About 150,000 Gmail users logged in over the weekend to find that everything had gone – email, chat logs, contacts, and attachments. Google is apparently working to restore the accounts but in the meantime, take it as another vivid reminder of the flimsy nature of the Cloud and the value of local backups. Here, I show you how to backup your GMail account using Linux and GetMail

First, of course, you need to install GetMail if it isn’t already installed on your system. If you’re using Ubuntu, type: -

sudo apt-get install getmail4

If you’re using Fedora, type: -

yum install getmail

If you’re not using either of these, you can do the install manually with: -


cd /tmp
wget http://pyropus.ca/software/getmail/old-versions/getmail-4.20.0.tar.gz
tar xzvf getmail*.tar.gz
cd [the directory that was created]
sudo python setup.py install

Next you need to change some settings in your GMail account by turning on POP3 which will allow the downloading of your e-mails. Because you want a copy of all your mail, I recommend that you choose the “Enable POP for all mail” option. On the “When messages are accessed with POP” option, I would choose “Keep Gmail’s copy in the Inbox” so that Gmail still keeps your email after you back up your email.
There are a couple well-known methods to store email in UNIX-based systems – mbox and Maildir. When mail is stored in mbox format, all your mail is concatenated together in one huge file. In the Maildir format, each email is stored in a separate file. Needless to say, each method has different strengths and weaknesses. The mbox format is convenient because you only need to keep track of one file, but editing/deleting email from that huge file can be a pain in the balls. And when one program is trying to write new email while another program is trying to edit the file, things can sometimes go wrong unless both programs are careful. Maildir is more robust, but it chews through inodes because each email is a separate file. It also can be harder to process Maildir files with regular Unix command-line tools, just because there are so many email files.

I’ll cover both options here.

mbox format

Make a directory called “.getmail” in your home directory with the command:-

mkdir ~/.getmail

This directory will store your configuration data and the debugging logs that GetMail generates. Next, make a directory called gmail-archive with the command:-

mkdir ~/gmail-archive

This directory will store your email. Then you need to make a file with the following:-

vi ~/.getmail/getmail.gmail

…and put the following text in it:-


[retriever]
type = SimplePOP3SSLRetriever
server = pop.gmail.com
username = bob@gmail.com # replace with your GMail username!
password = bobpassword # replace with your GMail password!

[destination]
type = Mboxrd
path = ~/gmail-archive/gmail-backup.mbox

[options]
# print messages about each action (verbose = 2)
# Other options:
# 0 prints only warnings and errors
# 1 prints messages about retrieving and deleting messages only
verbose = 2
message_log = ~/.getmail/gmail.log

From the above, you’ll see that you need to create the file path under [destination] with the command: -

touch ~/gmail-archive/gmail-backup.mbox

If you change the path in the file above, touch whatever filename you used. This command creates an empty file that GetMail can then append data to.

Maildir format

You’d still run “mkdir ~/.getmail” and “mkdir ~/gmail-archive”. But the Maildir format uses three directories (tmp, new, and cur). We need to make those directories with the following:-


mkdir ~/gmail-archive/tmp
mkdir ~/gmail-archive/new
mkdir ~/gmail-archive/cur

As above, make a file: –

vi ~/.getmail/getmail.gmail

…and put the following text in it:-


[retriever]
type = SimplePOP3SSLRetriever
server = pop.gmail.com
username = bob@gmail.com
password = bobpassword

[destination]
type = Maildir
path = ~/gmail-archive/

[options]
# print messages about each action (verbose = 2)
# Other options:
# 0 prints only warnings and errors
# 1 prints messages about retrieving and deleting messages only
verbose = 2
message_log = ~/.getmail/gmail.log

You’ll notice only the [destination] part has changed from the mbox format example above. Then you run GetMail with a command such as: -

getmail -r /home/bob/.getmail/getmail.gmail

With any luck, you’ll see something like:-


getmail version 4.6.5
Copyright (C) 1998-2006 Charles Cazabon. Licensed under the GNU GPL version 2.
SimplePOP3SSLRetriever:bob@gmail.com@pop.gmail.com:995:
msg 1/99 (7619 bytes) from delivered to Mboxrd /home/bob/gmail-archive/gmail-backup.mbox
msg 2/99 (6634 bytes) from delivered to Mboxrd /home/bob/gmail-archive/gmail-backup.mbox

99 messages retrieved, 0 skipped
Summary:
Retrieved 99 messages from SimplePOP3SSLRetriever:bob@gmail.com@pop.gmail.com:995

GMail will only allow you to download a certain number of mails at once. You can repeat the command but remember to let GetMail finish each time before you run it again, until all of your email is downloaded.

While you can backup GMail manually simply by running the above command, it would be nice if Linux automatically updated it’s backup of your GMail account whenever you got new mail. This can be achieved by setting up a cron job. Create a new script file on your system with the following command:-

vi fetch-gmail.sh

and put the following lines in that file:-


#!/bin/bash
# Note: -q means fetch quietly so that this program is silent
/usr/bin/getmail -q -r /home/bob/.getmail/getmail.gmail

Remember to replace /home/bob with your actual Linux account home directory path! :-) Make sure that the file is readable/executable with the command: –

chmod u+rx /home/bob/fetch-gmail.sh

If you want to make sure the program works, run the command

/home/bob/fetch-gmail.sh

The program should execute without generating any output, but if there’s new email waiting for you it will be downloaded. This script needs to be silent or else you’ll get warnings when you run the script using cron. Now you’ll need to set up the cron job for this script by using:-

crontab -e

and add the following lines:-


# Every hour at 5 minutes past the hour, fetch my email from GMail.
5 * * * * /home/bob/fetch-gmail.sh

This crontab entry tells cron “Every hour, run the script fetch-gmail.sh”. You can obviously set cron to run the script and check your mail backups as often as you like.

That’s it – you’ve successfully configured Linux to backup your GMail account. Feel smug!

An Android smartphone is an extremely useful device to have when you have to administer a Linux server. Here, I’ll show you some of the apps from the Android Market that I’ve found useful when interfacing with my Linux server at home and generally keeping your Android device secure. Unless stated, all of these apps are free.

1. ConnectBot – This is a free SSH client for Android which (as you’d expect) allows you to SSH into a terminal session on your server from your Android phone. Very simple to set up and works well with the standard Android software keyboard.

2. SSHDroid – Conversely, you can use this little app to SSH from your PC or server into your Android phone. This starts as a service and allows you to connect to your Android phone via SSH and SCP. Useful if you’ve forgotten your USB cable :-)

3 BotSync – This is useful to backup your Android phone. It acts much like rsync does (discussed in an earlier post) by syncing data on your phone to a directory on your remote Linux server. You set the login details such as host, user and password and the directories to backup (for example your phone’s SD card) and the time limit to check for items to sync and let it go to work. Extremely useful!

4. AndFTP – This is a very simple to use FTP, FTPS, SCP and SFTP client for Android. Since I’ve discussed how to set up Linux to act as an FTP server, you can compliment this set up with this FTP client so you can access and upload your files (from your phone’s camera perhaps) directly to your Linux server from anywhere. Best FTP client I’ve found in the Market.

5. OS Monitor – Not strictly anything to do with interfacing with Linux, but this neat little app will tell you loads of information about your Android device, from network interface activity to process monitoring.

6. Lookout – Smart phones these days are pretty much just mini PCs, so it makes sense with more and more of people’s lives being held in these tiny devices to protect them properly – even if Android is Linux-based! :-) This app will automatically scan new software for malware on install, find your lost or stolen phone by locating it on a Google Map, activate a loud alarm to find your phone nearby, even if it is on silent and (coolest of all) locate your phone by remotely enabling GPS, so you can find your phone even if GPS is turned off. Pretty much the first app you should be installing.

7. AVG Antivirus Pro – Although not free – the app costs £6.21, this is well worth purchasing and continues AVG’s excellent products in the mobile world. Like Lookout above, it can scan apps, settings, files, and media in real time, find your lost or stolen phone and locate it on a map and back up and restore all your valuable apps and data. Not only that, but it can eliminate tasks that slow your phone down, lock or wipe your phone remotely via SMS or via AVG’s Mobile Control Panel. You can even set a lock screen message to help the locator find you if somebody finds your phone. Well worth the money, frankly.

8. Chrome to Phone – While both the Android operating system and the Chrome browser are made by Google, shockingly there is no way to sync your Chrome bookmarks to Android’s browser. While I’m hopeful that Google will rectify this in a future Android update, in the meantime there is Chrome to Phone, which consists of a Chrome extension which you can grab from the Google WebStore here. Once you’ve installed the extension and the app, you can send any link from your Chrome browser straight to your Android device with one click. Handy!

9. Network Discovery – This handy network tool will allow you to scan your local wifi network for hosts and then run a security port scan to see what services are available. Useful for probing wifi networks :-)

PodGrab, my open source command line RSS Podcast downloader, has been updated to version 1.0.1. This update simply fixes a few bugs. If you’ve downloaded it before, please get the new version here

Android has had a very successful 2010, despite heavy fragmentation that has brought to the fore the different ideologies of both Google and Apple. On the one hand you have the walled-garden approach of Apple which controls everything from the hardware up to what mobile apps are deemed acceptable and on the other you have the corporate champion of “open source”, Google. While this is obviously a biased blog towards a free and open Internet future, it’s hard not to have a certain sympathy for Apple’s approach when looking at the chaos of the Android platform. However, while you get a stress-free Apple experience on iOS, you also lose some of the charm and innovation that Android’s Linux kernel roots bring to the table. With this in mind, I bought myself the “official” Google smartphone for this generation – the Google Nexus S.
Unlike the HTC-built Nexus 1 – the first generation “Google phone” – The Nexus S is manufactured by Samsung and is based on the successful Galaxy S. Hardware-wise the only difference between the Galaxy S and the Nexus S is the notable absence of an SD-card slot on the Nexus, although the 16GB of storage should mean this isn’t much of a problem. Both models run the 1Ghz Hummingbird processor which makes the Nexus far faster than the N1.
Software-wise however, the Nexus S boasts the distinction of being the first smartphone to run Android 2.3 Gingerbread and will doubtless be the only Android device to run it in it’s pure “Google form” without the added bloat of carrier-added overlays.

The Nexus S is a fine smartphone in it’s own right but (more importantly) is the current-generation Google Android reference device. I’ll be adding tutorials, articles and code on Android when I’ve played with the thing a little longer – in the meantime, check out the videogames for Android developed by Hexage, pretty much everything they’ve coded for Android is pure gold :-)

Search The Node
XBox LIVE Gamertag
The Node Downloads
Mini Tweets

Switch to our mobile site