Archive for June, 2007


IPTables: Filtering by MAC Address

June 29, 2007

If we want filter a MAC in our firewall, we can use IPTables to this. For example, if we want to filter a MAC like 00:12:8D:EE:6E:AB (Must type the MAC with this format -> HH:HH:HH:HH:HH:HH) and deny their access to our Firewall we can put type this:

iptables -A INPUT -m -mac --mac-source 00:12:8D:EE:6E:AB -j DROP

Also, we can use the ! operator, wich inverts the operation, for example, if we type:

iptables -A INPUT -m -mac --mac-source ! 00:12:8D:EE:6E:AB -j DROP

All the packets will be dropped, except the packets from 00:12:8D:EE:6E:AB MAC.


Burning CD from Linux console

June 26, 2007

I founded this great link about making CD images, burning images, etc. The text use APT to install some applications, but you can install it manually.…


How to install XFCE4 on Debian

June 25, 2007

I installed using a 3.1 version (Sarge), but i upgraded to 4.0 Etch. Then, i needed to install a light window manager in my old computer (Athlon 1GHZ). XFCE is one of the most important and i have wanted to try it for a long time!.

Then, lets play :D. The first, you will need some packages to install it. You can obtain it using APT.

First, make sure you’ve the following:

  • GCC (GNU C/C++ compiler, 4.2.0 is the last version at this time)
  • bzip2 data compressor
  • libgtk2.0-dev (GTK+ runtime libraries)
  • libxpm-dev
  • libsm-dev
  • libice-dev
  • pkg-config (It’s a tool to manage and compile libraries)

Before you install (or not!) this packages, download the last version of the XFCE installer from a mirror (Like -> XFCE on SF). You can use “wget” to download to your hard drive. At the time of this writing, the last version is 4.4.1, and the installer file have this name ->

The final step its too easy. Simply, log with “root” or use “sudo” command, and type this:


Before this, the package will be uncompressed (Showing dots in the screen..), and will show a screen with a welcome message, like a typical assistant.

At this point, you only must follow the instructions and XFCE will be installed on your system 🙂 .

I had some issues during the installation. One of them, shows something like this error.

(installer-gui:3721): Gtk-WARNING **: cannot open display:

To solve this, make sure your GTK+ runtime libraries, are > 2.0 version. Try this command “apt-get install-f libgtk2.0-dev”

I’d other error, which shows this message after much more “warnings” about fonts.

could not open default fontfixed

To solve this, type “apt-get install xfonts-base”.

Before this, you can start XFCE typing “startxfce4”.

Enjoy your new desktop 😛 !



How to: Installing GRUB

June 24, 2007

GRUB is one of the most important OS loader. I think it’s very simply and useful, but we must know some tricks to install and configure in our hard drive.

In GRUB the drives are called hd0, hd1, hd2, … For example, if have a single disk, their name will be “hd0”.

To install it, first, we go to GRUB 2 download page and download it (In a floppy disk or pendrive, for example). After this, and our directory /boot its on a independent partition, we type this (With root rights):

/sbin/grub-install –root-directory=/boot /dev/hda 

If we’ve all directories in / (Or something like / and /home partitions), we must type:

/sbin/grub-install /dev/hda

It’s very simply! 😀

If we want configure our GRUB, we need edit the file “/boot/grub/menu.lst”. In this file we’ve some examples of GRUB configuration. Usally, we can use something like this:

title           Debian GNU/Linux, kernel 2.4.27-2-386
root            (hd0,1)
kernel          /boot/vmlinuz-2.4.27-2-386 root=/dev/hda2 ro
initrd          /boot/initrd.img-2.4.27-2-386

Title = Only a title to know the OS which will load in that option.

root = Show the partition wich is installed. In this example, Debian are installed in the first drive of the system (hd0), and the second partition (1).

kernel = Have the path of the kernel of the OS.  The first parameter have the path of the kernel file in the disk. The second parameter have the partition disk which is installed the kernel, and the third (“ro”)  means,”read only”.

initrd = Shows the kernel image path. Usally have the same path than the kernel line.

boot = When GRUB read this, it launch the OS according the kernel path and parameters we put.

On more thing. To load a Windows system we must type this in  “/boot/grub/menu.lst”:

title           Microsoft Windows OS
root            (hd0,0)
chainloader     +1

Supposing you’ve the Windows partition in the first drive (hd0), and the first partition (0).

See you.


APT basic commands

June 24, 2007

I’m testing Debian (The best distro 😉 ) 4.0 “Etch” in one computer of my LAN, and i decided to do a quick commands list about APT.

To install a package:

  • apt-get install [package_name]

Reinstalling a package:

  • apt-get –reinstall install [package_name]

Removing a package (Will remove all the dependencies of the package):

  • apt-get remove [package_name]

Removing a package, and delete ALL about the package (Configuration files, doc files, etc):

  • apt-get –purge remove [package_name]

Updating the APT source list (/etc/apt/sources.list )

  • apt-get update

Upgrading our packages to the last know version:

  • apt-get -u upgrade

Upgrading our distro version:

  • apt-get -u dist-upgrade

Searching a package:

  • apt-cache search [name]

There’s much more commands and options in APT, if you need a specific option, look the official APT doc.

See you Debianitas 😉


How to use “runas” utility

June 23, 2007

Much people use an administrator account everyday… but they probably dont know, that it is a dangerous use in our system For example, some sypware, trojans and “bad software” uses administrator privileges to have access to the internal Windows system files. Okey, we’ve the solution to this. You must use your system running as a limited user, and using “runas” command to install and manage applications.

But, What is “runas”? Is a Windows utility which allows run a program using the rights of other system user, like administrator.

I’ll show here, a examples of use of runas command.

If we want to execute an application or install it, we must type this:

runas /user:[admin_account] [app_dir]

For example, if we want install a program wich installer is on a “C:\myApp\” directory and our administrator user is called “MeAdmin”we must type this:

runas /user:MeAdmin C:\myApp\install.exe

Before this, we will type the administrator password, and the setup will run with administrator privileges.

I you need for example, use de MMC console, you can run as administrator too

runas /user:administrator mmc.exe

And my favourite trick, consists in obtain a CMD of the admin user, which we will be able have total access to our system with all privileges. In this command, i included the computer name. This is very important if we’re using a Workgroup.

runas /user:MyComputer\administrator cmd.exe

All this command looks good… but, some people hates command terminals like CMD (MS-DOS), *NIX shell, etc. Don’t worry, we can launch applications using “runas” from our desktop. Just do right clickwhile you’re pressing shift over the executable you choose, and select “Run as…” option. A window like this (i’m using a Spanish Windows XP) will be open:



Type the administrator (Or another account with admin privileges) and click Accept.



Changing an account password [Win]

June 23, 2007

Open a command terminal (go to Start -> execute and type cmd.exe).

Now, in the terminal type:

net user [account_name] *

Now the system will ask about the new password. To do this, you need administrative privilegies.