Ubuntu home server: Notifications by email

This walkthrough tells you how to provide an email service to daemons on a home server so that it can send emails to a server admin's Gmail account.

Key: Actions look like this, results look like this and commands you enter on a terminal look like this. Replace [my_username] with your login on this server e.g. andrew. Replace [external_FQDN] with the domain name that you use to access your server from outside your local network. (FQDN is Fully Qualified Domain Name.) Replace [gmail address] with your normal email address. This should work just as well for non-gmail addresses, but it's a useful distinction to show we'll be sending mail outside our local network.

Pre-requisites:

  • Computer running Ubuntu (This was done on 10.04, but it's fairly standard stuff)
  • Domain name and DNS provider who can make this work - e.g. dyn.com

sudo aptitude install postfix

Postfix installs
Postfix starts its configuration gui

Select defaults for:

  • General type of mail configuration
  • System mail name

sudo dpkg-reconfigure postfix
Postfix starts its configuration gui

Select the following options:

  • General type of mail configuration: Internet Site
  • System mail name: [external_FQDN]
  • Root and postmaster mail recipient: [my_username]
  • Other ...
Read more

Removing Landscape advert from Ubuntu login

To remove the text that says: “Graph this data and manage this system at https://landscape.canonical.com/” while keeping the useful system information, edit the script that puts Landscape information into the message of the day (MOTD):

sudo nano -w /etc/update-motd.d/50-landscape-sysinfo

The last line currently reads:
/usr/bin/landscape-sysinfo

Change this to say (on one line):
/usr/bin/landscape-sysinfo --exclude-sysinfo-plugins=LandscapeLink
Save the file (Ctrl-X, Y, Enter)

Test this by running:
/etc/update-motd.d/50-landscape-sysinfo

It should look like:

  System information as of Tue Nov 24 13:28:10 GMT 2009

System load: 0.0 Memory usage: 37% Processes: 99 Usage of /: 22.5% of 12.92GB Swap usage: 0% Users logged in: 1

Read more

Can't run Crashplan desktop under Ubuntu

I've installed Crashplan on my Ubuntu server (it installed its own JVM) and now I'm trying to start the Crashplan desktop client using X11 forwarding. I get:

$ cat /usr/local/crashplan/log/ui_error.log
com.backup42.desktop.CPDesktop main
SEVERE: Failed to launch CPDesktop; java.lang.UnsatisfiedLinkError: no swt-pi-gtk-3448 or swt-pi-gtk in swt.library.path, java.library.path or the jar file
java.lang.UnsatisfiedLinkError: no swt-pi-gtk-3448 or swt-pi-gtk in swt.library.path, java.library.path or the jar file

Solution: Install Java. Specifically the JRE version 1.5. Unlike this report here it has nothing to do with 32/64 bit conflicts, because it's a 32 bit machine. If you don't want to install Java, and its associated clutter, then you could try following the advice in the Crashplan readme file about running the UI locally and connecting to the remote crashplan service via the service port:

Remote GUI Config of CrashPlan on a shell account: What if you have a remote shell account on a box that has SSH access, but no X windows interface or GUI? We're going to show you how to attach your local desktop CrashPlan UI to the remote ...

Read more

Google Chrome OS for Aunties

As a techie type, my ears pricked up when I heard Google announce their intention to release an operating system. I like noodling around with new software when I get the chance, but my main interest in Google's Chrome OS is not for me. It's for people for whom the phrase, "Open Explorer and go to your Documents folder" is filled with intrigue and mystery.

These are the relatives and friends who frequently get themselves into trouble with viruses, malware and trojans because they view the Internet with innocence and optimism. I'm not at all sure that Google Chrome OS will help them find their "missing" documents (although if any company on Earth could, surely it would be Google) but this caught my eye:

And as we did for the Google Chrome browser, we are going back to the basics and completely redesigning the underlying security architecture of the OS so that users don't have to deal with viruses, malware and security updates. It should just work.

That would be worth its weight in gold. Modern operating systems make a real effort to ensure common tasks are quite easy to perform, but slip up, or stray ...

Read more


Find regular expressions

"Why don't my regular expressions work with the 'find' utility in Linux/Ubuntu/Unix/Cygwin/Posix-environment?"

Short answer: You need -regextype posix-extended

E.g. To find files with either of two file extensions, use: find . -regextype posix-extended -regex '.*\.(xsd|java)'

Want to know the differences between POSIX Extended Regular Expressions and basic ones? Read this excellent resource about regular expressions. Want to test your regular expressions, live, in the browser? Try Regexpal.

Similarly, use egrep instead of grep to enable extended regex functionality and use sed -r instead of sed.

Read more

The problem with Truecrypt and Keepass

…Is that there's no back-door. If I forget the passwords, I'm stuck. I wouldn't change them for the world – they're both great pieces of software that I use lots. It's just that my sieve-for-brain can't remember the Access Codes. I end up with old Truecrypt volumes, file containers and Keepass databases lying all over the place. Still, they (clearly) don't contain anything important, because I haven't missed them.

Read more

Bash prompt

I always forget how to make my bash prompt just the way I like it, so here it is for posterity. In ~/.bashrc:

PS1='\[\e]2;\u@\H \w\a\]\[\e[32m\][\t] \[\e[33m\]\w\[\e[0m\]\n\$ '

On Ubuntu: PS1="\[$(tput bold)\]\[$(tput setaf 1)\][\h]\[$(tput setaf 2)\][\t] \[$(tput setaf 3)\]\w\[$(tput setaf 7 )\]\n\\$ \[$(tput sgr0)\]"

This gives me a prompt like this with the time and path:


[11:00:48] ~/code/database_info
$

And a terminal title like this:
username@host path

Here’s the long guide to the codes, and here’s the one I use from IBM.

Read more

REISUB - the gentle Linux restart

According to Lifehacker a frozen Linux system that's not responding to the Ctrl-Alt-Delete three-finger-salute can be restarted more safely than by pushing the power button, which is usually the next step.

Holding down Alt and SysRq (which is the Print Screen key) while slowly typing REISUB will get you safely restarted. REISUO will do a shutdown rather than a restart.

Sounds like either an April Fools joke or some very strange magic akin to the old BIOS beeps we used to use to diagnose PC faults so bad that nothing would boot. Wikipedia comes to the rescue with an in-depth listing of all the SysRq keys.

  • R: Switch the keyboard from raw mode to XLATE mode
  • E: Send the SIGTERM signal to all processes except init
  • I: Send the SIGKILL signal to all processes except init
  • S: Sync all mounted filesystems
  • U: Remount all mounted filesystems in read-only mode
  • B: Immediately reboot the system, without unmounting partitions or syncing

(Discovered originally here)

Read more

Creating a self-signed SSL certificate

There are some really long-winded ways of creating a self-signed SSL certificate for Apache out there on the Intarweb. Most I don't understand well enough to implement, and the few that were simple enough to implement didn't work.

I'm not sure that this is worth shouting from the rooftops, but I'll stand at a fairly high window and say,

It's really simple, people. The Apache documentation tells us to do this small thing, and it Just Works.

Read more