Thursday, June 18, 2009

Migrating to a Domain




My title


page contents



My new Blog under construction: Visit :

www.techinterplay.com

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
weekly

# keep 4 weeks worth of backlogs
rotate 4

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

# uncomment this if you want your log files compressed
#compress

# 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 {
monthly
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 {
monthly
rotate 52
compress
missingok
notifempty
sharedscripts
postrotate
/sbin/service httpd reload > /dev/null 2>/dev/null || true
endscript
}
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
tell2humanlinux@gmail.com











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

#!/bin/bash
poweroff


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

tell2humanlinux@gmail.com

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
tell2humanlinux@gmail.com

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.

======================================

#boot=/dev/hdb
default=0
timeout=15
splashimage=(hd1,8)/boot/grub/splash.xpm.gz
hiddenmenu
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
tell2humanlinux@gmail.com