SSH Password Prompt Timeout

When try-ing to ssh into a linux server from a machine that doesn’t have reverse dns setup you might fall intro the situation where your ssh connection times-out befor you get the password prompt.

In this case, on the server, in sshd_config add the following line to solve your issue:

UseDNS no

Leave a Comment

HowTo: force umount a busy device in linux

Here’s how :

When you try to umount the regular way, if a device is busy you’ll get the following :

dev:/# umount /dev/sda1
umount2: Device or resource busy
umount: /boot: device is busy

This can be solver very easy by entering this :

dev:/# umount -l /dev/sda1

Comments (1)

Useful iproute2 comands in linux

While reading the Link Advanced Routing and Trafic Control howto i decided to extract a list of useful commands, in case i forget them later. I’ve posted them here for whoever finds’em useful.

ip link show - shows the available interfaces on your machine

ip address show – shows the IP addresses attached to your interfaces.

ip route show – shows the available routes on your machine.

ip neigh show – shows the current information in your ARP cache.

ip rule – shows the routing tables active on yout machine.

ip route list table table_name – lists the rules available in a specific table

ip rule add from 10.0.0.1 table table_name – adds a new rule in the table_name table.

ip route add default via 200.100.50.25 dev eth0 table table_name – adds a default route on a specific table.


Leave a Comment

HowTo: Test the link on your network cards in linux

If you work remote and want to test if the link is up or not on your linux interfaces use mii-tool.

If the thing is not already installed on your machine, if you run debian simply use apt-get install mii-tool . After the tool in installed just type mii-tool in your console.

Example:

server1:~# mii-tool
eth0: negotiated 100baseTx-FD flow-control, link ok
eth1: negotiated 100baseTx-FD, link ok
eth2: negotiated 100baseTx-FD, link ok
eth3: negotiated 100baseTx-FD, link ok

Leave a Comment

HowTo: write circular text with php and gd

I had a project in which I had to generate an image based on a string. The problem was that the text had to be displayed circulary. After hours of internet searching I’ve came across http://www.phpgd.com and found this piece of code which did the job quite nicely.

<?php

$text = “Around and around around and around and around “;

$image = imagecreatetruecolor(400,400);
$white = imagecolorallocate($image,255,255,255);
imagefill($image,0,0,$white);
$red = imagecolorallocate($image,255,0,0);

$degrees = (360/strlen($text));

for ($i=0;$i<strlen($text);$i++) {

$a = ($degrees*$i)+180;

$cos = cos(deg2rad($a));
$sin = sin(deg2rad($a));
$x = 0;
$y = 180;
$xt = round($cos*($x) – $sin*($y));
$yt = round($sin*($x) + $cos*($y));
imagettftext($image,20,180-($a),200+$xt,200+$yt,$red,”fonts/arial.ttf”,$text[$i]);

}

header(“Content-type: image/jpeg”);
imagejpeg($image,”",100);
imagedestroy($image);

?>

Here is the direct link to the script http://www.phpgd.com/scripts.php?script=25. You might look through the site because there are other many interesting scripts which may come useful in your projects.

Enjoy!

Leave a Comment

HowTo: Install guest additions for VirtualBox on Debian Lenny 5.0

I have the following setup. The Host machine is running Windows Vista 64 with VirtualBox.

I’ve installed Debian Lenny 5.0 from a NetCD and now i want to install the guest additions modules. The guest additions are very useful because they have a lot of usability features like: copy-ing/pasting from the guest system to the host sistem, you can fly the mouse pointer in and out of the guest system and so on.

On the VirtualBox menu go to Devices and click Install Guest Additions. This will mount a virtual cd in your linux guest system. Go to your cd-rom ( which also has the guest additions for windows ) :

cd /cdrom and run ./VBoxLinuxAdditions-x86.run.

You might get an error about installing linux kernel headers and build packages. That can easily be solved by using apt-get :

apt-get install build-essential linux-headers-`uname -r`

the ‘uname -r’ will autocomplete the kernel needed kernel version.

After this rerun the ./VBoxLinuxAdditions-x86.run and it should all go well. Reboot the debian system and enjoy the magical guest additions.

Leave a Comment

HowTo: Disable yellow colored inputs in firefox because of google toolbar

You might have noticed that once installed, google toolbar will automatically fill with yellow the e-mail inputs in your nicely developed website. Now this might be ruining your design and functionality when you’ve got a dark background and a light color for the inputed text ( white or yellow ).

You can easily get rid of this so called “feature” by adding the following in the css style for your input:

background: #(your own color code) !important;

Adding “!important” will force the browser to use your code instead of the google toolbar color.

Enjoy !

Leave a Comment

dk_eom(): resource unavailable: d2i_PUBKEY_bio() failed

Ok, i’ve gotten this error while trying to implement DomainKeys on one of my servers.  I’m using a debian etch with postfix amavis and dk-filter for signing emails. The errors i was getting in the logfiles were:

dk_eom(): resource unavailable: d2i_PUBKEY_bio() failed
SSL error:0D06B08E:asn1 encoding routines:ASN1_D2I_READ_BIO:not enough data

After searching a while over the internet i’ve figured out i was getting this error because the selector TXT DNS record was incomplete. I am using ISPconfig3 with MyDNS and the MyDNS field in the ispconfig database was limited to 116 characters. The TXT DNS record had 230. I had to modify the database structure.

This error can also occur when you copy/paste the public key from your public key file to the dns record. Be careful not to have any white-spaces or line-breaks in it.

After fixing your selector wait for the dns to refresh so it’ll see your new dns record.

Hope this helps you out cause i lost half a day trying to figure it out.

Leave a Comment

mydns: out of memory: Cannot allocate memory error

MyDNS was working great on my machine until i’ve decided to implement DomainKeys and DKIM support for my e-mail system. As you probably know DKIM and DomainKeys require a long TXT record with a public key to be inserted in the DNS.

MyDNS started giving me problems when i was query-ing the DNS for this TXT record which has around 230 characters. MyDNS was crashing with the following log entry:

mydns: out of memory: Cannot allocate memory

The solution for this was replacing MyDNS 1.0.0 with the brand new MyDNS-NG ( Next Generation ) 1.2.8.26. Everything came back to normal now and It’s working like a charm.

You can get the mydns-ng 1.2.8.26 from here : http://sourceforge.net/projects/mydns-ng/

Leave a Comment

HowTo: Completely Remove Debian Applications With apt-get

I have a testing server on which i fool around and test things.

I had to completely remove postfix from my server to reinstall it using other settings. Here’s how i did it :

apt-get –purge remove postfix

This will completely whipe out postfix from your server along with it’s dependencies.

I’ve been looking over for this for a long time. Hope it helps you too.

Leave a Comment

Web Brands