Archive for September, 2010

Backup in Linux

September 29th, 2010 No comments

Hello all Linux users out there!

Here are some tips how to backup your system. Backup is really important but is often ignored.

Look at
Think again to backup the system!!!

Amanda is a great Open Source backup solution if you’re willing to spend the time to learn how to set it up. It works very well, and there’s good support from their mailing lists.


BackupPC is also a nice solution for backups in Debian/Ubuntu. It should work on all Linux as well.


Bacula is another backup solution which can handle tape robots and disk staging. It can be compared to Legato Networker and similar big expensive products.


CloneZilla is a free (GPL) Software. It’s like an Open Source version of Symantec (Norton) Ghost. Filesystem supported: ext2, ext3, ext4, reiserfs, xfs, jfs of GNU/Linux, FAT, NTFS of MS Windows, and HFS+ of Mac OS. Therefore you can clone GNU/Linux, MS Windows and Intel-based Mac OS, no matter it’s 32-bit (x86) or 64-bit (x86-64) OS. For these file systems, only used blocks in partition are saved and restored. For unsupported file system, sector-to-sector copy is done by dd in Clonezilla.

LVM2 (LVM version 1 is not) under GNU/Linux is supported.
Multicast is supported in Clonezilla SE, which is suitable for massively clone. You can also remotely use it to save or restore a bunch of computers if PXE and Wake-on-LAN are supported in your clients.


Mondo is comprehensive. Mondo supports LVM 1/2, RAID, ext2, ext3, ext4, JFS, XFS, ReiserFS, VFAT, and can support additional filesystems easily: just e-mail the mailing list with your request. It supports software raid as well as most hardware raid controllers. It supports adjustments in disk geometry, including migration from non-RAID to RAID. Mondo runs on all major Linux distributions (RedHat, RHEL, SuSE, SLES, Mandriva, Debian, Gentoo) and is getting better all the time. You may even use it to backup non-Linux partitions, such as NTFS. Mondo is free! It has been published under the GPL v2 (GNU Public License), partly to expose it to thousands of potential beta-testers but mostly as a contribution to the Linux community.


Arkeia could be a commercial alternative. Manages cross platform but ain’t free, although they offer a free test for very small Linux users:

Arkeia Network Backup, Free Edition is fully-featured and is not time-limited. One free, perpetual license is granted per individual (for personal use) or per company (for corporate use) and only web registration is required. The no-cost license includes:

  • One backup server for any Linux distribution,
  • Two backup agents to protect two machines including Windows workstations and any Linux, Mac OS X and BSD machines,
  • Support of up to 250GB capacity for backup to disk,
  • Support of any single tape drive for backup to tape, and
  • Technical Support via on-line forums, knowledgebase, and Arkeia’s documentation wiki


Backup your hard drive over the network with dd and ssh

Since hard disks on unix systems are just represented as files you can do exact copies of them with it. It’s strength is really it’s weakness. It copies all the data on the disk if you tell it to copy your harddrive. That means everything. Even data that is was on the disk before but was not written over. Unless you wipe the disk with a disk wiping program (writing zero’s across it) the previous data (if there was any) is still there. Copying every bit means it takes a very long time. We are talking hours to copy a disk. But your copy is exact. Partition info, boot sector info, everything.

I wanted to copy everything off the disk and send it over the network. So we can do it with ssh. First zero out the non used space on the running disk to make compressing the image much eaiser. Using the command (if you have 20MB of free space on your hard drive):

dd if=/dev/zero of=0bits bs=20M; rm 0bits

Then boot knoppix (or any other bootable linux distro like sysrescuecd) from the machine you want to image and give the command:

dd if=/dev/sda | gzip -1 – | ssh user@hostname dd of=image.gz

Assuming sda is your hard drive. This sends the local disks data to the remote machine. To restore the image boot knoppix on the machine to restore and pull the image that you created and dump it back with the command (assuming you want to restore to the hard drive called /dev/sda – BEWARE! This can damage your present data if you’re making a misstake when typing the output device name!):

ssh user@hostname dd if=image.gz | gunzip -1 – | dd of=/dev/sda

This will usually take a few hours so be prepared.


Categories: Linux Tags:

Installera trådlöst wifi i CentOS

September 28th, 2010 No comments

Install pro/wireless 3945abg on Linux Centos

Check that you have the wireless card:

# ifconfig -a

wlan0     Link encap:Ethernet  HWaddr 00:ED:3C:57:F3:DC
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

Then look in the following links:

Categories: Linux, Red Hat / CentOS Tags:

Utveckling av cross-platform program

September 27th, 2010 No comments

Tips på program för att utveckla cross-platform:

GNU compiler: MinGW

GUI framework: wxWidgets

GUI builder: wxFormBuilder

IDE: Code::Blocks ( )

Categories: Programmering Tags:

Hämta program med apt-get

September 14th, 2010 No comments

Have you tried to install whatever programs you need from the repositories?
$ aptitude search whatever # will show all available packages (installed or not installed) that include “whatever” in their name.
$ aptitude show whatever # will show details about package named “whatever”
$ sudo aptitude install whatever # will install package whatever
$ sudo aptitude remove whatever # will remove package whatever

Ubuntu’s server edition is very basic, so server admins can install precisely what they want. If you want a graphical desktop environment, try
$ sudo aptitude install ubuntu-desktop # for a Gnome-based desktop environment, or
$ sudo aptitude instsall kubuntu-desktop # for a KDE-based desktop environment.

Categories: Linux, Ubuntu Tags:

Säkerhet i Linux

September 13th, 2010 No comments

Guide för säkerhet i Fedora (bra tips även för andra distar)


Säkerhetstips för Apache


Buck-Security är en säkerhetsskanner för Debian/Ubuntu

Buck kan kolla följande saker på ditt system:

  • Filer och kataloger som är skrivbara för alla
  • Program som har setuid eller setgid satt
  • umask
  • sticky-bit för /tmp
  • Letar adminkonton
  • Brandväggsregler
  • Kollar om SSH är säkrat
  • Skapar/kontrollerar checksummor för systemprogram
  • Letar efter installerade attackpaket

Ladda ner programmet från och packa upp arkivet. Kör sedan scriptet som admin:

sudo ./buck

Program för att hantera säkerhet i Linux

  • selinux
  • iptables/netfilter
  • Firewall Builder (bra GUI som kan hantera flera datorer samtidigt)
    — Ref:
  • apparmor
  • smack
  • Tomoyo Linux
  • grsecurity
  • Bastille Linux (Mjukvara för att kontrollera säkerheten i din Linuxinstallation)
    — Ref:
Categories: Linux Tags:

Loggning i Linux

September 13th, 2010 No comments

To redirect standard output to a file is easy, you just need to use the redirection symbol, for example:

echo "hello world" > test.txt

But what if I want to display it out as well as store into a file?
Answer: tee

echo "hello world" | tee test.txt

Okay it seems very easy, how about append?

To append the standard output to a file, you do this:

echo"hello world" >> test.txt

Append to file and display it out as well?

echo"hello world" | tee -a test.txt

Okay, how about dealing with standard output(stdout) and standard error(stderr)?
There are two different output stream, one is stdout and another one is stderr. Normal print usually goes to stdout and error related message will goes to stderr. Lets make a simple python script to print 1 line to stdout and 1 line to stderr.

#!/usr/bin/env python

import sys

sys.stdout.write("I am stdout\n")
sys.stderr.write("I am stderr\n")

Ok, lets save the python script as and try to redirect the output to a file.

$ ./ > test.txt
I am stderr

Standard output is redirect to test.txt but stderr is print out.

What if I want stderr to be redirect and display the stdout?

 ./ 2> test.txt

I want both stored into the file.

 ./ 2&> test.txt

At last, I want both display and redirect to a file:

 ./ 2>&1 | tee test.txt


Categories: Bash, Linux, Programmering Tags:

Rättigheter i Linux

September 10th, 2010 No comments

Each user account on a UNIX host computer has a unique user name and primary group name. To identify your user name and primary group name, connect to your UNIX host using a terminal or terminal emulator and type id at the host prompt.

Note the following:

  • The UNIX host computer uses a system of numbers called User Identifications (UIDs) and Group Identifications (GIDs) to track individuals and group members. User and group names are provided by the operating system to simplify administration. UIDs and GIDs and their corresponding names can be viewed in the /etc/passwd and /etc/groups files on the UNIX host computer. See your UNIX host documentation or man pages for more information.
  • Illegal characters or formatting problems in the /etc/groups or /etc/passwd file can cause access problems. Problems in these files can also affect NIS maps, if NIS is used for authentication. To determine if there are errors in either of these files, run the grpck and pwck UNIX utilities.

The grpck and pwck UNIX utilities will detect problems in the /etc/groups and /etc/passwords files respectively. Use the hosts man pages to determine how to run grpck and pwck.


Categories: Linux Tags:

Tips på bra program till Windows

September 9th, 2010 No comments

Program för att automatiskt uppdatera Windows drivrutiner: DriverMax 5.31

Program för att uppdatera över 1 273 000 program ($30): UpdateStar

Categories: Windows Tags:

Linux för nybörjaren

September 8th, 2010 No comments

Tips på Linuxdist som liknar Windows – Zorin ( )

Har stöd för Windowsprogram från början, massor av codecs, Win7 / XP utseende och enkel filåterställning med “Back in time”.

En annan bra nybörjardist är Linux Mint ( )

Categories: Linux Tags:

Börja programmera i Linux

September 8th, 2010 No comments

Du kan testa följande utvecklingsmiljöer för att se om någon passar dig:

  • Anjuta
  • Monodevelop
  • KDevelop 4 ( screenshot )
  • Eclipse
  • Gnustep

Installation KDevelop i Ubuntu 10.04:

Enable “Unsupported Updates” in your software repositories. After enabling you’ll be able to find KDevelop in your Synaptic Package Manager.

Categories: Linux, Programmering Tags: