Pages

Saturday, May 12, 2007

Fork Bomb

A fork bomb works by creating a large number of processes very quickly in order to saturate the available space in the list of processes kept by the computer's operating system.

Canonical forkbombs include this one on Unix (using the Bash shell) :
ragner(){ ragner|ragner& };ragner

Or in Microsoft Windows using a batch file:

:s
start %0
goto s

Or using Perl:

(forking using the Perl interpreter):
perl -e "fork while fork" &

Or in C:

#include 

int main(void)
{
while(1) {
fork();
}
return 0;
}

Reference

http://www.answers.com/topic/fork-bomb

How to configure Debian Brazilian locale

Configure your xserver, here is the xorg:
# dpkg-reconfigure xserver-xorg

My keyboard layout "us" and own variant "us_intl"
$ cat /etc/X11/xorg.conf
...
Section "InputDevice"
Identifier "Generic Keyboard"
Driver "kbd"
Option "CoreKeyboard"
Option "XkbRules" "xorg"
Option "XkbModel" "pc104"
Option "XkbLayout" "us"
Option "XkbVariant" "us_intl"
EndSection
...

Now configure your locales and select the default:
# dpkg-reconfigure locales

Reboot your system:
# init 6

Friday, May 11, 2007

Printing with multiple pages

First, put n pages at each leaf with mpage comman:

$ mpage -n a.ps > b.ps

* n can to be 2, 4 or 8

To reverse the pages:
$ pstops "2:0@1.0(-0.00cm,0.0cm),1U@1.0(21cm,29.7cm)" b.ps > c.ps

Configuring Postfix to do smtp/relay

# aptitude install postfix sasl2-bin

  Edit /etc/postfix/main.cf

#
# Transport com relay autenticado
#

smtp_sasl_auth_enable = yes
smtp_sasl_security_options = noanonymous
smtp_sasl_password_maps = hash:/etc/postfix/saslpass

Edit /etc/postfix/saslpass

smtp.servername userlogin:password

Then, run:

  # postmap /etc/postfix/saslpass
# postfix reload
References

http://www.postfix.org/

Configurando o Postfix pra fazer smtp/relay autenticado

Monday, May 7, 2007

Configuring Wireless Connection

After you read Configuring Wireless 2100 Driver for Linux

Install wireless tools:
# aptitude install wireless-tools

Scanning wireless network:
# iwlist eth1 scanning
eth1 Scan completed :
Cell 01 - Address: 00:13:60:17:3D:60
ESSID:"netid"
Protocol:IEEE 802.11b
Mode:Master
Channel:1
Encryption key:off
Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s
Quality:50 Signal level:0 Noise level:0
Extra: Last beacon: 204ms ago


# iwconfig eth1 essid netid

#dhclient eth1

Configuring Wireless 2100 Driver for Linux

# aptitude install ipw2100-modules-[kernel version]
* LOADING FIRMWARE VIA HOT-PLUG

Before you can load the driver, you need the firmware image. You can find
instructions for obtaining the firmware by going to:

http://ipw2100.sf.net/firmware.php.

Once you have the firmware, unzip the archive. You should find seven (4)
files within it:

LICENSE A copy of the firmware license
ipw2100-(version number).fw Boot strap image
ipw2100-(version number)-i.fw Used in IBSS mode
ipw2100-(version number)-p.fw Used in monitor mode

You need to place all of these files into the hotplug firmware directory,
e.g. /usr/lib/hotplug/firmware/ or /lib/firmware/. Check the contents
of the /etc/hotplug/firmware.agent to determine the specific location for your
distribution.

Reference

http://ipw2100.sourceforge.net/INSTALL

Friday, May 4, 2007

Installing really the Debian Linux in the USB pen drive

Create USB partitions
# cfdisk /dev/sda
# mkfs.ext3 /dev/sda1


Mount the sda1 partition where will be installed the basic dist.
# mount -t ext3 /dev/sda1 /media/usb

Install the basic debian with debootstrap:
# debootstrap etch /media/usb http://ftp.br.debian.org/debian

Copy your source.list :
# cp /etc/apt/sources.list /media/usb/etc/apt/

Install the grub in the /dev/sda:
# grub-install --recheck /dev/sda
...
(fd0) /dev/fd0
(hd0) /dev/hda
(hd1) /dev/sda

Copy your grub configurations:
# mkdir -p /media/usb/boot/grub
# cp /boot/grub/* /media/usb/boot/grub

Set up the grub boot:
# grub
grub> root (hd1,0) # define the first partition of the pen driver as root
grub> setup (hd1) # install the GRUB in the MBR
grub> quit

Change the roor dir to the USB:
# chroot /media/usb

All commands below are in the USB pen driver as root dir.
Update the list of the packages:
# aptitude update

Install the grub:
# aptitude install grub

Install the kernel image:
# aptitude install kernel-image
Create a symbolic link to the current kernel image?

You are attempting to install an initrd kernel image ...
This will not work unless you have configured your boot x loader to use initrd. ...
Do you want to abort now?

Update the grub and configure the menu.lst with the new kernel:
# update-grub

# vim /boot/grub/menu.lst
---
## ## End Default Options ##

title Debian GNU/Linux, kernel 2.6.18-4-686
root (hd0,0)
kernel /boot/vmlinuz-2.6.18-4-686 root=/dev/sda1 ro
initrd /boot/initrd.img-2.6.18-4-686
savedefault

title Debian GNU/Linux, kernel 2.6.18-4-686 (single-user mode)
root (hd0,0)
kernel /boot/vmlinuz-2.6.18-4-686 root=/dev/sda1 ro single
initrd /boot/initrd.img-2.6.18-4-686
savedefault

### END DEBIAN AUTOMAGIC KERNELS LIST
---

Set the fstab:
# vim /etc/fstab
---
# /etc/fstab: static file system information.
#
#
proc /proc proc defaults 0 0
/dev/sda1 / ext3 defaults,errors=remount-ro 0 1
/dev/sda2 none swap sw 0 0
---

Set the hostname:
# vim /etc/hostname
---
usb
---

Configure the network:
# vim /etc/network/interfaces
---
# Used by ifup(8) and ifdown(8). See the interfaces(5) manpage or
# /usr/share/doc/ifupdown/examples for more information.

auto eth0
iface eth0 inet dhcp
---

Configura all basic configurations:
# dpkg-reconfigure -a
1 - Do you want system wide readable home directories?
2 - Packages that use debconf for configuration share a common look and feel. You can select the type of user interface they use.
Interface to use: Dialog
3 - Debconf prioritizes the questions it asks you. Pick the lowest priority of question you want to see:
Ignore questions with a priority less than: high
4 - Should man and mandb be installed 'setuid man'? No
5 - Enable shadow passwords?

6 - Create users and password.

7 - Running 'tzconfig' to set this system's timezone.
Your current time zone is set to Unknown
Do you want to change that? [n]: y

choose your locale at the menu.
2
Manaus

Exit from USB:
ragner-desktop:/# exit

Umount the USB pen driver with the new dist:
ragner-desktop:/media/usb# cd

ragner-desktop:~# umount /media/usb
umount: /media/usb: device is busy

If occur the error above:
ragner-desktop:~# ps -ef | grep root
...
root 20007 1 0 08:48 ? 00:00:00 /usr/sbin/cron
...
ragner-desktop:~# kill -9 20007

ragner-desktop:~# umount /media/usb


Reboot our system:
# init 6

Set the BIOS to do the boot by the USB pen driver.




How to add sudo user.

chmod +w /etc/sudoers

vim /etc/sudoers
---
root ALL=(ALL) ALL
ragner ALL=(ALL) ALL
---

chmod 440 /etc/sudoers

Changing the default window manager in Linux.

How to change the default window manager (KDE, Gnome, fluxbox, etc.) in Debian:

Symlinks in /etc/alternatives point to various "default" programs.

To change the default window manager look /etc/alternatives/x-session-manager symlink.

You can also use
update-alternatives --list x-session-manager
update-alternatives --config x-session-manager

Wednesday, May 2, 2007

Mounting lvm + crypt filesystem

Depends:
lvm2 and cryptsetup packages.
dm-mod module.

#modprobe dm-mod
#cryptsetup luksOpen /dev/HARDDISK DEVICENAME
#lvmdiskscan
#vgchange -ay
# ls -l /dev/mapper
crw-rw---- 1 root root 10, 63 May 2 11:43 control
brw-rw---- 1 root disk 254, 0 May 2 11:50 DEVICENAME
brw-rw---- 1 root disk 254, 3 May 2 11:58 vgcrypt-lvhome
brw-rw---- 1 root disk 254, 1 May 2 11:58 vgcrypt-lvroot
brw-rw---- 1 root disk 254, 2 May 2 11:58 vgcrypt-lvscratch

#mount /dev/mapper/vgcrypt-lvroot /hda/root/


References

How to encrypt a diskdrive in (X)Ubuntu Feisty with dm-crypt and LUKSLink

How to mount a Logical Volume from another drive in LinuxLink
DM-Crypt riseup labsLink