Thursday, September 23, 2010

Taking a Screenshot in Ubuntu

$ sudo apt-get install imagemagick
$ import MyScreenshot.png

Click and drag the rectangle you'd like a photo of.

Banning IP Addresses

Running an SSH server on an open public port attracts attacks.

If you have disabled password login then the attacks shouldn't be that successful, but they do fill your logfiles with records of every attempt.

This is both amusing and a nuisance.

Once you're bored of watching,

$sudo apt-get install fail2ban

fail2ban is a general security thingy, but the default installation on Ubuntu is set up to watch for unsuccessful ssh connections. Too many from an IP address, and the IP address gets banned for a while.

So now your attack logs should grow more slowly.

Thanks Gareth!

Sunday, September 19, 2010

Linux Firewall

to enable a firewall under Ubuntu:

$sudo ufw enable

to allow ssh:

$ sudo ufw allow 22

to check:


$ sudo ufw status

Using an alternative DNS server, e.g. Google DNS

You can add a preferred DNS server by editing dhclient.conf

$ sudo vi /etc/dhcp3/dhclient.conf

add the line:

prepend domain-name-servers 8.8.8.8;

to use Google's public DNS at 8.8.8.8

Tuesday, September 7, 2010

Ubuntu One Purge and Reinstall

Being a glutton for punishment, I thought I'd try and use Ubuntu One for firefox bookmarks.

I'm not going to trust it with files any time soon, but how wrong can bookmarks go?

First, I had to unbork the completely screwed setup on my laptop. Here's how I did it:



First, turn it off, and then make a backup copies of existing synchronised things on all machines. Just in case.

Then, go to your Ubuntu One account, and cut off your machine from the central sync server.

If you're paranoid, you could even disconnect from the network at this point.

Once you've got your local setup cornered and alone, it can do no further damage to the central files.

The trick now is to hunt down the debris it has left all over your home directory, and kill it all:

$ sudo rm -rf ~/.local/share/ubuntuone
$ rm -rf ~/.cache/ubuntuone
$ rm -rf ~/.config/ubuntuone


Then under Application/Accessories/Passwords and Encryption Keys, find and destroy the UbuntuOne token.

That should put you back into the default state.



Epilogue. That seemed to work a treat. But no bookmark synchronization. Apparently it's broken. Bloody shed.

Monday, September 6, 2010

Swap Commands

list active swap partitions
swapon -s
turn them all off
swapoff -a
turn them all on
swapon -a

Comment taper à la machine en Français / Typing French on Ubuntu Linux with an English Keyboard

System/Preferences/Keyboard
Use :

United Kingdom International with Dead Keys

é   apostrophe, then e
è   funny ` on the top left of the keyboard, then e
ê   ^ then e
ç   AltGr+=, then c

To produce ^, `, ¸, ´, press the key twice.

Theres a nice little applet, the gnome keyboard indicator, that allows you to switch quickly
between layouts if you find yourself needing to type lots of apostrophes.

There are lots of other characters on this keyboard for European Latin-based scripts. Mañana.

From System/Preferences/Keyboard, you can print out the following keyboard map, which was how I eventually found the elusive ç.

UK International Keyboard with Dead Keys 

Sunday, September 5, 2010

Ubuntu 10.04.1 LTS USB boot conflict disable in BIOS

This may be paranoid or superstitious, but I've noticed that booting Ubuntu often fails if there are USB devices plugged in at boot time. Since I've an external DVD drive, external hard disk, and a USB wireless dongle, this is quite a problem!

I've tried turning off USB support in the BIOS and that seems to cure it.
In fact the boot process seems faster and more reliable.

It doesn't seem affect Ubuntu's ability to access USB hardware at all.

Of course, in order to boot off a DVD, it needs to be turned it back on!

Saturday, September 4, 2010

Encrypted Swap

Install loop-aes
$ sudo apt-get install loop-aes

list swap partitions
$ swapon -s

Modify fstab
$ sudo vi /etc/fstab

before:
/dev/hda2 none swap sw 0 0
after:
/dev/hda2 none swap sw,loop=/dev/loop7,encryption=AES256 0 0

Now either reboot so that the system picks up the changes, or:

turn swap off
$ sudo swapoff -a

turn swap back on
$ sudo swapon -a