Showing posts with label Linux Tricks. Show all posts
Showing posts with label Linux Tricks. Show all posts

Monday, July 12, 2010

Steps to disable website pages download using wget ?






Wget is a network utility to retrieve files from the World Wide Web using HTTP and FTP.It works non-interactively, so it can work in the background, after having logged off. The program supports recursive retrieval of web-authoring pages as well as FTP sites—you can use Wget to make mirrors of archives and home pages or to travel the Web like a WWW robot, checking for broken links.

For disabling wget to grab your site pages then simply add the code below in the .htaccess file under public_html directory [for which you wish to disable the wget grabbing].

===================================
SetEnvIfNoCase User-Agent “^Wget” bad_bot

Order Allow,Deny
Allow from all
Deny from env=bad_bot

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

Now, if anybody tries to grab info from your website using wget, he will receive a 403 error.

Please check this link to know more information about wget

http://wget.addictivecode.org/FrequentlyAskedQuestions

Tags:-wget,cpanel,webadmin,serveradmin,apachae,linux,commands,wget,cpanel,whm

Sunday, June 27, 2010

TO VIEW THE DETAILED HARDWARE CONFIGURATION OF LINUX MACHINE

lshw - (Hardware Lister) is a small tool to provide detailed information on the hardware configuration of the machine. It can report exact memory configuration, firmware version, mainboard configuration, CPU version and speed, cache configuration, bus speed, etc. on DMI-capable x86 or EFI (IA-64) systems and on some PowerPC machines

While running this command it says something like -bash: lshw: command not found ".. means the command is not installed.

[root@computer ~]# lshw
-bash: lshw: command not found

So we need to install that command before running command:

[root@computer ~]# yum -y install lshw*

[If yum is run with the -y option, yum will assume a ``yes'' answer to all interactive questions. This is typically used in a script or to process ``known safe'' installs or updates.]

Apachae and Mail logs and configurations files in Linux

Apache Logs
-----------

To view the logs of Apachae:/usr/local/apache

+ bin- apache binaries are stored here – httpd, apachectl, apxs
+ conf – configuration files – httpd.conf
+ cgi-bin
+ domlogs – domain log files are stored here
+ htdocs
+ include – header files
+ libexec – shared object (.so) files are stored here – libphp4.so,mod_rewrite.so
+ logs – apache logs – access_log, error_log, suexec_log
+ man – apache manual pages
+ proxy -
+ icons -

Init Script :/etc/rc.d/init.d/httpd – apache start script
Cpanel script to restart apache – /scripts/restartsrv_httpd

Mail Logs and Mail configuration files:
----------------------------------------------------
  • /etc/exim.conf – exim main configuration file
  • /etc/localdomains – list of domains allowed to relay mail
  • Log : /var/log/exim_mainlog – incoming/outgoing mails are logged here
  • /var/log/exim_rejectlog – exim rejected mails are reported here
  • /exim errors are logged here
  • Mail queue: /var/spool/exim/input
  • Cpanel script to restart exim – /scripts/restartsrv_exim
  • Email forwarders and catchall address file – /etc/valiases/domainname.com
  • Email filters file – /etc/vfilters/domainname.com
  • POP user authentication file – /home/username/etc/domainname/passwd
  • catchall inbox – /home/username/mail/inbox
  • POP user inbox – /home/username/mail/domainname/popusername/inbox
  • POP user spambox – /home/username/mail/domainname/popusername/spam
  • Program : /usr/sbin/exim (suid – -rwsr-xr-x 1 root root )
  • Init Script: /etc/rc.d/init.d/exim
Tags:-Linux,Linux admin interview questions,Linux apachae logs,Linux mail logs


Sunday, September 6, 2009

How to make a red hat boot usb from windows?

* A 64MB or larger USB flash drive
* HP-USB Format tool (optional)
* 7-Zip (or another extracting utility)
* Syslinux
* Dsl-embedded.zip

Installation

1. Download the HP-USB Format tool and format your flash drive using the Fat or Fat32 option
2. Download the dsl-embedded.zip and extract the contents using 7-Zip to your USB flash drive
3. Download syslinux-3.36.zip and unzip the files to a directory called syslinux on your computer
4. From Windows click start-> run-> cmd
5. From the command window, type
cd \syslinux\win32

6. Type
syslinux.exe -ma X: (replace X with your USB drive letter) to make the drive bootable
7. Reboot your computer and set your system BIOS or Boot Menu to boot from the USB device. In some cases, you might also need to set the hard disk boot priority to boot from the USB stick if your BIOS lists the device as a hard drive.

Tags:-Booting,Linux booting,USB Bootable device,USB bootable for Linux,How to install linux to a USBflash pendrive


Thursday, August 27, 2009

Quota Check in Linux

The idea behind the Quota check is that the users are forced to stay under the disk consumption limit taking away their ability to consume unlimited disk space on a system.

Step 1) vi /etc/fstab

Partitions that you have not yet enabled quota normally look something like:

/dev/hda1 / ext2 defaults 1 1
/dev/hda2 /home ext2 defaults 1 1

To enable user quota support on a file system, add "usrquota" to the fourth field containing the word

/dev/hda1 / ext2 defaults 1 1
/dev/hda2 /home ext2 defaults,usrquota 1 1
Replace "usrquota" with "grpquota", should you need group quota support on a file system.

Step 2) Remount the File System to Enable Quota Support
# mount -o remount /home

Step 3)Initialize the new Quota Data Base
# quotacheck -c /home
Then a file named aquota.usr is created in the home directory

Step 4)
Start the assigned quota by
#quotaon /home
To off the Quota--- #quotaoff /home

Step 5)
The user policies can be implemented by editing the Quota File
#edquota -u username
/dev/hda3: blocks in use: 2594, limits (soft = 5000, hard = 6500)
inodes in use: 356, limits (soft = 1000, hard = 1500)

Block in use-Used Space
Soft-Get Warning(The size reaches a particular point it shows warning)
Hard-Maximum Limit(Quota Exceeding Size)
inode-No of Files

For Checking the status of user Quota
# repquota −a

For Checking the Quota

Step 1)Switch to that user
# su - username

Step2)Create files in this home directory
#dd if=/dev/zero of=filename bs=1024 count=50
{Here 50 Kb is allocated to that directory...By giving more size you can check this}

Tags:-Quota ,Quota check in Linux,Quota users,how to do quota in Linux,How to Check Quota in Linux,Quota Commands,Quota commands in Linux,Quota informations in Linux,Methods to do Quota,Methods to do Quota in Linux,Steps to do Quota Check in Linux



Monday, August 24, 2009

How to Create UBUNTU Bootable USB/Pendrive from Windows

Minimum Requirements:
  • Above 1GB USB.Flash Drive
  • Ubuntu ISO
  • CD Burner/Recorder
  • 7-zip (or another ISO extracting tool)

Steps:


Partition and make the USB flash drive bootable:

  1. Download the Ubuntu 6.10 ISO and burn it to CD
  2. Restart your computer (booting from the Ubuntu Live CD)
  3. Insert a 1GB or larger USB flash drive
  4. Open a terminal window and type sudo su
  5. Now type fdisk -l to list available drives/partitions (note which device is your flash drive Example: /dev/sdb). Throughout this tutorial, replace all instances of x with your flash drive letter. For example, if your flash drive is sdb, replace x with b.
  6. Type umount /dev/sdx1
  7. Type fdisk /dev/sdx
    • type p to show the existing partition and d to delete it
    • type p again to show any remaining partitions (if partitions exist, repeat the previous step)
    • type n to make a new partition
    • type p for primary partition
      • type 1 to make this the first partition
      • hit enter to use the default 1st cylinder
      • type +750M to set the partition size
      • type a to make this partition active
      • type 1 to select partition 1
      • type t to change the partition filesystem
      • type 6 to select the fat16 file system
    • type n to make another new partition
    • type p for primary partition
      • type 2 to make this the second partition
      • hit enter to use the default cylinder
      • hit enter again to use the default last cylinder
      • type w to write the new partition table
  8. Type umount /dev/sdx1 to unmount the partition
  9. Type mkfs.vfat -F 16 -n usb /dev/sdx1 to format the first partition

    "Alternately you can try mkfs.vfat -F 32 -n usb /dev/sdx1 (doesn't always work)"

  10. Type umount /dev/sdx2 to ensure the partition is unmounted
  11. Type mkfs.ext2 -b 4096 -L casper-rw /dev/sdx2 to format the second partition
  12. Remove and Re-insert your flash drive
  13. Back at the terminal, type sudo apt-get install syslinux mtools
  14. Type syslinux -sf /dev/sdx1
  15. Restart your computer, remove the CD and boot back into Windows

Using Windows to prepare and move the files to the USB Stick:

  1. Create a folder named USB on your computer
  2. Download UBconvert.zip and extract the files to the USB folder
  3. Move the Ubuntu 6.10 ISO downloaded earlier to the USB folder
  4. Click fixu.bat from the USB folder (follow on screen instructions)
  5. Move all files from the ubuntu directory to your memory stick
  6. Reboot your computer and set your system BIOS to boot from USB-HDD or USB-ZIP. Also set the "Hard Disk Boot Priority" if necessary.

You should now be booting into Ubuntu Linux from your USB drive!

Tags:-USB Bootable,install ubuntu through USB,How to make Ubutntu bootable from a USB,Ubuntu bootable from USBor Flash Drives