linux poison RSS
linux poison Email

File recovery tool for Ext2/Ext3 filesystems

giis (gET iT i sAY) is a file recovery tool for Ext2/Ext3 filesystems. Once installed, current files and newly created files can be recovered. It allows users to recover all deleted files, recover files owned by a specific user, dump data from old file locations, and recover files of a specific type, such as text or PNG. A forensic analyzer is also provided to assist users during recovery.
giis won FOSS India Award 2008 (aka LinuxAsia 2008)
 * Recover files Deleted Date on specific date or deleted before/after specific date or even within specific date range.
 * Recover files with their original access permission types and file owner and group details.
 * User friendly configuration file which supports adding new directories even after installation.
 * Recover deleted files of all users.
 * Recover deleted files of a specific user.
 * Recovery of files based on the File type (gif,mp3,jpeg)
 * Recovers deleted hidden files or system files.
 * Recovers Dropped mysql tables.
 * Forensic analyzer is provided to assist data dump from the harddisk.
 * If original path of deleted file exists,Recovered files automatically restored back to their appropriate directories.
 * Provides list of deleted files and it's restore path
 * If contents are modified or overwritten , during recovery user has the option to compare to old file data with current disk data using giis dump option.
 * Displays your current file system details.
 * If file is modified ,it allows user to decide whether to retrieve latest version of deleted file or older version.
 * Allows user to choose directories (other than /root and /home) that can be protected by giis.
 * All newly created files and directory are added,as time limit specified in crontab.

Installation on OpenSuse 11.1
Download Latest Version - giis_4.4

Install giis binary just follow the steps:
1) Change giis directory

        cd giis_XX (Replace XX with appropriate version number for example giis_4.4)

2) Run the shell script named '',

        For interactive installation use: sh 0
        For non-interactive: sh 1

And after successful installation here is the detail explanation on how to use giis - here
Read more

How to read hard disks temperature

hddtemp utility will give you the temperature of your hard drive by reading data from S.M.A.R.T. on drives that support this feature. Only modern hard drives have a temperature sensor. hddtemp supports reading S.M.A.R.T. information from SCSI drives too. hddtemp can work as simple command line tool or as a daemon to get information from all servers.


Opensuse - Go to yast >> Software management and search for "hddtemp", select the package and accept and install it.

You can also perform source code installation. Download source code here.
Copy the tarball into the /usr/src/ directory on your linux box. From a command prompt, change into the /usr/src/ directory, and un-tar the tarball:
cd /usr/src
bunzip2 hddtemp-0.3-beta15.tar.bz2
tar xvf hddtemp-0.3-beta15.tar
Change into the newly created directory:
cd hddtemp-0.3-beta14
Compile and install hddtemp:
./configure --with-db-path=/etc/hddtemp.db
make install

Getting Data
The next task is to verify that hddtemp can retrieve the temperature from your hard drives.
Test hddtemp by running the following (replacing /dev/sda with a valid hard drive in your linux box):
 # hddtemp /dev/sda
/dev/sda: ST3802110A: 46°C
and see if a temperature is reported.

If you have more than one hard drive in your linux box, repeat this for each additional physical hard drive, to determine which ones hddtemp can obtain a temperature reading.
Read more

KDE 4.2 on Windows (Installation & Configuration)

The KDE on Windows Project is aimed at native porting of the KDE applications to MS Windows. Currently Windows 2000, XP, 2003 and Vista are supported.

The preferred way of installing KDE apps under Windows is the KDE-Installer.

When you run KDE-installer for the first time, you'll see the welcome screen. Since it's your first launch leave the checkbox below unchecked. Proceed to the next screen, where you choose the KDE4 installation directory. It can be anything you prefer, e.g. C:\KDE4.

On the next screen, define who you are: End User or Developer. The End User installation installs only binary packages and libraries needed to run KDE application. Developer mode provides you with the source code for all packages needed to build KDE from scratch.

Proceed to the next screen and there choose the directory where all the downloaded packages will be stored. Let it be something like C:\KDE4-tmp or C:\KDE4-packages.

The next screen will ask you to choose your internet connection type, particularly whether or not you're using a proxy. If you don't use a proxy server, just click 'Next'. If you are unsure of whether you're using proxy or if you have web browser configured to work with it properly, choose the second or the third option, according to your favourite web-browser. If you'd like to set all the settings manually - choose the last option and go ahead.

When you click the 'Next' button the (currently, rather short) list of available servers will be loaded and you could choose the one closest to you.

When you click 'Next' again, the list of all available packages will be loaded and processed, providing you with the list of package groups you can select for further installation. The short description next to each group of packages should make your choice easier. Select the packages you need. Proceed to the next screen.

Here you can see all the required dependencies, or software necessary to support the choices you've made. Click 'Next' to download them all.

After all the packages are downloaded they'll be unpacked and processed by the installer. The final window will tell that your KDE installation for Windows is complete.

When the installation completes, you can find KDE applications at Programs -> KDE 4.2.00 Release in the Windows Start Menu. You can also use the installer to remove KDE on Windows. Since all the files are in the same directory, the removal is trouble-free.

If something goes wrong during installation, for example a file can't be replaced because it is still in use, the installer may still report successful completion. If you see any alert or failure message from the installer, when it completes, quit and re-run it.
Read more

Bluetooth Device Manager - Blueman

Blueman  is a GTK+ Bluetooth Manager
Blueman is designed to provide simple, yet effective means for controlling BlueZ API and simplifying bluetooth tasks such as:

* Connecting to 3G/EDGE/GPRS via dial-up
* Connecting to/Creating bluetooth networks
* Connecting to input devices
* Connecting to audio devices
* Sending/Receiving/Browsing files via OBEX
* Pairing

Blueman also integrates with Network Manager 0.7, so any Dialup/Network connections will be made available (via HAL) to Network Manager.

apt sources.list entries for Ubuntu

1) Jaunty Jackalope
deb jaunty main
deb-src jaunty main

2) Interpid Ibex
deb intrepid main
deb-src intrepid main

3) Hardy Heron
deb hardy main
deb-src hardy main

Other distribution:
Download and compile the source code - here
How to create binary from source code - here
Read more

How to configure Linux as Internet Gateway for small office

This tutorial shows how to set up network-address-translation (NAT) on a Linux system with iptables rules so that the system can act as a gateway and provide internet access to multiple hosts on a local network using a single public IP address. This is achieved by rewriting the source and/or destination addresses of IP packets as they pass through the NAT system.

[Note] The location of the files (ifcfg-ethx, network. etc ..) mentioned below might be different in different distribution, check the manuals of your distribution to edit the correct file.

Step by Step Procedure

Step 1. Add 2 Network cards to the Linux box

Step 2. Verify the Network cards, check if they installed properly or not

Step 3. Configure eth0 for Internet with a Public (External network or Internet)
# cat ifcfg-eth0
BROADCAST=xx.xx.xx.255    # Optional Entry
HWADDR=00:50:BA:88:72:D4    # Optional Entry
NETMASK=    # Provided by the ISP
NETWORK=xx.xx.xx.0       # Optional
GATEWAY=xx.xx.xx.1    # Provided by the ISP
Step 4. Configure eth1 for LAN with a Private IP (Internal private network)
# cat ifcfg-eth1
HWADDR=00:50:8B:CF:9C:05    # Optional
NETMASK=        # Specify based on your requirement
IPADDR=        # Gateway of the LAN
NETWORK=        # Optional
 Step 5. Host Configuration    (Optional)
# cat /etc/hosts       nat localhost.localdomain   localhost

Step 6. Gateway Configuration
# cat /etc/sysconfig/network
    GATEWAY=xx.xx.xx.1    # Internet Gateway, provided by the ISP
Step 7. DNS Configuration
# cat /etc/resolv.conf
    nameserver      # Primary DNS Server provided by the ISP
    nameserver      # Secondary DNS Server provided by the ISP
Step 8. NAT configuration with IP Tables
First of all you have to flush and delete existing firewall rules. So flush rules by typing in terminal:
iptables -F
iptables -t nat -F
iptables -t mangle -F
Now delete these chains:
iptables -X
iptables -t nat -X
iptables -t mangle -X
# Set up IP FORWARDing and Masquerading
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables -A FORWARD -i eth1 -j ACCEPT
# Enables packet forwarding by kernel (save this setting in /etc/sysctl.conf file)
echo 1 > /proc/sys/net/ipv4/ip_forward
 #Apply the configuration
service iptables save
service iptables restart
 # Check if iptables is set to start during boot up
chkconfig –list iptables
 Step 9. Testing
Ping the Gateway of the network from client system: ping
Try it on your client systems: ping

Configuring PCs on the network (Clients)
All PC's on the private office network should set their "gateway" to be the local private network IP address of the Linux gateway computer.
The DNS should be set to that of the ISP on the internet.

Windows 2000, XP,  Configuration:
Select "Start" + Settings" + "Control Panel"
Select the "Network" icon
Select the tab "Configuration" and double click the component "TCP/IP" for the ethernet card. (NOT the TCP/IP -> Dial-Up Adapter)

Select the tabs:
"Gateway": Use the internal network IP address of the Linux box. (
"DNS Configuration": Use the IP addresses of the ISP Domain Name Servers.
"IP Address": The IP address (192.168.XXX.XXX - static) and netmask (typically for a small local office network) of the PC can also be set here.
Read more

How to Create and Configure robot.txt for Apache web server

"Robots.txt" is a regular text file that through its name, has special meaning to the majority of "honorable" robots on the web. By defining a few rules in this text file, you can instruct robots to not crawl and index certain files, directories within your site, or at all. For example, you may not want Google to crawl the /images directory of your site, as it's both meaningless to you and a waste of your site's bandwidth. "Robots.txt" lets you tell Google just that.

1) Here's a basic "robots.txt":
User-agent: *
Disallow: /
With the above declared, all robots (indicated by "*") are instructed to not index any of your pages (indicated by "/"). Most likely not what you want, but you get the idea.

2) you may not want Google's Image bot crawling your site's images and making them searchable online, if just to save bandwidth. The below declaration will do the trick:
User-agent: Googlebot-Image
Disallow: /
3) The following disallows all search engines and robots from crawling select directories and pages:
User-agent: *
Disallow: /cgi-bin/
Disallow: /privatedir/
Disallow: /tutorials/blank.htm
4) You can conditionally target multiple robots in "robots.txt." Take a look at the below:
User-agent: *
Disallow: /
User-agent: Googlebot
Disallow: /cgi-bin/
Disallow: /privatedir/
This is interesting- here we declare that crawlers in general should not crawl any parts of our site, EXCEPT for Google, which is allowed to crawl the entire site apart from /cgi-bin/ and /privatedir/. So the rules of specificity apply, not inheritance.

5) There is a way to use Disallow: to essentially turn it into "Allow all", and that is by not entering a value after the colon(:):
User-agent: *
Disallow: /
User-agent: ia_archiver
Here all crawlers should be prohibited from crawling our site, except for Alexa, which is allowed.

6) Finally, some crawlers now support an additional field called "Allow:", most notably, Google. As its name implies, "Allow:" lets you explicitly dictate what files/folders can be crawled. However, this field is currently not part of the "robots.txt" protocol, so use it only if absolutely needed, as it might confuse some less intelligent crawlers.

Per Google's FAQs for web-masters, the below is the preferred way to disallow all crawlers from your site EXCEPT Google:
User-agent: *
Disallow: /
User-agent: Googlebot
Allow: /
Finally this file (robot.txt) must be uploaded to the root accessible directory of your site, not a subdirectory (eg. it is only by following the above rules will search engines interpret the instructions contained in the file.

Read more

Keep Your Processes Running Despite A Dropped Connection

I guess you all know this: you are connected to your server with SSH and in the middle of compiling some software (e.g. a new kernel) or doing some other task which takes lots of time, and suddenly your connection drops for some reason, and you lose your labor. This can be very annoying, but fortunately there is a small utility called screen which lets you reattach to a previous session so that you can finish your task.

Installing screen
The installation of screen is very easy. On OpenSuse system go to yast >> software management and search for package "screen" click on "accept" and install the software

I guess that for Fedora, CentOS, SuSE, and Mandriva there are also screen packages that you can install with yum/yast/urpmi/...

Using screen
With screen you can create one or more sessions in your current SSH terminal. Just run
screen to start it. This creates a screen session or window (although you don't see it as such) in your current SSH terminal:

Press Space or Return to get to the command prompt: Looks like your normal SSH terminal, doesn't it?

Now I'm going to describe the most important screen commands that you need to control screen. These commands begin with CTRL a to distinguish them from normal shell commands.

Ctrl a c - Creates a new screen session so that you can use more than one screen session at once.
Ctrl a n - Switches to the next screen session (if you use more than one).
Ctrl a p - Switches to the previous screen session (if you use more than one).
Ctrl a d - Detaches a screen session (without killing the processes in it - they continue).

To close a screen session where all tasks are finished you can type: exit
Now let's play around with it a little bit. In our screen window we run the command: top
Now let's create another screen session by typing: Ctrl a c
A new, blank screen session opens, and there we run: tail -f /var/log/mail.log

Now you can browse your two screen sessions by running: Ctrl a n or Ctrl a p
To detach a screen session and return to your normal SSH terminal, type: Ctrl a d
Back on your normal SSH terminal, you can run: screen -ls to get a list of your current screen sessions:
There are screens on:
        2477.pts-0.server1      (Detached)
        2522.pts-0.server1      (Detached)
2 Sockets in /var/run/screen/S-root.
To reconnect to one of these sessions, run: screen -r 2477.pts-0.server1
where 2477.pts-0.server1 is the name of one of the sessions from the screen -ls output.

To leave and finish a screen session, finish all current tasks in it (top can be finished by typing q, tail -f /var/log/mail.log can be finished by typing CTRL c) and then type: exit

You will then fall back to another screen session (if you use more than one) or to the normal SSH terminal, if no more screen sessions are open. If you want to learn more about screen, run
man screen

My Connection Dropped - What Can I Do?
Now let's assume you compile a kernel in a screen session, something which normally takes a long time, and suddenly your connection drops. Thanks to screen your work isn't lost. Once your connection is back up, log in to your system with SSH again and run: screen -ls

From the results pick one session (e.g. 2477.pts-0.server1) and reattach to it: screen -r 2477.pts-0.server1

If you picked the right session, you should find your kernel still compiling (if it hasn't finished in the meantime) so that you can continue your work.
Read more

How to measure and read disk activity

Open terminal and fire following command
# cat /sys/block/sda/stat
186908    41568  6033917  2408504    91198   509600  4882200  9406764        0  1161304 11848624

Field  1 -- # of reads issued
This is the total number of reads completed successfully.

Field  2 -- # of reads merged, field 6 -- # of writes merged
Reads and writes which are adjacent to each other may be merged for efficiency.  Thus two 4K reads may become one 8K read before it is ultimately handed to the disk, and so it will be counted (and queued) as only one I/O.  This field lets you know how often this was done.

Field  3 -- # of sectors read
This is the total number of sectors read successfully.

Field  4 -- # of milliseconds spent reading
This is the total number of milliseconds spent by all reads (as measured from __make_request() to end_that_request_last()).

Field  5 -- # of writes completed
This is the total number of writes completed successfully.

Field  7 -- # of sectors written
This is the total number of sectors written successfully.

Field  8 -- # of milliseconds spent writing
This is the total number of milliseconds spent by all writes (as measured from __make_request() to end_that_request_last()).

Field  9 -- # of I/Os currently in progress
The only field that should go to zero. Incremented as requests are given to appropriate request_queue_t and decremented as they finish.

Field 10 -- # of milliseconds spent doing I/Os
This field is increases so long as field 9 is nonzero.

Field 11 -- weighted # of milliseconds spent doing I/Os
This field is incremented at each I/O start, I/O completion, I/O merge, or read of these stats by the number of I/Os in progress (field 9) times the number of milliseconds spent doing I/O since the last update of this field.  This can provide an easy measure of both I/O completion time and the backlog that may be accumulating.

Note, this is device specific.
Read more

How to deny root ssh login

Don't allow root to login remotely.  Instead, the admin could login as another account, then, "su -".  However, root can still login "from the local terminal".

In the "/etc/ssh/sshd_config" file change the following lines:

        Protocol 2
        PermitRootLogin no
        PermitEmptyPasswords no

Then, restart ssh: /etc/init.d/sshd restart

Why would you want to do this?  It's not possible for anyone to guess or keep trying the root account.  This is especially good for computers on the Internet. So, even if the "root" passwords is known, they can't get access to the system remotely.  Only from the terminal, which is locked in your computer room. However, if anyone has a account on the server, then, they can login under their  account then "su -".

Suppose you only want a limited number of users:  "user1" and "user2". Add the following line to "/etc/ssh/sshd_config". Note, this allows access for chirico and donkey, but everyone else is denied.

         #  Once you add AllowUsers - everyone else is denied.
         AllowUsers user1 user2
Read more

How to enable audioscrobbler for xmms2

After having switched my default music player to xmms2, I needed to enable the scrobbling of my tracks to Because you have to install some packages and because there isn't a gui to configure the audioscrobbler client, I thought I would post this. You probably wouldn't be here if you didn't know xmms2 (!=xmms), but if you don't, you can read more about it here.
Installing the packages
The name of the audioscrobbler client is xmms2-scrobbler. You can get it from the repositories. Except for one, all dependencies will be taken care of by apt. The additional package we need is called libevent-loop-ruby. So we do:
sudo apt-get install xmms2-scrobbler libevent-loop-ruby
Configuring the client
The client tries to read the configuration in ~/.xmms2/ instead of ~/.config/xmms2/ where the files are located. So we make a symlink:
ln -s ~/.config/xmms2 ~/.xmms2
Next we have to create a directory where the configuration files of the scrobbler client will reside.
mkdir -p ~/.config/xmms2/clients/xmms2-scrobbler
In this new directory we have to create a file for your credentials.
nano ~/.config/xmms2/clients/xmms2-scrobbler/config
In this file we enter only the following 2 lines:

Save en exit (CTRL-x, y, ENTER)
After this we have to symlink the actual xmms2-scrobbler script to the startup directory of xmms2, so that it will start at the launch of xmms2.
ln -s /usr/bin/xmms2-scrobbler ~/.config/xmms2/startup.d/
Now restart xmms2 if it was running, or just start it if it wasn't and check your profile:
xmms2 quit
Sometimes xmms2 doesn't start and gives errors instead. This is probably because the daemon is still running. To kill the daemon do
ps aux | grep xmms2d
Then kill the xmms2d daemon
sudo kill PID_OF_XMMS2D_HERE
Read more

How to Install Ubuntu on USB Drive

Did you know that is ridiculously simple to install Ubuntu onto an external USB flash drive?

If you have a copy of the latest version of Ubuntu (at the time of writing that is 8.10), there is a very simple program that does it all for you.

You will need:

    * An Ubuntu 8.10 CD (or ISO image if already installed)
    * A USB drive with at least 700-800 MB free space

While you are booted into Ubuntu, go to System > Administration > Create a USB startup disk.

You’ll need to choose the source disc image for Ubuntu. If you have your Ubuntu CD in the drive, this should appear in the list, so make sure it is selected. Alternatively, you can click ‘Other’ and specify where the .iso image of the Ubuntu CD is.

Next, plug in your drive and choose it as your destination drive (and double-check it’s the right drive before going ahead).

You can also choose how much space will be reserved for saving data on the new drive, or turn data storage off (it will act just like the Ubuntu live CD).

That’s it! Simply press Make Startup Disk and wait while the files are copied over.

Installing Ubuntu on USB Disk

On many modern PCs that are configured to allow USB boot, you should be able to just restart the machine with the USB drive plugged in and Ubuntu should boot straight from it!
It’s a nice simple way to have a copy of Ubuntu in your pocket, wherever you go.

Read more

Measuring the performance/latency of OpenSuse system - LatencyTOP

Skipping audio, slower servers, everyone knows the symptoms of latency. But to know what's going on in the system, what's causing the latency, how to fix it... that's a hard question without good answers right now.

LatencyTOP is a Linux* tool for software developers (both kernel and userspace), aimed at identifying where in the system latency is happening, and what kind of operation/action is causing the latency to happen so that the code can be changed to avoid the worst latency hiccups.

There are many types and causes of latency. LatencyTOP focuses on the type of latency that causes skips in audio, stutters in your desktop experience or that overloads your server (while you have plenty of CPU power left).

LatencyTOP focuses on the cases where the applications want to run and execute useful code, but there's some resource that's not currently available (and the kernel then blocks the process). This is done both on a system level and on a per process level, so that you can see what's happening to the system, and which process is suffering and/or causing the delays.

Go to yast -- software management and search for pacakage "LatencyTOP" after getting the results select the pacakage and install it

After successful installation goto console and fire command (root) : # latencytOP and check/monitor the process and their activities.

LatencyTOP measures the average and maximum amount of latency in various operations by inserting annotation calls in the kernel

A list of process names runs along the bottom of the display, which can be selected with the arrow keys. The latency sources for that process will then be shown in the lower pane
Read more

How to Recover your Ubuntu password

First of all, if you forget your admin Ubuntu password, you will need physical access to the PC in order to recover your password.

Usually Ubuntu install in the grub menu this option:
title        Ubuntu 8.10, kernel 2.6.27-7-generic (recovery mode)
uuid        393ac665-f5c2-488d-b601-b59ba1d5675b
kernel        /boot/vmlinuz-2.6.27-7-generic root=UUID=393ac665-f5c2-488d-b601-b59ba1d5675b ro  single
initrd        /boot/initrd.img-2.6.27-7-generic
That text is part of my /boot/grub/menu.lst of my Ubuntu Linux, so first go to the easiest way to recover the password in Ubuntu.

1. Reboot your system
2. When it is starting, press ESC to get the grub menu
3. Select the option that says (recovery mode)
4. In the next dialog select the root prompt, and get access to a console shell
5. type
passwd admin-username
Remember to change the bold text by your username in Ubuntu, the one that has admin rights.

6. reboot your system, and you are done!

Now Going to the not so easy way, in case you do not have the recovery mode option.

Follow the same procedure as above until step 2.

3. Press e to edit
4. Select the line that starts with kernel...
5. Press e again.
6. Go to the end of the line and add single
7. Press ENTER
8. Press b to boot that kernel, with the single option.
9. Change password, and reboot.

Hope it helps.

Read more

Hard disk drive health inspection tool - GSmartControl

To check whether smartmontools and smartctl has been installed properly , issue the following command in the terminal window (root):
# smartctl -i /dev/sda2
Note : Replace sda2 with your hard disk device file

This should show detailed information about your hard disk, for example in my case I got the following output:

Once everthing is working fine, we can go-ahead and install the GUI for smartctl - "GSmartControl"

GSmartControl is a graphical user interface for smartctl (from Smartmontools package), which is a tool for querying and controlling SMART (Self-Monitoring, Analysis, and Reporting Technology) data on modern hard disk drives. It allows you to inspect the drive's SMART data to determine its health, as well as run various tests on it.


* Automatically report and highlight any abnormal SMART information.
* Ability to enable / disable SMART.
* Ability to enable / disable Automatic Offline Data Collection - A short
* self-check that the drive will perform automatically every four hours with no
impact on performance.
* Ability to set global and per-drive options for smartctl.
* Display drive identity, capabilities, attributes, error and self-test logs.
* Perform SMART self-tests.
* Ability to load smartctl output as a "virtual" device, which acts just like a
real (read-only) device.
* Works on most smartctl-supported operating systems.
* Extensive help information.


openSUSE: One-click install for 11.1, One-click install for 11.0, One-click install for 10.3
Debian GNU/Linux:

Other's can download the source code - here and build and install with:
./configure; make; make install
Run gsmartcontrol-root to invoke gsmartcontrol with your desktop's su mechanism, or use the desktop menu entry, you should see something like ...

Double click on the drive to see the other various details, you can also run the test on the drive ..

Read more
Related Posts with Thumbnails