Author Archive

Rescue data from disk in Ubuntu

I was asked to audit a disk in order to see any deleted file. For this task, I used Ubuntu Rescue Remix, an Ubuntu live CD customized with lots of applications for data recovery and forensics. Using a live CD for data rescuing is really useful, as you won’t be writing any data on the disk, and therefore you won’t overwrite anything you want to rescue. On the other hand, using a live CD you’ll be able to turn on the computer, even if the disk is physically damaged.

Once you’ve loaded the live CD, you’ll be ready to start typing Linux commands as usual. Yet, if you are not using an English keyboard, you’ll probably be interested in changing the keyboard layout. Just type loadkeys and your keyboard’s layout code. For example, if you have a Spanish keyboard execute:

loadkeys es

Remember that these commands must be run with root privileges, so type sudo before every command if the systems complains about permissions.

You may want to store the image in a remote server. Let’s use samba to mount a remote folder.

apt-get install smbfs
mkdir /mnt/recovery
smbmount //SERVERIP/recovery /mnt/recovery/ -o user=sambausername
cd /mnt/recovery

Finally, we create the image using ddrescue. Remember that you will need at least as much room as the capacity of the disk you want to rescue.

ddrescue --no-split /dev/sda image_file log_file

If the disk is damaged you might get better results running successive passes.

sudo ddrescue -r 3 -C /dev/sda image_file log_file

Once you have the image done, you can use Autopsy to recover any data from the disk.

Categories: Uncategorized Tags:

Turn off your laptop and leave the server working

If you usually connect to servers via SSH, you have probably had to wait to finish a time consuming task before you could close the console and therefore, your computer. However, there is at least one way for executing the needed commands on the server and going home. The screen command will help you with that.

The first thing you have to do is logging into the SSH server. That’s easy, you know how to do it:


Once you are in, install screen if you don’t have it yet. As easy as this for an Ubuntu server:

sudo apt-get install screen

Now that you have everything you need, execute screen:


This will open another session in the same terminal.

Perform any task you need now. For example, upload a large file to a remote FTP server:

sftp>put a_big_file.tar.gz
Uploading a_big_file.tar.gz to somewhere in your FTP server very slowly
a_big_file.tar.gz 1% 5KB 1.4KB/s 00:05 ETA

That’s going to take long and you have to leave now, so it’s time to detach the session. Press on your keyboard:

Ctrl + a

and then, to definitely detach the session, press:


The server will keep on uploading the file, but now you can close the SSH connection and turn off your computer.

Tomorrow, when you arrive at the office, you might want to know whether the task was finished correctly. Connect to the server and run:

screen -r

This will resume any previous screen sessions, or will show the screens to be resumed if there are more than one.

Color picker for mobile devices with Flex 4.5

2012/01/02 8 comments

I don’t have much experience with Flex. I’ve just participated in the Babelium Project, a web application for language practising developed in Flex, and now I’ve been asked to port an Adobe AIR desktop application to android devices. In this last work, I came across some problems replacing the unsupported MX components by Spark components and some of them where a pain in the neck.

The ColorPicker was a tricky one to substitute. I found this SparkColorPicker, but I couldn’t make it work correctly on a tablet PC (I told you, I’m far from being an expert). The problem seems to be in the ComboBox which extends, as combo boxes and drop down lists are discouraged in AIR for mobile development. When clicking the button, the DropDown was opened and immediately closed making it impossible to choose a color.

After several attempts to fix the issue, I decided to implement my own color picker using the Callout class. This is how it looks like:

You can see the source code in this github repository:

Categories: Programming Tags: , ,

Don’t hide Unity launcher bar

I’ve been messing around with Ubuntu  11.10 for a couple of weeks and it’s being hard getting used to Unity. One of the things that annoys me the most is when the launcher bar appears suddenly before I can click on a link at the left side of a web page. Nevertheless, the launcher bar can be stuck to the left edge of the screen following these steps that you all might already know:

  • Start the CompizConfig Settings Manager.
  • Select  Ubuntu Unity Plugin under Desktop category.
  • On the tab Behaviour select the value Never for the Hide Launcher property.
Categories: Linux

Linux, MX Revolution and the Middle mouse button

2011/10/24 5 comments

For those who have a MX Revolution mouse and want to configure it correctly in Ubuntu, I recommend them to use a tool called revoco. It is not new and it seems a bit abandoned. Yet it’s the only tool that did exactly what I wanted.

By default, the wheel button of this mouse is set to change between the free spin mode and the click-to-click. However, I prefer it to be in auto spin mode and use the wheel button as the middle mouse button, so that I can paste selected text in Linux and close tabs.

First of all, you must set your mouse (and keyboard if you own a MX 5500 combo) as raw HID. Edit the file /lib/udev/rules.d/62-bluez-hid2hci.rules (the file name may change depending on the system, this is for Ubuntu 11.10) and replace the following text:

KERNEL==”hiddev*”, ATTRS{idVendor}==”046d”, ATTRS{idProduct}==”c70[345abce]|c71[34bc]”, \
RUN+=”hid2hci –method=logitech-hid –devpath=%p”


KERNEL==”hidraw*”, ATTRS{idVendor}==”046d”, ATTRS{idProduct}==”c70[345abce]|c71[34bc]”, \
RUN+=”hid2hci –method=logitech-hid –devpath=%p”

Download revoco’s last version from Untar it, compile it running make and move the compiled binary to /user/local/bin directory.

cd revoco-0.5
mv revoco /usr/local/bin

Finally, run the command to set your mouse in auto spin mode and you’ll have both, the desired scroll wheel mode and the correct middle button configuration.

revoco auto=[speed]

Set the speed you prefer to change between free spin and click-to-click mode. I think 10 is the best value.

Categories: Linux Tags: ,

Read .gz text files on the fly

Logging systems usually compress old logs into Gzip files. Uncompressing those files to check old logs can be a pain in the neck, specially if you don’t know which file contains the entries of a specific date. The zless command will help you a lot with this task. For example, to read Tomcat’s compressed logs you just have to execute:

zless catalina.out.1.gz

You will see the content of the compressed file as if you were using the less command.

Categories: Commands, Linux Tags: , , , ,

Rotate a single page in a PDF file

First, install pdftk:

apt-get install pdftk

To rotate the 19th page 180º:

pdftk input_file.pdf cat 1-18 19D 20-end output output_file.pdf

input_file.pdf: The path of the PDF file you want to modify.
cat 1-18 19D 20-end: Create a new PDF using these parts from the input file:

  • Pages from 1 to 18, let them as they are.
  • Rotate the 19th page 180º.
  • Pages from 20 to the end, let them as they are.

output_file.pdf: The path of the new PDF that will be created.

The rotation degrees are:

  • D: 180º.
  • L: 90º to the left.
  • R: 90º to the right.
Categories: PDF Tags: