Saturday, May 23, 2009

How to enable log rotation on Linux ?

logrotate is a program which will automatically backup your old log files and gzip them. You can specifiy how often logrotate should backup your logfiles and how long it should keep them. The advantage of logrotation is that you can save disk space without the deletion of log files. The logrotation can be configured for automatic rotation, compression, removal, and mailing of log files.

The default configuration file is /etc/logrotate.conf

# see "man logrotate" for details
# rotate log files weekly

# keep 4 weeks worth of backlogs
rotate 4

# create new (empty) log files after rotating old ones

# uncomment this if you want your log files compressed

# RPM packages drop log rotation information into this directory
include /etc/logrotate.d

# no packages own wtmp -- we'll rotate them here
/var/log/wtmp {
minsize 1M
create 0664 root utmp
rotate 1

# system-specific logs may be also be configured here.

Service or server specific configurations stored in /etc/logrotate.d directory, for example here is sample apache logrotate configuration file:
less /etc/logrotate.d/httpd

/var/log/httpd/*log {
rotate 52
/sbin/service httpd reload > /dev/null 2>/dev/null || true
Now you need to set a cronjob for the logrotation to run. crontab -e

00 00 * * * /usr/sbin/logrotate -s /home/humanlinux/config/logrotate.status

Cron ensures that the command runs at midnight everyday. The command has three parts. /usr/sbin/logrotate is the path to logrotate. The -s /home/humanlinux/config/logrotate.status option specifies where logrotate keeps its status information. This file has to be writeable by the user running the cron.

run the command /usr/sbin/logrotate -f /etc/logrotate.conf to begin the log rotation

Thanks & Regards

How to create a shutdown button on a Linux desktop.

A shutdown button can be created on a Linux desktop using a single lined script.

Open your favorite text editor

eg : vi shutdown or
: gedit shutdown

append the following lines


save and quit. Move the file location to your desktop

chmod 777 shutdown
chmod +x shutdown (made the file 'shutdown' executable)

Now double click on your 'My Computer" icon to open the file browser window.

goto Edit-->Preferences-->Behavior-->Run executable text files when they are clicked-->close

Now you can double click on the 'shutdown' file to shutdown the machine. You can rightclick on it to choose an appropriate icon for the button.

Friday, May 15, 2009

How to assign swap area in Linux to increase speed?

We can assign swap area in linux either on a partition or a file.

I am creating here swap area using a file.

First we need to create the swap file.

dd if=/dev/zero of=/swapfile bs=1024 count=2000000

this will create a file 'swapfile' under / of size above 2gb

Type the following commands :-

mkswap /swapfile

swapon /swapfile

Now we can add the swap entry on fstab so that on every reboot, system will automatically loads the awap area.

vi /etc/fstab

append the following line to the bottom

/swapfile  swap  swap  defaults  0 0

save and quit

To see the swap usage use the command top 

thanks & regards

Thursday, May 14, 2009

How to reset the lxadmin password?

What if the password of lxadmin is lost? 

We can reset the lxadmin password using the following commands.
Login to the server using ssh

1)  cd /usr/local/lxlabs/lxadmin/httpdocs 

2) /usr/bin/lphp.exe ../bin/common/resetpassword.php master

3)  type your new password.

4) After that login to lxadmin at https://xx.xx.xx.xx:7777/ (xx.xx.xx.xx is your server IP address) using username : admin and password :  your new password.

thanks & regards

How to put the grub password in linux!

In Linux anyone can reset the root password from single usermode . So it is considered as a security fault if the machine is public. There comes the importance of putting the grub password, so that only admin is allowed to login if the machine is rebooted.

Here are the steps to put the grub password.

1) open the command prompt and type the following commands

2) grub

3) md5crypt

4) type the password

5) copy the encrypted password generated

6) Ctrl c

7) vi /boot/grub/grub.conf

8) paste the following line just above the 'title'

password --md5 "encrypted password here"

9) save and quit. Done.

I have give the sample grub file here.


password --md5 %&mkj89(*$*J)$OO*=*

title CentOS (2.6.18-92.el5)
root (hd1,8)
kernel /boot/vmlinuz-2.6.18-92.el5 ro root=LABEL=/ rhgb quiet
initrd /boot/initrd-2.6.18-92.el5.img


thanks & regards

Saturday, May 9, 2009

How to install flash player on centos/redhat linux !

This post can also answer the question " how to fix the firefox error on centos/redhat linux" 

Installing the flash player on centos/redhat linux seems to be very difficult sometimes. But the installation is quite simple :). The flash player may not be installed automatically using firefox. While trying install firefox, you may get the error following error " Firefox could not install this item because "install-0zr..rdf" (provided by the item) is not well-formed or does not exist. Please contact the author about this problem."The Screeshot of error is provided. To fix this issue, you need to upgrade/install certain libraries using yum. I have mentioned the commands below.

1. First you need to install those libraries (.i386 and .x86_64):

yum install curl compat-libstdc++-33 glibc nspluginwrapper

2. Once done with the libraries, we need to download the flash player rpm.

mkdir flash

cd flash

download the rpm inside the folder flash.

click here to Download

3. Next we need to execute the command below to install the rpm. This command should be executed inside the folder, where the rpm is downloaded. Ours is in the folder 'flash'.

rpm -ivh flash-plugin-

(replace with the version of rpm you have downloaded)

4. Close the Firefox and restart it. You should be able to see the flashes hereafter.

thanks & regards

Thursday, May 7, 2009

How to browse files in an ISO image?

Its always easy to do things using the command lines in Linux. To browse files of an ISO image is an easy task in Linux. Open a terminal window and type in the following commands.

sudo mkdir /media/iso

sudo modprobe loop

sudo mount filename.iso /media/iso -t iso9660 -o loop

cd /media/iso

Hereafter you will be able to navigate to the /media/iso folder and see the contents of the ISO image. To unmount the ISO, use the following command:

sudo umount /media/iso

I will explain the commands and options used specificly:

sudo modprobe loop  ->loads/ installs the module for loopback file system support

iso9660  -> the file system used by CD roms

-t  -> specify the file system type

-o loop  -> for additional options while using a loopback filesystem

thanks & regards

How to change the default text editor in ubuntu!

In ubuntu , the default text editor for editing the configuration files may be nano. For eg: to set a cronjob crontab -e , the configuration file opens up with the nano text editor. But we can set the default text editor as our favourite editor by using a simple command.

update-alternatives -- config editor

once this command is entered, it asks to enter the no: of our favourite editor. eg:

humanlinux@localhost:~# update-alternatives --config editor


There are 3 alternatives which provide `editor'.

Selection Alternative
1 /usr/bin/vim.tiny
2 /bin/ed
*+ 3 /bin/nano

Just enter the corresponding no: of your favourite editor.
Here i have choosed 1.

Press enter to keep the default[*], or type selection number: 1
Using '/usr/bin/vim.tiny' to provide 'editor'.

thanks & regards

Tuesday, May 5, 2009

how to install csf in ubuntu / linux servers!

CSF instllation in ubuntu / linux servers!

CSF is a firewall that can be installed on linux based severs to enhance the security. It can be installed even on a server based on cPanel. It can be configured to find out hacking attempts through ssh etc. Can be used for ip whitelisting and blacklisting.

The csf instllation is quite easy. Just follow the documentation I have given below.

1)Create a folder 'csf'

mkdir csf
cd csf

2)Download the csf into this directory and instal.

tar -xzf csf.tgz
cd csf

3)Now we need to test whether we have the required iptables modules in the system

perl /etc/csf/

you may get a result like this
root@humanlinux-desktop:/home/hlinux/Downloads/csf/csf# perl /etc/csf/
Testing ip_tables/iptable_filter...OK
Testing ipt_LOG...OK
Testing ipt_multiport/xt_multiport...OK
Testing ipt_REJECT...OK
Testing ipt_state/xt_state...OK
Testing ipt_limit/xt_limit...OK
Testing ipt_recent...OK
Testing ipt_owner...OK
Testing iptable_nat/ipt_REDIRECT...OK

RESULT: csf should function on this server

Don't worry if you cannot run all the features, so long as the script doesn't
report any FATAL errors

4)You should not run any other iptables firewall configuration script. For
example, if you previously used APF+BFD you can remove the combination (which
you will need to do if you have them installed otherwise they will conflict

sh /etc/csf/

5)That's it. You can then configure csf and lfd by edit the files
directly in /etc/csf/*, or on cPanel servers use the WHM UI

csf installation for cPanel is preconfigured to work on a cPanel server with all
the standard cPanel ports open.

csf installation for DirectAdmin is preconfigured to work on a DirectAdmin
server with all the standard DirectAdmin ports open.

csf auto-configures your SSH port on installation where it's running on a non-
standard port.

csf auto-whitelists your connected IP address where possible on installation.

You should ensure that kernel logging daemon (klogd) is enabled. Typically, VPS
servers have this disabled and you should check /etc/init.d/syslog and make
sure that any klogd lines are not commented out. If you change the file,
remember to restart syslog.

See the readme.txt file for more information.

Webmin Module Installation/Upgrade:-

To install or upgrade the csf webmin module:

Install csf as above
Install the csf webmin module in:
Webmin > Webmin Configuration > Webmin Modules >
From local file > /etc/csf/csfwebmin.tgz > Install Module

Uninstallation of CSF :( :-

Removing csf and lfd is even more simple:

On cPanel servers:

cd /etc/csf

On DirectAdmin servers:

cd /etc/csf

On generic linux servers:

cd /etc/csf

un-installation Completed


thanks & regards

Sunday, May 3, 2009

Baseline Monitoring for troubleshooting in Linux!

The Baseline Monitoring is useful in :-

  • troubleshooting
  • essential for healthy systems
  • help plan for further growth
  • can aide with security

A good baseline monitoring of systems is very helpful in troubleshooting. A good baseline of system activity and use can be used to compare when a system appears to be behaving erretically, or more activity to report when a system is operating outside of specified parametres.

It can aslo be used to tighten the security. As we can build up trends for our systems and networks over time, using these we can more easily spot events outside of the norm which could be attempts to gain access to our systems or a rogue system already under the control of external influences.

Deciding what to monitor is very dependant on the work that a system does. For database servers or file servers then disk space, service availability and load might be important. For a desktop system we might justcheck to see that its up and running.

Data gained from longer monitoring can be used outside of the purely technical. We can use it to measure the growth of system load over time, and to predict when a new server of file store might be required. We can use to how improvements made are impacting service availability and therefore helping work flow and numerous others.

thanks & regards

Get free Ubuntu stickers ! :)

Get ubuntu stickers for free! All you need to do is to mail a self addressed stamped envelope to your local address:  The addresses for different countries are give here!


Ubuntu Sticker Offer
Av. Maipu 2259 PB C
ZIP: 1636
Buenos Aires

Thanks to the Ubuntu Argentina Team!


Sticker Offer
P.O Box 1412
Lavington, NSW 2641

Thanks to the Ubuntu Australia Team!


Powered by Ubuntu - stickers 
p/a Lange Vesting 100
8200 Brugge

Thanks to the Ubuntu Belgium Team!


Rolando Espinoza La Fuente
Calle 16 de Julio #424 / Zona Central 
Cochabamba, Cochabamba

Thanks to the Bolivian Ubuntu LoCo Team!


Comunidade UbuntuBR
A/C Etiquetas Ubuntu
Av. Rui Barbosa, 2095 cj63
Santana - Sao Jose dos Campos/SP
CEP: 12211-000

Thanks to the Ubuntu Brazil Team!


Ubuntu Sticker Offer
2448 Cadboro Bay Rd.
Victoria BC
V8S 4C1

Thanks to the Ubuntu Canada Team!


Stickers Ubuntu Chile
Arlegui #573 E-11
Viña del Mar

Thanks to the Ubuntu Chile Team!


Javier A Miranda R 
Carrera 118Bis N°89A-26
Int. 4, Apto. 102 
Bogota, DC -111011

Thanks to the Colombian Ubuntu Team!


105, rue de l'Ourcq
75019 Paris

Thanks to the French Ubuntu Team!


Thanks to the German Ubuntu Team!


Ubuntu Hungarian LoCo Team
ORY Mate
H-1163 Budapest
Gordonka u. 32.

Thanks to the Hungarian Ubuntu Team!


Baishampayan Ghose
214/4, Sher-e-Punjab Society
Andheri (E), Mumbai --- 93

Thanks to the Ubuntu Indian LoCo Team!


Palma Salvatore
Via Magna Grecia, 14
87029 Scalea (CS)

Thanks to the Italian Ubuntu LoCo Team!


Stickers Ubuntu
Avenida Adolfo Lopez Mateos Condominio 1 Casa 41
Fraccionamiento Rancho San Lucas
Metepec, Mexico
CP: 52172

Thanks to the Mexican Ubuntu LoCo Team!


Ubuntu Stickers
Hyacintstraat 13
4587 AV Kloosterzande
The Netherlands

Thanks to the Dutch Ubuntu Team!

New Zealand

Ian Beardslee c/o C/- Catalyst IT 
PO Box 11053
Manners St
Wellington New Zealand

Thanks to the New Zealand Ubuntu Team!


Ubuntu Stickers Scandinavia
c/o FreeCode AS 
Nydalsveien 30 B 
0484 OSLO

Thanks to the Norwegian Ubuntu Team!


Gonzalo L. Campos Medina
Av. Peru K-134 / Urb. Garibaldi

Thanks to the Peruvian Ubuntu Team!


Ivan Jelic
Bore Stefanovica 2/1
36000 Kraljevo

Thanks to the Serbian Ubuntu Team!


Stichwort: Ubuntu-Stickers
c/o Ruben Richiger
Dietlistrasse 2
9000 St. Gallen

Thanks to the Swiss Ubuntu Team! 


Ubuntu Stickers
B.P. 57 Monastir République
5060 Monastir

Thanks to the Tunisian Ubuntu Team! 


Atila Sendil
Bilgi Sistemleri Md.
Korfez / Kocaeli

Thanks to the Turkish Ubuntu Team!

United Kingdom

The Linux Emporium
Bridge House
17a Maybrook Road
Sutton Coldfield
B76 1AL UK

Thanks to the United Kingdom Ubuntu Team!

United States

System76, Inc. (Free Stickers)
1582 S. Parker Rd. Ste. 310
Denver, Colorado 80231


Nathalie Colina
Calle Dabajuro
Casa # 4
Urbanizacion El Señorial
Puerta Maraven 
Punto Fijo, Estado Falcón

Thanks to the Venezuelan Ubuntu Team!


thanks & regards