November 22, 2010

Memory Usage in Linux

cat /proc/meminfo

Refer : http://www.redhat.com/advice/tips/meminfo.html
free -m

total used free shared buffers
cached
Mem: 7977 7752 224 0 174
5760
-/+ buffers/cache: 1818 6159
Swap: 7931 0 7931

'free' shows that most of the available memory is used by pagecache (disk cache), to avoid disk access and speed up file access. That memory can be reclaimed anytime if a process needs it.

If there is memory to spare, linux uses it for caching. It retains old programs in memory under the assupption they may be used again. Thus the first time you open ooffice it takes longer than the second. If that memory is needed by a running process, it is released from cache.

Worry if it starts swapping.
top -n 1
or
ps efax -o command,vsize,rss,%mem,size
grep MemTotal /proc/meminfo
grep SwapTotal /proc/meminfo

You can also examine some of your larger executables to see if they were built with the appropriate compiler and linker options. To identify the largest programs, try using a command such as this:
ls -s1 /bin /usr/bin /usr/bin/X11 | sort -n | tail

Memory use by which process Centos / RHEL /Fedora
#ps aux | awk '{if ($5 != 0 ) print $2,$5,$6,$11}' | sort –k2n

November 9, 2010

Command prompts for Windows

Here is a list of commands you can use under Microsoft Windows prearranged depending of their functionality :

* Control Panel
* Windows utility and applications
* Disk management
* Connection management
* Miscellaneous commands


Control Panel

* CONTROL: opens the control panel window
* CONTROL ADMINTOOLS: opens the administrative tools
* CONTROL KEYBOARD: opens keyboard properties
* CONTROL COLOUR: opens display properties.Appearance tab
* CONTROL FOLDERS: opens folder options
* CONTROL FONTS: opens font policy management
* CONTROL INTERNATIONAL or INTL.CPL: opens Regional and Language option
* CONTROL MOUSE or MAIN.CPL: opens mouse properties
* CONTROL USERPASSWORDS: opens User Accounts editor
* CONTROL USERPASSWORDS2 or NETPLWIZ: User account access restrictions
* CONTROL PRINTERS: opens faxes and printers available
* APPWIZ.CPL: opens Add or Remove programs utility tool
* OPTIONALFEATURES: opens Add or Remove Windows component utility
* DESK.CPL: opens display properties. Themes tab
* HDWWIZ.CPL: opens add hardware wizard
* IRPROPS.CPL: infrared utility tool
* JOY.CP: opens game controllers settings
* MMSYS.CPL: opens Sound and Audio device Properties. Volume tab
* SYSDM.CPL: opens System properties
* TELEPHON.CPL: Opens phone and Modem options
* TIMEDATE.CPL: Date and Time properties
* WSCUI.CPL: opens Windows Security Center
* ACCESS.CPL: opens Accessibility Options
* WUAUCPL.CPL: opens Automatic Updates
* POWERCFG.CPL: opens Power Options Properties
* AZMAN.MSC: opens authorisation management utility tool
* CERTMGR.MSC: opens certificate management tool
* COMPMGMT.MSC: opens the Computer management tool
* COMEXP.MSC or DCOMCNFG: opens the Computer Services management tool
* DEVMGMT.MSC: opens Device Manager
* EVENTVWR or EVENTVWR.MSC: opens Event Viewer
* FSMGMT.MSC: opens Shared Folders
* NAPCLCFG.MSC: NAP Client configuration utility tool
* SERVICES.MSC: opens Service manager
* TASKSCHD.MSC or CONTROL SCHEDTASKS: opens Schedule Tasks manager
* GPEDIT.MSC: opens Group Policy utility tool
* LUSRMGR.MSC: opens Local Users and Groups
* SECPOL.MSC: opens local security settings
* CIADV.MSC: opens indexing service
* NTMSMGR.MSC: removable storage manager
* NTMSOPRQ.MSC: removable storage operator requests
* WMIMGMT.MSC: opens (WMI) Window Management Instrumentation
* PERFMON or PERFMON.MSC: opens the Performance monitor
* MMC: opens empty Console
* MDSCHED: opens memory diagnostics tools
* DXDIAG: opens DirectX diagnostics tools
* ODBCAD32: opens ODBC Data source Administrator
* REGEDIT or REGEDT32: opens Registry Editor
* DRWTSN32: opens Dr. Watson
* VERIFIER: opens Driver Verifier Manager
* CLICONFG: opens SQL Server Client Network Utility
* UTILMAN: opens Utility Manager
* COLORCPL: opens color management
* CREDWIZ: back up and recovery tool for user passwords
* MOBSYNC: opens Synchronization center
* MSCONFIG: opens System Configuration Utility
* SYSEDIT: opens System Configuration Editor (careful while using this command)
* SYSKEY: Windows Account Database Security management (careful while using this command)


Windows utility and applications

* EPLORER: Opens windows Explorer
* IEXPLORER: Opens Internet explorer
* WAB: opens Contacts
* CHARMAP: opens Character Map
* WRITE: opens WordPad
* NOTEPAD: opens Notepad
* CALC: opens Calculator
* CLIPBRD: opens Clipbook Viewer
* WINCHAT: opens Microsoft Chat Interface
* SOUNDRECORDER: opens sound recording tool
* DVDPLAY: run CD or DVD
* WMPLAYER: opens Windows Media Player
* MOVIEMK: Opens untitled Windows Movie Maker
* OSK: opens on-screen Keyboard
* MAGNIFY: opens Magnifier
* WINCAL: opens Calendar
* DIALER: opens phone Dialer
* EUDCEDIT: opens Private Character Editor
* NDVOL: opens the mixer volume
* RSTRUI : opens Tool System Restore (For Vista only)
* %WINDIR%\SYSTEM32\RESTORE\rstrui.exe: opens Tool System Restore (for XP only).
* MSINFO32: Opens the System Information
* MRT : launches the utility removal of malware.
* Taskmgr : Opens the Windows Task Manager
* CMD: opens a command prompt
* MIGWIZ: Opens the tool for transferring files and settings from Windows (Vista only)
* Migwiz.exe: Opens the tool for transferring files and settings from Windows (for XP only)
* SIDEBAR: Open the Windows (Vista only)
* Sigverif : Opens the tool for verification of signatures of files
* Winver : Opens the window for your Windows version
* FSQUIRT: Bluetooth Transfer Wizard
* IExpress opens the wizard for creating self-extracting archives. Tutorial HERE
* MBLCTR: opens the mobility center (Windows Vista only)
* MSRA : Opens the Windows Remote Assistance
* Mstsc : opens the tool connection Remote Desktop
* MSDT: opens the diagnostic tools and support Microsoft
* WERCON: opens the reporting tool and solutions to problems (for Vista only)
* WINDOWSANYTIMEUPGRADE: Enables the upgrade of Windows Vista
* WINWORD : opens Word (if installed)
* PRINTBRMUI : Opens migration wizard printer (Vista only)


Disk management

* DISKMGMT.MSC: opens disk management utility
* CLEANMGR: opens disk drive clean up utility
* DFRG.MSC: opens disk defragmenter
* CHKDSK: complete analysis of disk partition
* DISKPART: disk partitioning tool


Connection management

* IPCONFIG: list the configuration of IP addresses on your PC (for more information type IPCONFIG/? in the CMD menu)
* INETCPL.CPL: opens internet properties
* FIREWALL.CPL: opens windows firewall
* NETSETUP.CPL: opens network setup wizard


Miscellaneous commands

* JAVAWS: View the cover of JAVA software (if installed)
* AC3FILTER.CPL: Opens the properties AC3 Filter (if installed)
* FIREFOX: Mozilla launches Firefox (if installed)
* NETPROJ: allow or not connecting to a network projector (For Vista only)
* LOGOFF: closes the current session
* SHUTDOWN: shut down Windows
* SHUTDOWN-A: to interrupt Windows shutdown
* %WINDIR% or %SYSTEMROOT%: opens the Windows installation
* %PROGRAMFILES%: Opens the folder where you installed other programs (Program Files)
* %USERPROFILE%: opens the profile of the user currently logged
* %HOMEDRIVE%: opens the browser on the partition or the operating system is installed
* %HOMEPATH%: opens the currently logged user C: \ Documents and Settings \ [username]
* %TEMP%: opens the temporary folder
* VSP1CLN: deletes the cache for installation of the service pack 1 for Vista
* System File Checker (Requires Windows CD if the cache is not available):
o SFC / scannow: immediately scans all system files and repairs damaged files
o SFC / VERIFYONLY: scans only those files system
o SFC / Scanfil = "name and file path": scans the specified file, and repaired if damaged
o SFC / VERIFYFILE = "name and file path": Scans only the file specified
o SFC / scanonce: scans the system files on the next restart
o SFC / REVERT: return the initial configuration (For more information, type SFC /? In the command prompt CMD.

November 8, 2010

How to back up and restore Outlook Express items

How to back up and restore Outlook Express items

Step 1: Copy message files to a backup folder

Step A: Locate the Store folder
1. Start Outlook Express.

2. Click Tools, and then click Options.

3. On the Maintenance tab, click Store Folder.

4. In the Store Location dialog box, copy the store location. To do this, follow these steps:

a. Put the mouse pointer at one end of the box under the Your personal message store is located in the following folder box.
b. Press and hold the left mouse button, and then drag the mouse pointer across the Your personal message store is located in the following folder box.
c. Press CTRL+C to copy the location.
5. Click Cancel, and then click Cancel again to close the dialog box.

Step B: Copy the contents of the Store folder

1. Click Start, click Run, press CTRL+V, and then click OK.
2. On the Edit menu, click Select All.
3. On the Edit menu, click Copy, and then close the window.

Step C: Create a backup folder

1. Create an new Folder.
2. Type Mail Backup for the folder name, and then press ENTER.

Step D: Paste the contents of the Store folder into the backup folder

1. Double-click the Mail Backup folder to open it.
2. Right-click inside the Mail Backup folder window, and then click Paste.

Step 2: Export the Address Book to a .csv file

To export the Address Book to a .csv file, follow these steps:
1. On the File menu, click Export, and then click Address Book.
2. Click Text File (Comma Separated Values), and then click Export.
3. Click Browse.
4. Select the Mail Backup folder that you created.
5. In the File Name box, type address book backup, and then click Save.
6. Click Next.
7. Click to select the check boxes for the fields that you want to export, and then click Finish.
8. Click OK, and then click Close.

How to restore Outlook Express items

Note To restore items when you use multiple identities in Outlook Express, you may have to re-create the identities before you follow these steps. Repeat each step as needed for each identity.

Step 1: Import messages from the backup folder

1. On the File menu, point to Import, and then click Messages.
2. In the Select an e-mail program to import from box, click Microsoft Outlook Express 5 or Microsoft Outlook Express 6, and then click Next.
3. Click Import mail from an OE5 store directory or Import mail from an OE6 store directory, and then click OK.
4. Click Browse, and then click the Mail Backup folder.
5. Click OK, and then click Next.
6. Click All folders, click Next, and then click Finish.

Or Just copy all the files in the Mail Backup to the Store Folder.

Step 2: Import the Address Book file

1. On the File menu, click Import, and then click Other Address Book.
2. Click Text File (Comma Separated Values), and then click Import.
3. Click Browse.
4. Select the Mail Backup folder, click the address book backup.csv file, and then click Open.
5. Click Next, and then click Finish.
6. Click OK, and then click Close.

November 6, 2010

Installation of a program in Safe Mode

In Safe Mode, Windows has reduced functionality, because only the core components have been loaded. In such an environment it is much easier to get rid of an application that has gone mad. Windows Safe Mode can be entered by pressing the F8 key before Windows boots up.


To edit Registry for your installer to work follow the steps below.

Start -> Run -> type CMD

In the window please type the below content
Code:

REG ADD HKLM\SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\MSIServer” /VE /T REG_SZ /F /D "Service"

Reboot your system

Try again.

September 4, 2010

Recovering Password of Windows Server 2008

The following approach can be used only in cases where we have forgotten the password or it has been changed by a third party for reasons beyond us.

Note: Do NOT use this approach to backdoor any server in your work environment!

Tools used for this demonstration:
PING (Partimage Is Not Ghost)
Download: http://ping.windowsdream.com/ping/Releases/3.00.01/PING-3.00.iso (~22MB)

The workaround:

1) Boot with PING Linux distribution
2) fdisk -l | grep NTFS
3) mkdir -p /mnt/windows
4) mount -t ntfs-3g /dev/sda1 /mnt/windows
5) cd /mnt/windows/Windows/System32
6) mv Magnify.exe Magnify.bck
7) cp cmd.exe Magnify.exe and reboot


Booting into Windows Server 2008:

1) Click on Ease Of Access
2) Select “Make items on the screen larger (Magnifier)
3) Click OK
4) On Command Prompt type explorer

Interacting with Windows Explorer
From here you can change the password

The following approach can be used with Windows Vista and also by any other Ease Of Access tools or even by Ease Of Access itself by renaming “utilman.exe” to “cmd.exe”.

Further you can refer from this link:

July 8, 2010

RAID: Using Multiple Hard Drives for Performance and Reliability

Back in the late 1980's and early 1990's, computer information servers were encountering a dramatic increase in the amount of data they needed to serve and store. Storage technologies were getting very expensive to place a large number of high capacity hard drives in the servers. A solution was needed and thus RAID was born.

So what exactly is RAID? First of all, the acronym stands for Redundant Array of Inexpensive Disks. It was a system developed whereby a large number of low cost hard drives could be linked together to form a single large capacity storage device that offered superior performance, storage capacity and reliability over older storage solutions. It has been widely used and deployed method for storage in the enterprise and server markets, but over the past 5 years has become much more common in end user systems.

You Can follow the below for RAID Calculator to find the disk space.

http://www.ibeast.com/content/tools/RaidCalc/RaidCalc.asp


RAID 0

The lowest designated level of RAID, level 0, is actually not a valid type of RAID. It was given the designation of level 0 because it fails to provide any level of redundancy for the data stored in the array. Thus, if one of the drives fails, all the data is damaged.

RAID 0 uses a method called striping. Striping takes a single chunk of data like a graphic image, and spreads that data across multiple drives. The advantage that striping has is in improved performance. Twice the amount of data can be written in a given time frame to the two drives compared to that same data being written to a single drive.

Below is an example of how data is written in a RAID 0 implementation. Each row in the chart represents a physical block on the drive and each column is the individual drive. The numbers in the table represent the data blocks. Duplicate numbers indicate a duplicated data block.
Drive 1 Drive 2
Block 1 1 2
Block 2 3 4
Block 3 5 6

Thus, if the 6 blocks of data above constitute a single data file, it can be read and written to the drive much faster than if it were on a single drive. Each drive working in parallel could read only 3 physical blocks while it would take a single drive twice as long because it has to read 6 physical blocks. The drawback of course is that if one drive fails, the data is no longer functional. All 6 data blocks are needed for the file, but only three are accessible.

Advantages:

* Increased storage performance
* No loss in data capacity

Disadvantages:

* No redundancy of data

RAID 1

RAID version 1 was the first real implementation of RAID. It provides a simple form of redundancy for data through a process called mirroring. This form typically requires two individual drives of similar capacity. One drive is the active drive and the secondary drive is the mirror. When data is written to the active drive, the same data is written to the mirror drive.

The following is an example of how the data is written in a RAID 1 implementation. Each row in the chart represents a physical block on the drive and each column is the individual drive. The numbers in the table represent the data blocks. Duplicate numbers indicate a duplicated data block.
Drive 1 Drive 2
Block 1 1 1
Block 2 2 2
Block 3 3 3

This provides a full level of redundancy for the data on the system. If one of the drives fails, the other drive still has all the data that existed in the system. The big drawback of course is that the capacity of the RAID will only be as big as the smallest of the two drives, effectively halving the amount of storage capacity if the two drives were used independently.

Advantages:

* Provides full redundancy of data

Disadvantages

* Storage capacity is only as large as the smallest drive
* No performance increases
* Some downtime to change active drive during a failure

RAID 0+1

This is a hybrid form of RAID that some manufacturers have implemented to try and give the advantages of each of the two versions combined. Typically this can only be done on a system with a minimum of 4 hard drives. It then combines the methods of mirroring and striping to provide the performance and redundancy. The first set of drives will be active and have the data striped across them while the second set of drives will be a mirror of the data on the first two.

Below is an example of how data is written in a RAID 0+1 implementation. Each row in the chart represents a physical block on the drive and each column is the individual drive. The numbers in the table represent the data blocks. Duplicate numbers indicate a duplicated data block.
Drive 1 Drive 2 Drive 3 Drive 4
Block 1 1 2 1 2
Block 2 3 4 3 4
Block 3 5 6 5 6

In this case, the data blocks will be striped across the drives within each of the two sets while it is mirrors between the sets. This gives the increased performance of RAID 0 because it takes the drive half the time to write the data compared to a single drive and it provides redundancy. The major drawback of course is the cost. This implementation requires a minimum of 4 hard drives.

Advantages:

* Increased performance
* Data is fully redundant

Disadvantages:

* Large number of drives required
* Effective data capacity is halved

RAID 10 or 1+0

RAID 10 is effectively a similar version to RAID 0+1. Rather than striping data between the disk sets and then mirroring them, the first two drives in the set are a mirrored together. The second two drives form another set of disks that is are mirror of one another but store striped data with the first pair. This is a form of nested RAID setup. Drives 1 and 2 are a RAID 1 mirror and drives 3 and 4 are also a mirror. These two sets are then setup as stripped array.

Below is an example of how data is written in a RAID 10 implementation. Each row in the chart represents a physical block on the drive and each column is the individual drive. The numbers in the table represent the data blocks. Duplicate numbers indicate a duplicated data block.
Drive 1 Drive 2 Drive 3 Drive 4
Block 1 1 1 2 2
Block 2 3 3 4 4
Block 3 5 5 6 6

Just like the RAID 0+1 setup, RAID 10 requires a minimum of four hard drives to function. Performance is pretty much the same but the data is a bit more protected than the RAID 0+1 setup.

Advantages:

* Increased performance
* Data is fully redundant

Disadvantages:

* Large number of drives required
* Effective data capacity is halved

RAID 5

This is the most powerful form of RAID that can be found in a desktop computer system. Typically it requires the form of a hardware controller card to manage the array, but some desktop operating systems can create these via software. This method uses a form of striping with parity to maintain data redundancy. A minimum of three drives is required to build a RAID 5 array and they should be identical drives for the best performance.

Parity is essentially a form of binary math that compares two blocks a data and forms a third data block based upon the first two. The easiest way to explain it is even and odd. If the sum of the two data blocks is even, then the parity bit is even. If the sum of the two data blocks is odd, the parity bit is odd. So 0+0 and 1+1 both equal 0 while 0+1 or 1+0 will equal 1. Based on this form of binary math, a failure in one drive in the array will allow the parity bit to reconstruct the data when the drive is replaced.

With that information in mind, here is an example of how a RAID 5 array would work. Each row in the chart represents a physical block on the drive and each column is the individual drive. The numbers in the table represent the data blocks. Duplicate numbers indicate a duplicated data block. A "P" indicates a parity bit for two blocks of data.
Drive 1 Drive 2 Drive 3
Block 1 1 2 P
Block 2 3 P 4
Block 3 P 5 6

The parity bit shifts between the drives to increase the performance and reliability of the data. The drive array will still have increased performance over a single drive because the multiple drives can write the data faster than a single drive. The data is also fully redundant because of the parity bits. In the case of drive 2 failing, the data can be rebuilt based on the data and parity bits on the two remaining drives. Data capacity is reduced due to the parity data blocks. In practice the capacity of the array is based on the following equation where n is the number of drives and z is the capacity:

(n-1)z = Array Capacity

In the case of three 500 gigabyte hard drives, the total capacity would be (3-1)x500GB or 1000 gigabytes.

Hardware RAID 5 implementations can also have a function called hot swap. This allows for drives to be replaced while the array is still functioning to either increase the drives capacity or to replace a damaged drive. The drive controller then takes time while the array is running to rebuild the data array across the drives. This is a valuable feature for systems that require 24x7 operation.

Advantages:

* Increased storage array performance
* Full data redundancy
* Ability to run 24x7 with hot swap

Disadvantages

* High costs to implement
* Performance degrades during rebuilding

Drive Selection

For the best results, all hard drives in the array should be the same brand and model. This means that all of the hard drives will have the same capacity and performance levels. It is not a requirement that the drives be matched, but mismatching the drives can actually hurt the RAID array.

The capacity of the RAID array will depend upon the method implemented. In the case of RAID 0, the striping can only be done across an equal amount of space on the two drives. As a result, if an 80GB and 100GB drive are used to make the array, the final capacity of the array would only be 160GB. Similarly, in RAID 1 the drives can only mirror data equal to the smallest size. Thus based on the two drives mentioned before, the final data size would only be 80GB. RAID 5 is a bit more complicated because of the formula mentioned before. Once again the smallest capacity would be used. So if a 80GB, 100 GB and 120GB drive were used to make a RAID 5 array, the final capacity would be 160GB of data.

You can refer below links for more details.

http://compreviews.about.com/od/storage/l/aaRAIDPage1.htm
http://www.prepressure.com/library/technology/raid

April 2, 2010

Windows 7 rebooting Issue

Refer http://www.coolbuster.net/2010/03/stop-windows-7-rc-expiry.html for more details.

March 29, 2010

To enable exe files in Linux

Installing Wine in Linux CentOS

Wine enables Linux, Mac, FreeBSD, and Solaris users to run Windows applications without a copy of Microsoft Windows. Wine is free software under constant development. You can find the details from the url: http://www.winehq.com/

Installation of wine 1.1.39 in CentOS:

You can download the wine 1.1.39 from the url: http://www.winehq.org/announce/1.1.39 or http://sourceforge.net/projects/wine/files/Source/

Before installing wine make sure you have done following steps so that wine dependencies are already installed in CentOS Server.

# yum upgrade (Its not necessary)

# Download flex 2.5.33 from the url: http://rpm.pbone.net/index.php3/stat/4/idpl/9770752/com/flex-2.5.33-11.fc8.i386.rpm.html
and run

#rpm –ivh flex-2.5.33-11.fc8.i386.rpm --force

# yum install XFree86-devel arts-devel audiofile-devel bison cups-devel cyrus-sasl-devel e2fsprogs-devel esound-devel expat-devel fontconfig-devel freetype-devel gcc glib2-devel gphoto2-devel isdn4k-utils-devel krb5-devel libao-devel libjpeg-devel libmng-devel libogg-devel libpng-devel libusb-devel libvorbis-devel libxml-devel libxml2-devel libxslt-devel ncurses-devel openldap-devel openssl-devel pkgconfig qt-devel sane-backends-devel zlib-devel rpm-build


Once you've installed the build dependencies you need, you're ready to compile the package. In the terminal window, after having navigated to the Wine source tree, run the following commands:

# ./configure

# make depend

# make

# make install



To uninstall Wine from source, once again navigate to the same source folder that you used to install Wine using the terminal. Then, run the following command:

# make uninstall


CodeWeavers offers paid support for Wine. You can find the details from the url: http://www.codeweavers.com/

March 11, 2010

GDM and XDMCP configuration for remote graphical Linux desktop access

You can follow the link: http://www.yolinux.com/TUTORIALS/GDM_XDMCP.html

Disable Firefox browser in Linux:

To Disable Firefox browser in Linux or Restricting web access using the Firefox browser: You can follow below commands:

For example, if we need to block Firefox for an user “rad” you can use the command below:

root@server# setfacl -m u:rad:x /usr/bin/firefox

To unblock it, you can use following command:

root@server# setfacl -x u:rad /usr/bin/firefox

Moving Mails from Windows Outlook Express to Thunderbird of Linux

Step # 1: Import mails from Outlook using Thunderbird in Windows.
* Download thunderbird for Windows XP from http://www.mozillamessaging.com/en-US/thunderbird/
* Install Thunderbird
* Start Mozilla Thunderbird
* Do not setup Thunderbird as your default email client.
* Since this is your first run, it will prompt you to import mail and other settings.
* At Import dialog box, select Mail > Next
* Select Outlook > Next
* Within few minutes it will migrate all emails from Outlook to Thunderbird. Click Finish and shutdown Thunderbird application.

Step # 2: Transfer Thunderbird mail to USB
First, you need to find out your profile folder under Thunderbird application (you can also use Windows Explore to find out Thunderbird profile folder):.
Click on Start > Run > Type the command “cmd”
And hit [Enter] key
Type the following commands to locate Profile folder:
C:> cd %APPDATA%\\Thunderbird
C:> cd Profiles
Now locate directory called "Local Folders". Again use CD command to go to Local Folders:
C:> cd "Local Folders"
Now Locate required directory and copy all files to USB pen or use network connection to copy files to your Linux home-directory (~/.mozilla-thunderbird)

Step #3: Import mail to Linux Thunderbird.
Copy all files from USB to mail directory of thunderbird, now you can open mail using Linux thunderbird client. You can find the mail directory in the server settings of particular mail account.

Installation of Mozilla thunderbird mail client in Linux:

Download Thunderbird from http://www.mozillamessaging.com/en-US/thunderbird/ to your Linux desktop

Let us say you would like to install thunderbird in your own home directory called /home/rad/

Copy your downloaded file to /home/rad/ and untar it:
$ cp /home/tom/Desktop/thunderbird-2.0.0.0.tar.gz .
$ tar -zxvf thunderbird-2.0.0.0.tar.gz
Now software was installed. To start Thunderbird mail client, enter:
$ cd thunderbird
$ ./thunderbird

To create thunderbird icon on desktop.

Right click on your Linux desktop
Select Create Launcher
Fill the details as follows:
* Set name to : Thunderbird
* Set command to : browse "thunderbird" inside the directory Thunderbird.
* Set comment to : My Email Client
* Hit OK to create an ICON

February 9, 2010

Redhat 5 Tweaking steps:

http://www.linuxhomenetworking.com/wiki/index.php/Quick_HOWTO_:_Ch14_:_Linux_Firewalls_Using_iptables

http://www.thegeekstuff.com/2009/06/how-to-disable-selinux-redhat-fedora-debian-unix/

http://www.cyberciti.biz/faq/disable-linux-firewall-under-centos-rhel-fedora/

http://www.servepath.com/support/redhat-securitychecklist.php

http://linuxhelp.blogspot.com/2006/04/enabling-and-disabling-services-during_01.html#axzz0f2M0zEs0

February 3, 2010

Yum configuration with Dag RPM Repository

Please refer: http://dag.wieers.com/rpm/FAQ.php

Install Thunderbird in Linux

Please refer: http://www.cyberciti.biz/faq/install-thunderbird-2-in-linux/

Installing openoffice on Redhat 5

Installation Steps

1. Review the System Requirements
2. You can download the rpm from the url: http://download.openoffice.org/index.html
Unpack the downloaded image into a directory. For example, currently, the following command would unpack into the current directory:
3. tar xvzf OOo_3.0.0_LinuxIntel_install_xxxxxx.tar.gz
This will create a source directory with the OpenOffice.org installation. The directory will have a rather long name but be prefixed by "OOO3...".
4. su to root, if necessary, and navigate to OpenOffice.org installation directory, the OOO3... source directory.
Since the default packaging of OpenOffice.org for Linux is RPM, you will likely need to be root to run the rpm command.
5. cd into the RPMS subdirectory of the source directory.
You should see a lot of rpms here and one sub-directory called "desktop-integration".
6. Install this new version by typing rpm -Uvih *rpm.
By default, this will install OpenOffice in your /opt directory.
NOTE: See additional installation options and other useful information in the Setup Guide.
7. Finally, cd to desktop-integration. Depending on your package manager/system, install the appropriate desktop interface.

January 13, 2010

"IP is not accessible. You might not have permission to use this network resource. Contact the administrator of this server to find out if you have access permissions. Not enough storage is avaliable to process this command. " IP is not accessible. You might not have permission to use this network resource. Contact the administrator of this server to find out if you have access permissions.

Please check some common fixes for this issue.
-----------------------------------------------------------------------------
1. First, in the registry, change the IRPStackSize, increase by 3 to 5.

- Start -> Run

- Type in "regedit" (without the quotation marks)

- Navigate to the following path by single left mouse clicking as you go:

- HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\ Services\lanmanserver\parameters

- Double-left mouse click on IRPStackSize

- In the event the IRPStackSize registry setting doesn't exist, create it by single left mouse clicking on "Edit" in the menu bar and then single left mouse click on "New" followed by a single left mouse click on "DWORD Value". The new value will then appear, name the value "IRPStackSize" (without quotation marks) and double left mouse click on the icon.

- Set the decimal under Base to 11 for NT and 2000, and 15 for XP - However, when setting the decimal under Base, you may want to increase it by three with-in the range (example: 11 to 14 and so on ,up to 15 for NT and 2000 - 12 to 15 up to 20 for XP) Try the defaults first and if you are still getting the error, try moving up the range until you no longer get the error.

- Close the Registry Editor and Reboot the computer after each edit.


Second, turn "Use simple file sharing" ON, reboot the machine, then turn it OFF and reboot the machine again.
In other words, cycle the sucker. Many changes in disk shares don't actually become effective until this is done.

To turn Simple File Sharing on or off in Windows XP Professional, follow these steps:

1. Double-click My Computer on the desktop.
2. On the Tools menu, click Folder Options.
3. Click the View tab, and then select the Use Simple File Sharing (Recommended) check box to turn on Simple File Sharing. (Clear this check box to turn off this feature.)

-----------------------------------------------------------------------------------------

2. Please check the PagedPoolSize in the registry on the server?

Start the registry editor (regedit.exe)

Go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management

Double click on PagedPoolSize and set to 0

Click OK

Close the registry editor

Reboot the machine

Setting the PagedPoolSize to 0 should allow NT to dynamically allocate memory.

--------------------------------------------------------------------------------------------

3. "Not enough server storage is available to process this command." error.

SYMPTOMS: When accessing shares on a server from a client, you may receive "Not enough server storage is available to process this command." error. You may receive this message and Event ID: 2011 after you install Norton Antivirus for Windows.

Resolution:
1) The registry value IRPstackSize may be not explicitly present.
To increase the value of the parameter, go to the key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ LanmanServer\Parameters.
If the key is not present, choose Add Value in the Registry Editor.
The Value Name should be IRPStackSize and the Data Type is REG_DWORD.
2) Remove any unnecessary entries from this value in the registry, HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\LanmanServer\Parameters\NullSessionPipes.
3) Disable Norton antivirus to see if that will fix the problem.

---------------------------------------------------------------------
4. "Not accessible. You may not have permission to use this network resource"

Symptom: Your WinXP, in a peer-to-peer network, may receive the following error when you double-click My Network Places/Computers Near Me: is not accessible. You may not have permission to use this network resource.

Resolution: 1) Enable NetBIOS over TCP/IP on one or more computers in the workgroup.
To do that, go to properties of Local Area Connection>properties of Internet Protocol (TCP/IP)>General> Advanced>WINS,
check Enable NetBIOS over TCP/IP (If you have a DHCP-assigned IP address, select Use NetBIOS setting from the DHCP server ).

2) Make sure the Computer Browser service is started.

January 11, 2010

Steps to allocate a maximum amount of disk space a user or group may use.

Configuration of disk usage quotas on Linux - Perform the following as root:

1. Edit file /etc/fstab to add qualifier "usrquota" or "grpquota" to the partition. The following file system mounting options can be specified in /etc/fstab


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

...
/dev/hda2 /home ext3 defaults,usrquota 1 1
...


* Replace "usrquota" with "grpquota", should you need group quota support on a file system.

...
/dev/hda2 /home ext3 defaults,grpquota 1 1
...


* Need both user quota and group quota support on a file system?

...
/dev/hda2 /home ext3 defaults,usrquota,grpquota 1 1
...


This enables user and group quotas support on the /home file system.

2. touch /partition/aquota.user
where the partition might be /home or some partition defined in /etc/fstab.
then
chmod 600 /partition/aquota.user

The file should be owned by root. Quotas may also be set for groups by using the file aquota.group




3. Re-boot or re-mount file partition with quotas.

* Re-boot: shutdown -r now
* Re-mount partition: mount -o remount /partition


After re-booting or re-mounting the file system, the partition will show up in the list of mounted filesystems as having quotas. Check /etc/mtab:

...
/dev/hda5 / ext3 rw,usrquota 0 0
...

4. quotacheck -vgum /partition
or
quotacheck -vguma

The options used are as follows:

* a — Check all quota-enabled, locally-mounted file systems
* v — Display verbose status information as the quota check proceeds
* u — Check user disk quota information
* g — Check group disk quota information



5. quotaon -av
System Response: /dev/hda6: user quotas turned on

quotaon - enable disk quotas on a file system.
quotaoff - turn off disk quotas for a file system.



6. edquota -u user_id
Edit directly using vi editor commands. (See below for more info.)
For example: edquota -u user1

* System Response (RH 7+):

Disk quotas for user user1 (uid 501):
Filesystem blocks soft hard inodes soft hard
/dev/hda5 1944 0 0 120 0 0


o blocks: 1k blocks
o inodes: Number of entries in directory file
o soft: Max number of blocks/inodes user may have on partition before warning is issued and grace persiod countdown begins.
If set to "0" (zero) then no limit is enforced.
o hard: Max number of blocks/inodes user may have on partition.
If set to "0" (zero) then no limit is enforced.

If editing group quotas: edquota -g group_name

To verify that the group quota has been set, use the command:

quota -g group_name


Also please note that quota is assigned in KB



7. List quotas:
quota -u user_id

For example: quota -u user1
System response:

Disk quotas for user user1 (uid 501):
Filesystem blocks quota limit grace files quota limit grace
/dev/hda6 992 50000 55000 71 10000 11000


If this does not respond similar to the above, then restart the computer: shutdown -r now



Quota Reports:

* Report on all users over quota limits: quota -q
* Quota summary report: repquota -a

*** Report for user quotas on device /dev/hda5
Block grace time: 7days; Inode grace time: 7days
Block limits File limits
User used soft hard grace used soft hard grace
----------------------------------------------------------------------
root -- 4335200 0 0 181502 0 0
bin -- 15644 0 0 101 0 0
...
user1 -- 1944 0 0 120 0 0


No limits shown with this user as limits are set to 0.



Cron:

Quotacheck should scan the file system via cronjob periodically (say, every week?). Add a script to the /etc/cron.weekly/ directory.
File: /etc/cron.weekly/runQuotacheck

* Linux Kernel 2.4: Red Hat 7.1 - Fedora Core 3:

#!/bin/bash
/sbin/quotacheck -vguma

* Linux Kernel 2.2: Red Hat 6/7.0:

#!/bin/bash
/sbin/quotacheck -v -a

(Remember to chmod +x /etc/cron.weekly/runQuotacheck)

Note: You can refer more details from the urls:

http://www.redhat.com/docs/manuals/linux/RHL-9-Manual/custom-guide/ch-disk-quotas.html
http://www.yolinux.com/TUTORIALS/LinuxTutorialQuotas.html

January 1, 2010

Named internal/external issue, Not resolving from outside the server !!

Named not starting...



Hi All,

We normally receive an issue with named not running.. and all the domains are not resolving from out side. Here is the check list to fix that.

first,

Check iptables / CSF / APF... stop these firewalls..
check "host domainname serverip" from outside

Still issues, Second fix

In named.conf, there may be two sets of named entries one for Internal and other for external.

You may need add the following two lines to the external section to fix the issue.

match-clients { any; };
match-destinations { any; };

So the that part of named will look like the following,

###################
view "external" {
/* This view will contain zones you want to serve only to "external" clients
* that have addresses that are not on your directly attached LAN interface subnets:
*/

match-clients { any; };
match-destinations { any; };

recursion no;
// you'd probably want to deny recursion to external clients, so you don't
// end up providing free DNS service to all takers

// all views must contain the root hints zone:
zone "." IN {
type hint;
file "/var/named/named.ca";
};

// These are your "authoritative" external zones, and would probably
// contain entries for just your web and mail servers:

// BEGIN external zone entries

STARTS the Zone entries here
############################

Error : client denied by server configuration while installing cacti

vi /etc/httpd/conf.d/cacti.conf


Order Deny,Allow
Deny from all
Allow from 127.0.0.1 (Change this line to "Allow from all")

Cpanel script to correct mail directory's incorrect disk usage

Here is a tip from the cpanel team :

Sometimes mail accounts belonging to a particular cpanel account may show Zero disk usage, irrespective of the actual content. The following cpanel script can be used to fix this :

/scripts/generate_maildirsize --confirm --force --verbose baba38zz -- generates mail directory size for the user "baba38zz".

Please refer : https://tickets.cpanel.net/review/msg.cgi?ticketid=550573 for further clarification.

Exim Command set

1. How to remove How to remove all mails from exim queue?
==================
rm -rf /var/spool/exim/input/*

2. Deleting Frozen Mails:
==================
To remove all frozen mails from the exim queue, use the following command -
exim -bpr | grep frozen | awk {'print $3'} | xargs exim -Mrm
exiqgrep -z -i | xargs exim -Mrm

3. If you want to only delete frozen messages older than a day:
=============================================
exiqgrep -zi -o 86400 | xargs exim -Mrm
where you can change 86400 depending on the time frame you want to keep.( 1 day = 86400 seconds. ).

4. To forcefully deliver mails in queue, use the following exim command:
=====================================================
exim -bpru |awk '{print $3}' | xargs -n 1 -P 40 exim -v -M

To flush the mail queue:
======================
exim -qff
/usr/sbin/exim -qff

To clear spam mails from Exim Queue:
==============================
grep -R -l [SPAM] /var/spool/exim/msglog/*|cut -b26-|xargs exim -Mrm

To clear frozen mails from Exim Queue.
==============================

grep -R -l '*** Frozen' /var/spool/exim/msglog/*|cut -b26-|xargs exim -Mrm


To clear mails from Exim Queue for which recipient cannot not be verified.
=====================================================================
grep -R -l 'The recipient cannot be verified' /var/spool/exim/msglog/*|cut -b26-|xargs exim -Mrm

To find exim queue details. It will show ( Count Volume Oldest Newest Domain ) details.
=====================================================================

exim -bp |exiqsumm


How to remove root mails from exim queue ?
==================================

When mail queue is high due to root mails, and you only need to remove the root mails and not any other valid mails.

exim -bp |grep ""|awk '{print $3}'|xargs exim -Mrm

Replace "HOSTNAME" with server hostname


How to remove nobody mails from exim queue ?
==================================
When you need to clear nobody mails, you can use the following command.

exiqgrep -i -f nobody@HOSTNAME | xargs exim -Mrm (Use -f to search the queue for messages from a specific sender)
exiqgrep -i -r nobody@HOSTNAME | xargs exim -Mrm (Use -r to search the queue for messages for a specific recipient/domain)

Replace "HOSTNAME" with server hostname

Run a pretend SMTP transaction from the command line, as if it were coming from the given IP address. This will display Exim's checks, ACLs, and filters as they are applied. The message will NOT actually be delivered.
===========================

# exim -bh

Sharepoint Server

Refer the site

http://www.rodneyviana.com/portal/Sharepoint/MOSS2007Install1of2/tabid/55/Default.aspx

http://www.rodneyviana.com/portal/Sharepoint/MOSS2007Install2of2/tabid/57/Default.aspx

Windows Plesk I cannot connect to the MySQL database as root/admin

Windows Plesk I cannot connect to the MySQL database as root/admin
Solution Regretfully, MySQL is pre-installed by Plesk without the old-passwords functionality set true.

But the Plesk installer populates the admin user with a password encrypted in the old style!

To fix this you will need to enter your server with Remote Desktop and edit the follwoing file:

C:\SWSoft\Plesk\Databases\MySQL\Data\my.ini

There is a section in that file [mysqld]

Under the line starting "[mysqld]" add the following line:

old_passwords=1

so it looks like this:

[mysqld]
old_passwords=1




Now restart the MySQL service in the services manager.

You should now be able to manage MySQL with the user "admin" and the password is the same as your Plesk login. In some cases the password may still be set to the original password which is "setup".


If you still cannot log into the MySQL server then you will need to start the MySQL server with skip-grant-tables enabled.

Stop the MySQL service in the services manager.

Edit the my.ini file:


C:\SWSoft\Plesk\Databases\MySQL\Data\my.ini

Add "skip-grant-tables" to the [mysqld] section like so:

[mysqld]
old_passwords=1
skip-grant-tables

Now restart the MySQL service.

Now log into MySQL with the following command:

C:\SWSoft\Plesk\Databases\MySQL\bin\mysql "mysql"

At the MySQL prompt set the admin password:

mysql> update user set password=password('new_password') where user='admin';

Where "new_password" is the password of the PLESK admin login.

type "exit" at the MySQL prompt and then edit the my.ini file again and remove the line: skip-grant-tables

Now restart the MySQL service.

Your MySQL admin password has now been re-set.

Script for sending event logs to a mail address

Script for sending event logs to a mail address

You can chosse nay name say eventlog_monitor.vbs.



strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate, (Security)}!\\" & _
strComputer & "\root\cimv2")
Set colMonitoredEvents = objWMIService.ExecNotificationQuery _
("Select * from __instancecreationevent where " _
& "TargetInstance isa 'Win32_NTLogEvent' " _
& "and TargetInstance.EventCode = '1002' ")
Do

Set objLatestEvent = colMonitoredEvents.NextEvent
strAlertToSend = objLatestEvent.TargetInstance.User _
& "ALERT!!! Event 1002 Siebel Application Crash file has been generated."

Set objEmail = CreateObject("CDO.Message")

objEmail.From = "eventemailnotifier@test.org"
objEmail.To = "test@test.org"
objEmail.cc = "test@test.org"
objEmail.Subject = "TESTSERVER logged event ID 1002, crash file generated"
objEmail.Textbody = "On TESTSERVER an event ID 1002 has been logged and a crash file has been generated. TO check the crash file click on the attached link and this will bring you to the BIN directory where the crash file resides."
objEmail.AddAttachment "C:\bin.lnk"

objEmail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objEmail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = _
"smarthost.smarthost.com"
objEmail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objEmail.Configuration.Fields.Update
objEmail.Send

Loop
__________

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


This is an alternative of the mentioned code. But I prefer the first one.


Create the first file event.vbs

_________________event.vbs________________________ ________
strComputer = "sbappdev01"
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate, (Security)}!\\" & _
strComputer & "\root\cimv2")
Set colMonitoredEvents = objWMIService.ExecNotificationQuery _
("Select * from __instancecreationevent where " _
& "TargetInstance isa 'Win32_NTLogEvent' " _
& "and TargetInstance.EventCode = '1002' ")
Do
Set objLatestEvent = colMonitoredEvents.NextEvent
strAlertToSend = objLatestEvent.TargetInstance.User _
& "ALERT!!! Event 1002 Siebel Application Crash file has been generated."
Wscript.Echo strAlertToSend
Loop
_________________event.vbs________________________ ________


Create the second file email.vbs



_________________email.vbs________________________ ________
'**************************************
' Name: A++ Send Lotus Notes Email VBS S
' cript
' Description:Simple script to send a Lo
' tus Notes email. Can be modified to auto
' mate tasks on the server.
' By: Steven Jacobs
'
'This code is copyrighted and has ' limited warranties.Please see http://w
' ww.Planet-Source-Code.com/vb/scripts/Sho
' wCode.asp?txtCodeId=8815&lngWId=4 'for details. '**************************************

On Error Goto 0: sendLNMail()
Dim s
Dim db
Dim doc
Dim rtitem
Dim subj
Dim bdy
Dim recips(2)
'File System Object Decs
Dim fs
Dim fName
Dim path
Sub sendLNMail()
On Error Resume Next
'///////////////////////////////////////
' ////////////////////////////////
'Begin Error/Input Routines
'Created by Steven Jacobs
'2004
'///////////////////////////////////////
' ////////////////////////////////
'Get subject...if no subject, exit sub
subj = "Siebel Crash File"
if subj = "test" Then
MsgBox "You need a subject"
Exit Sub
End if
'Get body text...if no body text, exit s
' ub
bdy = "On Servertest Event ID 1002 has been logged, a crash file has been created in the BIN directory. Click on the attached link to open the BIN directory"
if bdy = "test" Then
MsgBox "You need body text"
Exit Sub
End if
Set fs = createobject("Scripting.FileSystemObject")
if fs Is Nothing Then
MsgBox "Could Not Create FileSystemObject",16,"File System Object Error."
endMe
Exit Sub
End if
fName = "C:\bin.lnk"
if fName = "" Then
MsgBox "Empty Path"
endMe
Exit Sub
End if
path = fs.GetAbsolutePathName(fName)
if Not fs.FileExists(path) Then
MsgBox "File does Not exist In directory you specified"
endMe
End if
'///////////////////////////////////////
' ////////////////////////////////
'End Error/Input Routines
'///////////////////////////////////////
' ////////////////////////////////
Set s = createobject("Notes.NotesSession")
if s Is Nothing Then
MsgBox "Could Not Create A Session Of Notes",16,"Notes Session Error."
endMe
Exit Sub
End if
'See if we can create the main object (s
' ession)
if Err.Number <> 0 Then
On Error Goto 0
MsgBox "Could Not create session 'Lotus Notes' from object"
Exit Sub
End if
Set db = s.getdatabase(s.getenvironmentstring("MailServer",True),s.getenvironmentstring("Mailfile",true))
'See if we can a handle on the mail file
'
if Err.Number <> 0 Then
On Error Goto 0
MsgBox "Could find or Get a handle on the mail file"
Exit Sub
End if
Set doc = db.createdocument
Set rtitem = doc.createrichtextitem("BODY")
recips(1) = "yourname@yourname.org"
recips(2) - "yourname@yourname.org"
With doc
.form = "Memo"
.subject = subj
.sendto = " .body = bdy
.postdate = Date
End With
call rtitem.embedobject(1454,"",fName)
doc.visible = True
doc.send False
'if we made it this far, alert the user
' the mail memo has been created and sent
endMe
End Sub
Sub endMe()
'clean objects/memory
Set s = nothing
Set db = nothing
Set doc = nothing
Set rtitem = nothing
Set fs = nothing
End Sub
_________________email.vbs________________________ ________




Create a bat file to execute the scripts in order, say log_execute.bat

=================
EX.

@ECHO OFF
Call event.vbs
Call email.vbs
=================

Update TTL value of all domains in windows Plesk server

MAKE SURE TO TAKE THE BACKUP OF 'psa' DATABASE.

Start > run >cmd

cd %plesk_bin%
C:\Program Files\SWsoft\Plesk\admin\bin\cd ..
C:\Program Files\SWsoft\Plesk\admin\cd ..
C:\Program Files\SWsoft\Plesk\cd MySQL\bin

C:\Program Files\SWsoft\Plesk\MySQL\bin\


C:\Program Files\SWsoft\Plesk\MySQL\bin>mysql -uadmin -p -P8306
Enter password: ***********
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1817 to server version: 4.1.22-community-nt

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> use psa;
Database changed

mysql> desc dns_zone;
+---------------+------------------------------------+------+-----+-------------
--+----------------+
| Field | Type | Null | Key | Default
| Extra |
+---------------+------------------------------------+------+-----+-------------
--+----------------+
| id | int(10) unsigned | | PRI | NULL
| auto_increment |
| name | varchar(255) | | |
| |
| displayName | varchar(255) | | |
| |
| email | varchar(255) | YES | | NULL
| |
| status | int(10) unsigned | | | 0
| |
| type | enum('slave','master') | | | master
| |
| ttl | int(10) unsigned | | | 86400
| |
| ttl_unit | int(10) unsigned | | | 1
| |
| refresh | int(10) unsigned | | | 10800
| |
| refresh_unit | int(10) unsigned | | | 1
| |
| retry | int(10) unsigned | | | 3600
| |
| retry_unit | int(10) unsigned | | | 1
| |
| expire | int(10) unsigned | | | 604800
| |
| expire_unit | int(10) unsigned | | | 1
| |
| minimum | int(10) unsigned | | | 86400
| |
| minimum_unit | int(10) unsigned | | | 1
| |
| serial_format | enum('UNIXTIMESTAMP','YYYYMMDDNN') | | | UNIXTIMESTAM
P | |
| serial | varchar(12) | | | 0
| |
+---------------+------------------------------------+------+-----+-------------
--+----------------+
18 rows in set (0.00 sec)


mysql> update dns_zone set ttl="180" where ttl="86400";

Query OK, 55 rows affected (0.05 sec)
Rows matched: 55 Changed: 55 Warnings: 0

mysql> update dns_zone set ttl_unit="180" where ttl_unit="86400";


Query OK, 32 rows affected (0.03 sec)
Rows matched: 32 Changed: 32 Warnings: 0

mysql> select ttl from dns_zone;

finally Run
----------------

C:\Program Files\SWsoft\Plesk\admin\bin>"%plesk_bin%\dnsmng" update *



Also please go thru the following link.

http://kb.parallels.com/en/1114

Please run the query given in the link only after describing the table. DO NOT BLINDLY APPLY THE QUERY GIVEN IN LINK.

MAKE SURE TO TAKE THE BACKUP OF 'psa' DATABASE.

Get the OS version

If you are not sure which *nix based distro you are using, try the following.

cat /etc/redhat-release
cat /etc/debian_version
cat /etc/SuSE-release
cat /etc/slackware-version
cat /etc/gentoo-release

You could also try 'cat /etc/*-release' or 'cat /etc/*-version'.

Cpanel Pre-requisites

If you are submitting an OS reload ticket for a server on which Cpanel is to be installed, please ensure that the OS is one of those which is listed below. Please do not give any other OS including Fedora as they are not supported by Cpanel.

* CentOS (free) versions 3.x, 4.x, 5.x
* Red Hat® Enterprise Linux® versions 2.1, 3.x, 4.x, 5.x
* FreeBSD®-RELEASE versions 6.0, 6.1, 6.2, 6.3, 7.0



See the complete requirement here including details of the Virtual Environment supported.

http://cpanel.net/products/cpanelwhm/system-requirements.html

Some useful bash scripts

svn ls -R | egrep -v -e "\/$" | xargs svn blame | awk '{print $2}' | sort | uniq -c | sort -r

Prints total line count contribution per user for an SVN repository.

I'm working in a group project currently and annoyed at the lack of output by my teammates. Wanting hard metrics of how awesome I am and how awesome they aren't, I wrote this command up.

It will print a full repository listing of all files, remove the directories which confuse blame, run svn blame on each individual file, and tally the resulting line counts. It seems quite slow, depending on your repository location, because blame must hit the server for each individual file. You can remove the -R on the first part to print out the tallies for just the current directory.

man -P cat ls > man_ls.txt

save a manpage to plaintext file. Output manpage as plaintext using cat as pager: man -P cat commandname

And redirect its stdout into a file: man -P cat commandname > textfile.txt

ls /var/lib/dpkg/info/*.list -lht |less

Find the dates your debian/ubuntu packages were installed.

ls -drt /var/log/* | tail -n5 | xargs sudo tail -n0 -f

Follow the most recently updated log files. This command finds the 5 (-n5) most frequently updated logs in /var/log, and then does a multifile tail follow of those log files. Alternately, you can do this to follow a specific list of log files:

sudo tail -n0 -f /var/log/{messages,secure,cron,cups/error_log}


find / | xargs ls -l | tr -s ' ' | cut -d ' ' -f 1,3,4,9

Command for getting the list of files with perms, owners, groups info. Useful to find the checksum of 2 machines/images.

ls -1 |grep -v .jpg |xargs rm

Delete files if not have some extension. Delete files in a directory, if those not have some extension. Useful if we want to maintain only one kind of file in our directories.

ls *tgz | xargs -n1 tar xzf

extract all tgz in current dir

man -Tps ls >> ls_manpage.ps && ps2pdf ls_manpage.ps

Convert man page to PDF. Creates a PDF (over ps as intermediate format) out of any given manpage. Other useful arguments for the -T switch are dvi, utf8 or latin1.

ls /mnt/badfs &

Check if filesystem hangs. When a fs hangs and you've just one console, even # ls could be a dangerous command. Simply put a trailing "&" and play safe

ls -1t | head -n10

find the 10 latest (modified) files
order the files by modification time, one file per output line and filter first 10

ls -s | sort -nr | more

find large files


man ls | col -b > ~/Desktop/man_ls.txt

Convert "man page" to text fil. You can convert any UNIX man page to .txt

ls -la | sort -k 5bn


Huh? Where did all my precious space go ? Sort ls output of all files in current directory in ascending order

Just the 20 biggest ones:
ls -la | sort -k 5bn | tail -n 20

A variant for the current directory tree with subdirectories and pretty columns is:
find . -type f -print0 | xargs -0 ls -la | sort -k 5bn | column -t

And finding the subdirectories consuming the most space with displayed block size 1k:
du -sk ./* | sort -k 1bn | column -t


ls | curl -F 'sprunge=<-' http://sprunge.us | xclip Run a command, store the output in a pastebin on the internet and place the URL on the xclipboard The URL can then be pasted with a middle click. This is probably useful when trying to explain problems over instant messaging when you don't have some sort of shared desktop. find ./* -ctime -1 | xargs ls -ltr --color files and directories in the last 1 hour added alias in ~/.bashrc alias lf='find ./* -ctime -1 | xargs ls -ltr --color' less -Rf <( cat <(ls -l --color=always) <(ls -ld --color=always .*) ) Scrollable Colorized Long Listing - Hidden Files Sorted Last To sort hidden files first, simply switch the two inner `ls` commands. I have this aliased to `dira` `dir` is aliased to the simpler version with no hidden files: for dir in $(ls -l | grep ^d | awk -F" " '{ print $9 }') ; do cd $dir; echo script is in $dir ; cd .. ; done perform an action in each subdirectory of the current working directory Will find directory names via `ls -l | grep ^d | awk -F" " '{ print $9 }'`, cd in them one at a time for every directory, and perform some action ( `echo script is in $dir` in the example ). The `awk -F" " '{ print $9 }'` can be written in the shorter form `awk '{ print $9 }' `, forgoing the -F" " which tells awk that the columns are separated by a single space, which is the default for awk. I like to include the -F" " to remind myself of the syntax. find / \( -name "*.log" -o -name "*.mylogs" \) -exec ls -lrt {} \; | sort -k6,8 | head -n1 | cut -d" " -f8- | tr -d '\n' | xargs -0 rm Find and delete oldest file of specific types in directory tree This works on my ubuntu/debian machines. I suspect other distros need some tweaking of sort and cut. I am sure someone could provide a shorter/faster version. for files in $(ls -A directory_name); do sed 's/search/replaced/g' $files > $files.new && mv $files.new $files; done;

Search and replace in multiple files and save them with the same names - quickly and effectively!

Yeah, there are many ways to do that.

Doing with sed by using a for loop is my favourite, because these are two basic things in all *nix environments. Sed by default does not allow to save the output in the same files so we'll use mv to do that in batch along with the sed.


p=$(netstat -nate 2>/dev/null | awk '/LISTEN/ {gsub (/.*:/, "", $4); if ($4 == "4444") {print $8}}'); for i in $(ls /proc/|grep "^[1-9]"); do [[ $(ls -l /proc/$i/fd/|grep socket|sed -e 's|.*\[\(.*\)\]|\1|'|grep $p) ]] && cat /proc/$i/cmdline && echo; done

netstat -p recoded (totaly useless..)

Ok so it's rellay useless line and I sorry for that, furthermore that's nothing optimized at all...

At the beginning I didn't managed by using netstat -p to print out which process was handling that open port 4444, I realize at the end I was not root and security restrictions applied ;p

It's nevertheless a (good ?) way to see how ps(tree) works, as it acts exactly the same way by reading in /proc

So for a specific port, this line returns the calling command line of every thread that handle the associated socket


ls | sed -n -r 's/banana_(.*)_([0-9]*).asc/mv & banana_\2_\1.asc/gp' | sh


Smart renaming

A powerfull way to rename file using sed groups.

& stand for the matched expression.

\1 referes to the first group between parenthesis. \2 to the second.

ls -S -lhr
list and sort files by size in reverse order (file size in human readable output)

This command list and sort files by size and in reverse order, the reverse order is very helpful when you have a very long list and wish to have the biggest files at the bottom so you don't have scrool up.

The file size info is in human readable output, so ex. 1K..234M...3G

Tested with Linux (Red Hat Enterprise Edition)

for img in $( ls *.CR2 ); do convert $img $img.jpg; done

Convert Raw pictures to jpg

ls /home | head -64 | barcode -t 4x16 | lpr

printing barcodes

64 elements max on 16 rows, 4 cols.

GNU Barcode will adapt automagically the width and the eight of your elements to fill the page.

Standard output format is PostScript.


find -type f -printf '%P\000' | egrep -iz '\.(avi|mpg|mov|flv|wmv|asf|mpeg|m4v|divx|mp4|mkv)$' | sort -z | xargs -0 ls -1


Show all video files in the current directory (and sub-dirs).


sed -n '/^function h\(\)/,/^}/p' script.sh

Extract a bash function

I often need to extract a function from a bash script and this command will do it.

geoip(){curl -s "http://www.geody.com/geoip.php?ip=${1}" | sed '/^IP:/!d;s/<[^>][^>]*>//g' ;}
geoip lookup

echo start > battery.txt; watch -n 60 'date >> battery.txt ; acpi -b >> battery.txt'

Battery real life energy vs predicted remaining plotted. This time I added a print to reemaining energy, every minute, time stamped.

The example shown here is complete and point to large discrepancies as time passes, converging to accuracy near the end.

for i in $(netstat --inet -n|grep ESTA|awk '{print $5}'|cut -d: -f1);do geoiplookup $i;done

Localize provenance of current established connections. Sample command to obtain a list of geographic localization for established connections, extracted from netstat. Need geoiplookup command ( part of geoip package under CentOS)


echo start > battery.txt; watch -n 60 'date >> battery.txt'

Do you really believe on Battery Remaining Time? Confirm it from time to time!

Fully recharge your computer battery and start this script.

It will create or clean the file named battery.txt, print a start on it and every minute it will append a time stamp to it.

Batteries last few hours, and each hour will have 60 lines of time stamping. Really good for assuring the system was tested in real life with no surprises.

The last time stamp inside the battery.txt file is of interest. It is the time the computer went off, as the battery was dead!

Turn on your computer after that, on AC power of course, and open battery.txt. Read the first and last time stamps and now you really know if you can trust your computer sensors.

If you want a simple line of text inside the battery.txt file, use this:

watch -n 60 'date > battery.txt'

The time of death will be printed inside

weather() { lynx -dump "http://mobile.weather.gov/port_zh.php?inputstring=$*" | sed 's/^ *//;/ror has occ/q;2h;/__/!{x;s/\n.*//;x;H;d};x;s/\n/ -- /;q';}

Show current weather for any US city or zipcode

Scrape the National Weather Service.


ord() { printf "%d\n" "'$1"; }
Get decimal ascii code from character

printf treats first char after single ' as numeric equivalent


for file in *.iso; do mkdir `basename $file | awk -F. '{print $1}'`; sudo mount -t iso9660 -o loop $file `basename $file | awk -F. '{print $1}'`; done

Make directories for and mount all iso files in a folder.

Enable Disk Quota in VPS

If you are experiencing an issue with OpenVZ VPS disk quota, please make sure that the following values are set in the VPS conf.

VPS conf Location : /etc/vz/conf/VEId.conf

In the main node, do the following steps.

1) #grep DISK_QUOTA /etc/vz/conf/VEId.conf

If no disk quota value has found ot it is disabled, change the value to

DISK_QUOTA=yes

2) Check that disk quota is enabled in the main server itself.

grep DISK_QUOTA /etc/sysconfig/vz

If not enable the value to yes in the conf.

DISK_QUOTA=yes

3) Check for the value quotaugidlimit .

#grep -i quotaugidlimit /etc/vz/conf/veid.conf


4) Check the quota module "vzdquota" is loaded or notin main node.

# lsmod |grep -i vzdquota

5) You can set the value quotaugidlimit from the main node using the below command.

vzctl set veid –quotaugidlimit 500 –save

6) Make sure to reboot the mentioned node from the main node.

vzctl restart veid

7) Enter the the node for which you are experiencing the problem.

vzctl enter veid

Type the command 'mount'. It should give a similar output.

# mount
/dev/simfs on / type reiserfs (rw,usrquota,grpquota)
/proc on /proc type proc (rw)
/sys on /sys type sysfs (rw)
none on /dev type tmpfs (rw)
none on /dev/pts type devpts (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)

Also make sure that symbolic links are existing from aquota.group and aquota.user to their respectve physical locations.


# ll
total 64
lrwxrwxrwx 1 root root 39 Oct 19 11:41 aquota.group -> /proc/vz/vzaquota/00000030/aquota.group
lrwxrwxrwx 1 root root 38 Oct 19 11:41 aquota.user -> /proc/vz/vzaquota/00000030/aquota.user
--

FasCGi Link

http://www.r0xarena.com/blog/installing-php-529-with-fastcgi-from-source-in-centos-53/

http://www.fastcgi.com

http://www.seaoffire.net/fcgi-faq.html#II

Install PHP,APACHE,MySQL - bash script

http://www.robertswarthout.com/2007/01/install-of-apache-223-mysql-5018-and-php-520/

64 bit version
---------------------


#!/bin/sh

# Abort on any errors
set -e

# Where do you want all this stuff built?
SRCDIR=/home/support/software/source

# Unpack our large file that contains all needed packages that are not going to be obtained from yum
#rm -Rf ${SRCDIR}
#gzip -d nbs_core_install.gz
#cd nbs_core_install/
#cp -R * ${SRCDIR}/

# Install gcc
yum -y install gcc

# Install cc
yum -y install cc

# Install libtool
yum -y install libtool

# Extract OpenSSH and install openssh and the sshd in the init.d
cd ${SRCDIR}
tar xzf ${SRCDIR}/openssh-4.5p1.tar.gz
cd ${SRCDIR}/openssh-4.5p1
./configure
make
make install
cp -f ${SRCDIR}/sshd.init.d /etc/rc.d/init.d/sshd
chmod 755 /etc/rc.d/init.d/sshd
rm -f /etc/rc.d/rc3.d/S70sshd
cd /etc/rc.d/rc3.d && ln -s /etc/rc.d/init.d/sshd S70sshd
rm -Rf ${SRCDIR}/openssh-4.5p1

# Install libjpeg-devel
yum -y install libjpeg-devel

# Install jpeg.v6b
cd ${SRCDIR}
tar xzf ${SRCDIR}/jpegsrc.v6b.tar.gz
cd ${SRCDIR}/jpeg-6b
cp /usr/share/libtool/config.guess ./
cp /usr/share/libtool/config.sub ./
./configure –enable-shared
make libdir=/usr/lib64
install -d /usr/local/man/man1
make libdir=/usr/lib64 install
rm -Rf ${SRCDIR}/jpeg-6b

# Install libtiff & libtiff-devel
yum -y install libtiff libtiff-devel

# Install Ghostscript (needed for ImageMagick)
yum -y install ghostscript

# Install ImageMagick
yum -y install ImageMagick

# Install libxml2
cd ${SRCDIR}
tar xzf ${SRCDIR}/libxml2-2.6.27.tar.gz
cd ${SRCDIR}/libxml2-2.6.27
./configure –enable-shared
make
make install
make tests
rm -Rf ${SRCDIR}/libxml2-2.6.27

# Install libxslt
cd ${SRCDIR}
tar xzf ${SRCDIR}/libxslt-1.1.19.tar.gz
cd ${SRCDIR}/libxslt-1.1.19
./configure –prefix=/usr
make
make install
rm -Rf ${SRCDIR}/libxslt-1.1.19

# Install zlib
cd ${SRCDIR}
tar xzf ${SRCDIR}/zlib-1.2.3.tar.gz
cd ${SRCDIR}/zlib-1.2.3
./configure –shared –prefix=/usr
make
make install
rm -Rf ${SRCDIR}/zlib-1.2.3

# Install libmcrypt
cd ${SRCDIR}
tar xzf ${SRCDIR}/libmcrypt-2.5.7.tar.gz
cd ${SRCDIR}/libmcrypt-2.5.7
./configure –disable-posix-threads –prefix=/usr
make
make install

# Install libmcrypt lltdl
cd ${SRCDIR}/libmcrypt-2.5.7/libltdl
./configure –prefix=/usr –enable-ltdl-install
make
make install
rm -Rf ${SRCDIR}/libmcrypt-2.5.7

# Install mhash
cd ${SRCDIR}
tar xzf ${SRCDIR}/mhash-0.9.7.1.tar.gz
cd ${SRCDIR}/mhash-0.9.7.1
./configure –prefix=/usr
make
make install
rm -Rf ${SRCDIR}/mhash-0.9.7.1

# Install Freetype
cd ${SRCDIR}
tar xzf ${SRCDIR}/freetype-2.2.1.tar.gz
cd ${SRCDIR}/freetype-2.2.1
./configure
make
make install
rm -Rf ${SRCDIR}/freetype-2.2.1

# Install libidn
cd ${SRCDIR}
tar xzf ${SRCDIR}/libidn-0.6.9.tar.gz
cd ${SRCDIR}/libidn-0.6.9
./configure –with-iconv-prefix=/usr –prefix=/usr
make
make install
rm -Rf ${SRCDIR}/libidn-0.6.9

# Install OpenSSL
cd ${SRCDIR}
tar xzf ${SRCDIR}/openssl-0.9.8d.tar.gz
cd ${SRCDIR}/openssl-0.9.8d
./config
make
make test
make install
rm -Rf ${SRCDIR}/openssl-0.9.8d

# Install cURL
cd ${SRCDIR}
tar xzf ${SRCDIR}/curl-7.15.0.tar.gz
cd ${SRCDIR}/curl-7.15.0
./configure –enable-ipv6 –enable-cookies –enable-crypto-auth –prefix=/usr
make
make install
rm -Rf ${SRCDIR}/curl-7.15.0

# Install c-client (IMAP)
cd ${SRCDIR}
tar xzf ${SRCDIR}/imap-2004g.tar.Z
cd ${SRCDIR}/imap-2004g
make lrh
cp c-client/c-client.a /usr/lib/libc-client.a
cp c-client/*.h /usr/include
rm -Rf ${SRCDIR}/imap-2004g

# Install Apache
cd ${SRCDIR}
tar xzf ${SRCDIR}/httpd-2.2.3.tar.gz
cd ${SRCDIR}/httpd-2.2.3
./configure –enable-rewrite –enable-ssl –enable-deflate –enable-so –enable-proxy –prefix=/usr/local/apache2
make
make install
rm -Rf ${SRCDIR}/httpd-2.2.3

# Install httpd init.d file
cd ${SRCDIR}
rm -f /etc/rc.d/init.d/httpd
cp httpd.init.d /etc/rc.d/init.d/httpd
chmod 755 /etc/rc.d/init.d/httpd
rm -f /etc/rc.d/rc3.d/K*httpd
rm -f /etc/rc.d/rc3.d/S*httpd
cd /etc/rc.d/rc3.d && ln -s /etc/rc.d/init.d/httpd F15sshd

# Install libpng
cd ${SRCDIR}
tar xzf ${SRCDIR}/libpng-1.2.15.tar.gz
cd ${SRCDIR}/libpng-1.2.15
./configure
make
make install
rm -Rf ${SRCDIR}/libpng-1.2.15

# Install MySQL
yum -y install perl-DBI
cd ${SRCDIR}
rpm -i MySQL-server-standard-5.0.18-0.rhel4.x86_64.rpm
rpm -i MySQL-client-standard-5.0.18-0.rhel4.x86_64.rpm
rpm -i MySQL-devel-standard-5.0.18-0.rhel4.x86_64.rpm
rpm -i MySQL-shared-standard-5.0.18-0.rhel4.x86_64.rpm
rpm -i MySQL-standard-debuginfo-5.0.18-0.rhel4.x86_64.rpm
ln -s /usr/lib64/mysql/libmysqlclient.a /usr/lib/libmysqlclient.a

# Install Flex
yum -y install flex

# Install libdv
yum -y install libdv

# Install re2c needed for php pfro compile
cd ${SRCDIR}
tar zxf ${SRCDIR}/re2c-0.11.0.tar.gz
cd ${SRCDIR}/re2c-0.11.0
./configure
make
make install

# Install PHP
cd ${SRCDIR}
tar xzf ${SRCDIR}/php-5.2.0.tar.gz
cd ${SRCDIR}/php-5.2.0
./configure ‘–prefix=/usr’ ‘–exec-prefix=/usr’ ‘–bindir=/usr/bin’ ‘–sbindir=/usr/sbin’ ‘–sysconfdir=/etc’ ‘–datadir=/usr/share’ ‘–includedir=/usr/include’ ‘–libdir=/usr/lib64′ ‘–libexecdir=/usr/libexec’ ‘–localstatedir=/var’ ‘–sharedstatedir=/usr/com’ ‘–mandir=/usr/share/man’ ‘–infodir=/usr/share/info’ ‘–with-mcrypt=/usr’ ‘–with-config-file-path=/etc’ ‘–with-bz2′ ‘–with-curl’ ‘–with-curl-ssl’ ‘–with-exec-dir=/usr/bin’ ‘–with-freetype-dir=/usr’ ‘–with-png-dir=/usr’ ‘–with-gd’ ‘–with-ttf’ ‘–with-gdbm’ ‘–with-gettext’ ‘–with-ncurses’ ‘–with-gmp’ ‘–with-iconv’ ‘–with-jpeg’ ‘–with-openssl’ ‘–with-png’ ‘–with-regex=system’ ‘–with-xsl=/usr’ ‘–with-expat-dir=/usr’ ‘–with-zlib’ ‘–with-layout=GNU’ ‘–with-kerberos=/usr/kerberos’ ‘–with-apxs2=/usr/local/apache2/bin/apxs’ ‘–without-oci8′ ‘–enable-inline-optimization’ ‘–enable-gd-native-ttf’ ‘–enable-exif’ ‘–enable-ftp’ ‘–enable-sockets’ ‘–enable-trans-sid’ ‘–enable-memory-limit’ ‘–disable-rpath’ ‘–disable-debug’ ‘–with-mysql=/usr/local/mysql’ ‘–with-mysqli=/usr/bin/mysql_config’
make
make install
cp php.ini-dist /etc/php.ini
rm -Rf ${SRCDIR}/php-5.2.0

# Install Memcache PHP Extension
cd ${SRCDIR}
tar xzf ${SRCDIR}/memcache-2.1.0.tgz
cd ${SRCDIR}/memcache-2.1.0
phpize
./configure
make
mkdir /usr/local/phpextensions/
cp ${SRCDIR}/memcache-2.1.0/modules/memcache.so /usr/local/phpextensions/
rm -Rf ${SRCDIR}/memcache-2.1.0

# Install APC (php cache)
cd ${SRCDIR}
tar xzf ${SRCDIR}/APC-3.0.12p2.tgz
cd ${SRCDIR}/APC-3.0.12p2
phpize
./configure –enable-apc-mmap=yes –with-apxs2=/usr/local/apache2/bin/apxs
make
cd ${SRCDIR}/APC-3.0.12p2/modules/
cp apc.so /usr/local/phpextensions

# Install libevent-devel
yum -y install libevent-devel

# Install Memcache Daemon
cd ${SRCDIR}
tar xzf ${SRCDIR}/memcached-1.2.1.tar.gz
cd ${SRCDIR}/memcached-1.2.1
./configure
make
make install
rm -Rf ${SRCDIR}/memcached-1.2.1

# Install BRUTIS
cd ${SRCDIR}
cp monitor.php /home/support/
chmod 700 /home/support/monitor.php
cp ${SRCDIR}/crontab_root /var/spool/cron/root

# Install perl-Net-SSLeay
yum -y install perl-Net-SSLeay

# Install Webmin
cd ${SRCDIR}
rpm -U webmin-1.310-1.noarch.rpm

echo
echo
echo ———- INSTALL COMPLETE! ———-
echo
echo



32 bit version

----------------------



#!/bin/sh

# Abort on any errors
set -e

# Where do you want all this stuff built?
SRCDIR=/home/support/software/source

# Install gcc
yum -y install gcc

# Install libtool
yum -y install libtool

# Extract OpenSSH and install openssh and the sshd in the init.d
cd ${SRCDIR}
tar xzf ${SRCDIR}/openssh-4.5p1.tar.gz
cd ${SRCDIR}/openssh-4.5p1
./configure
make
make install
cp -f ${SRCDIR}/sshd.init.d /etc/rc.d/init.d/sshd
chmod 755 /etc/rc.d/init.d/sshd
rm -f /etc/rc.d/rc3.d/S70sshd
cd /etc/rc.d/rc3.d && ln -s /etc/rc.d/init.d/sshd S70sshd
rm -Rf ${SRCDIR}/openssh-4.5p1

# Install libjpeg-devel
yum -y install libjpeg-devel

# Install jpeg.v6b
cd ${SRCDIR}
tar xzf ${SRCDIR}/jpegsrc.v6b.tar.gz
cd ${SRCDIR}/jpeg-6b
cp /usr/share/libtool/config.guess ./
cp /usr/share/libtool/config.sub ./
./configure –enable-shared
make
install -d /usr/local/man/man1
make install
rm -Rf ${SRCDIR}/jpeg-6b

# Install libtiff & libtiff-devel
yum -y install libtiff libtiff-devel

# Install Ghostscript (needed for ImageMagick)
yum -y install ghostscript

# Install ImageMagick
yum -y install ImageMagick

# Install libxml2
cd ${SRCDIR}
tar xzf ${SRCDIR}/libxml2-2.6.27.tar.gz
cd ${SRCDIR}/libxml2-2.6.27
./configure –enable-shared
make
make install
make tests
rm -Rf ${SRCDIR}/libxml2-2.6.27

# Install libxslt
cd ${SRCDIR}
tar xzf ${SRCDIR}/libxslt-1.1.19.tar.gz
cd ${SRCDIR}/libxslt-1.1.19
./configure –prefix=/usr
make
make install
rm -Rf ${SRCDIR}/libxslt-1.1.19

# Install libmcrypt
cd ${SRCDIR}
tar xzf ${SRCDIR}/libmcrypt-2.5.7.tar.gz
cd ${SRCDIR}/libmcrypt-2.5.7
./configure –prefix=/usr
make
make install

# Install Freetype
cd ${SRCDIR}
tar xzf ${SRCDIR}/freetype-2.2.1.tar.gz
cd ${SRCDIR}/freetype-2.2.1
./configure
make
make install
rm -Rf ${SRCDIR}/freetype-2.2.1

# Install OpenSSL
cd ${SRCDIR}
tar xzf ${SRCDIR}/openssl-0.9.8d.tar.gz
cd ${SRCDIR}/openssl-0.9.8d
./config
make
make test
make install
rm -Rf ${SRCDIR}/openssl-0.9.8d

# Install cURL
cd ${SRCDIR}
tar xzf ${SRCDIR}/curl-7.15.0.tar.gz
cd ${SRCDIR}/curl-7.15.0
./configure –enable-ipv6 –enable-cookies –enable-crypto-auth –prefix=/usr
make
make install
rm -Rf ${SRCDIR}/curl-7.15.0

# Install c-client (IMAP)
cd ${SRCDIR}
tar xzf ${SRCDIR}/imap-2004g.tar.Z
cd ${SRCDIR}/imap-2004g
make lrh
cp c-client/c-client.a /usr/lib/libc-client.a
cp c-client/*.h /usr/include
rm -Rf ${SRCDIR}/imap-2004g

# Install Apache
cd ${SRCDIR}
tar xzf ${SRCDIR}/httpd-2.2.3.tar.gz
cd ${SRCDIR}/httpd-2.2.3
./configure –enable-rewrite –enable-ssl –enable-deflate –enable-so –enable-proxy –prefix=/usr/local/apache2
make
make install
rm -Rf ${SRCDIR}/httpd-2.2.3

# Install httpd init.d file
cd ${SRCDIR}
rm -f /etc/rc.d/init.d/httpd
cp httpd.init.d /etc/rc.d/init.d/httpd
chmod 755 /etc/rc.d/init.d/httpd
rm -f /etc/rc.d/rc3.d/K*httpd
rm -f /etc/rc.d/rc3.d/S*httpd
cd /etc/rc.d/rc3.d && ln -s /etc/rc.d/init.d/httpd F15sshd

# Install libpng
cd ${SRCDIR}
tar xzf ${SRCDIR}/libpng-1.2.15.tar.gz
cd ${SRCDIR}/libpng-1.2.15
./configure
make
make install
rm -Rf ${SRCDIR}/libpng-1.2.15

# Install MySQL
yum -y install perl-DBI
cd ${SRCDIR}
rpm -i MySQL-server-standard-5.0.18-0.rhel3.i386.rpm
rpm -i MySQL-client-standard-5.0.18-0.rhel3.i386.rpm
rpm -i MySQL-devel-standard-5.0.18-0.rhel3.i386.rpm
rpm -i MySQL-shared-standard-5.0.18-0.rhel3.i386.rpm

# Install Flex
yum -y install flex

# Install libdv
yum -y install libdv

# Install PHP
cd ${SRCDIR}
tar xzf ${SRCDIR}/php-5.2.0.tar.gz
cd ${SRCDIR}/php-5.2.0
./configure ‘–prefix=/usr’ ‘–exec-prefix=/usr’ ‘–bindir=/usr/bin’ ‘–sbindir=/usr/sbin’ ‘–sysconfdir=/etc’ ‘–datadir=/usr/share’ ‘–includedir=/usr/include’ ‘–libdir=/usr/lib64′ ‘–libexecdir=/usr/libexec’ ‘–localstatedir=/var’ ‘–sharedstatedir=/usr/com’ ‘–mandir=/usr/share/man’ ‘–infodir=/usr/share/info’ ‘–with-mcrypt=/usr’ ‘–with-config-file-path=/etc’ ‘–with-bz2′ ‘–with-curl’ ‘–with-curl-ssl’ ‘–with-exec-dir=/usr/bin’ ‘–with-freetype-dir=/usr’ ‘–with-png-dir=/usr’ ‘–with-gd’ ‘–with-ttf’ ‘–with-gdbm’ ‘–with-gettext’ ‘–with-ncurses’ ‘–with-gmp’ ‘–with-iconv’ ‘–with-jpeg’ ‘–with-openssl’ ‘–with-png’ ‘–with-regex=system’ ‘–with-xsl=/usr’ ‘–with-expat-dir=/usr’ ‘–with-zlib’ ‘–with-layout=GNU’ ‘–with-kerberos=/usr/kerberos’ ‘–with-apxs2=/usr/local/apache2/bin/apxs’ ‘–without-oci8′ ‘–enable-inline-optimization’ ‘–enable-gd-native-ttf’ ‘–enable-exif’ ‘–enable-ftp’ ‘–enable-sockets’ ‘–enable-trans-sid’ ‘–enable-memory-limit’ ‘–disable-rpath’ ‘–disable-debug’ ‘–with-mysql=/usr/local/mysql’ ‘–with-mysqli=/usr/bin/mysql_config’
make
make install
cp php.ini-dist /etc/php.ini
rm -Rf ${SRCDIR}/php-5.2.0

# Install Memcache PHP Extension
cd ${SRCDIR}
tar xzf ${SRCDIR}/memcache-2.1.0.tgz
cd ${SRCDIR}/memcache-2.1.0
phpize
./configure
make
mkdir /usr/local/phpextensions/
cp ${SRCDIR}/memcache-2.1.0/modules/memcache.so /usr/local/phpextensions/
rm -Rf ${SRCDIR}/memcache-2.1.0

# Install APC (php cache)
cd ${SRCDIR}
tar xzf ${SRCDIR}/APC-3.0.12p2.tgz
cd ${SRCDIR}/APC-3.0.12p2
phpize
./configure –enable-apc-mmap=yes –with-apxs2=/usr/local/apache2/bin/apxs
make
cd ${SRCDIR}/APC-3.0.12p2/modules/
cp apc.so /usr/local/phpextensions

# Install libevent-devel
yum -y install libevent-devel

# Install Memcache Daemon
cd ${SRCDIR}
tar xzf ${SRCDIR}/memcached-1.2.1.tar.gz
cd ${SRCDIR}/memcached-1.2.1
./configure
make
make install
rm -Rf ${SRCDIR}/memcached-1.2.1

# Install BRUTIS
cd ${SRCDIR}
cp monitor.php /home/support/
chmod 700 /home/support/monitor.php
cp ${SRCDIR}/crontab_root /var/spool/cron/root

# Install perl-Net-SSLeay
yum -y install perl-Net-SSLeay

# Install Webmin
cd ${SRCDIR}
rpm -U webmin-1.310-1.noarch.rpm

echo
echo
echo ———- INSTALL COMPLETE! ———-
echo
echo

How to reset mysql admin password in windows plesk

Once you have logged into the server you via Remote Desktop you will need to take the following steps:

1. Go to 'Start >> Run' and type in 'services.msc'.
2. Now you will need to look for 'MySql Server' In the Services window.
3. Right click on 'MySql Server' and go to 'Properties'.
4. Once you have copied the location of the 'my.ini' file like the following example you will need to go to 'Start >> Run' and then enter in the location of the 'my.ini' file.

C:\Program Files\SWsoft\Plesk\Databases\MySQL\Data\my.ini
5. Under the '[mysqld]' section in the 'my.ini' file you will need to add the following line:

skip-grant-tables
6. Restart 'MySql Server'.
7. Then you will need to login to MySql:

cd C:\Program Files\SWsoft\Plesk\MySQL\bin

C:\Program Files\SWsoft\Plesk\MySQL\bin>mysql -u admin
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 7 to server version: 4.1.18-nt

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.


mysql> use mysql;
mysql> UPDATE mysql.user SET Password=PASSWORD('newpwd') WHERE User='admin';
mysql> FLUSH PRIVILEGES;
mysql> quit;
8. Then you will need to remove 'skip-grant-tables' from the my.ini file and restart 'MySql' after resaving the my.ini file.



Method 2
---------------

http://kb.parallels.com/en/3661

You first need to make sure you have MySQL Admin installed as part of the MySQL build.

The below article is taken from the MySQL site:

1.) Log on to your system as Administrator.

2.) Stop the MySQL server if it is running. For a server that is running as a Windows service, go to the Services manager:
Start Menu -> Control Panel -> Administrative Tools -> Services

3.) Find the MySQL service in the list, and stop it. Open a console window to get to the DOS command prompt:
Start Menu -> Run -> cmd

4.) We are assuming that you installed MySQL to `C:\\mysql'. If you installed MySQL to another location, adjust the following commands accordingly. At the DOS command prompt, execute this command:
C:\> C:\mysql\bin\mysqld-nt --skip-grant-tables

This starts the server in a special mode that does not check the grant tables to control access.

5.) Keeping the first console window open, open a second console window and execute the following commands (type each on a single line):
C:\> C:\mysql\bin\mysqladmin -u root flush-privileges password "newpwd"
C:\> C:\mysql\bin\mysqladmin -u root -p shutdown

6.) Replace ``newpwd'' with the actual root password that you want to use. The second command will prompt you to enter the new password for access. Enter the password that you assigned in the first command.

7.) Stop the MySQL server, then restart it in normal mode again. If you run the server as a service, start it from the Windows Services window. If you start the server manually, use whatever command you normally use.

8.) You should now be able to connect using the new password.

These details are also found at the following link:
http://dev.mysql.com/doc/mysql/en/resetting-permissions.html

SPF Rule Check

Please go through this link, if you get an error like email spoofing or associated issues. You can use the below given link to verify the validity of the rule that you have created.

http://www.kitterman.com/spf/validate.html

You can check the below link to create the SPF record of your wish.

http://www.openspf.org/

Also most acceptable condition is with the '~' but not with '-'. The latter is Fail condition while the former is softfail. Latter will act like a neutral condition, ie, neither accept nor reject.

Also if you notice spamming in the server please try to grep the home directory in the exim error logs/applicable logs.

tail -f /var/log/exim_mainlog | grep "cwd=/home"

If the mail was generated from the home, then it will give hints to the spammer directory.

Also make sure to disable the php - nobody. Try to configure the same from the backend of the server.

http://www.webhostgear.com/232.html


Use following two script to catch the spammer.

1. exim -bpr | grep "<*@*>" | awk '{print $4}'|grep -v "<>" | sort | uniq -c | sort -n

That will show you the maximum no of email currently in the mail queue have from or to the email address in the mail queue with exact figure.

2. exim -bpr | grep "<*@*>" | awk '{print $4}'|grep -v "<>" |awk -F "@" '{ print $2}' | sort | uniq -c | sort -n

That will show you the maximum number of emails currently in the mail queue have for the domain or from the domain with number.

Libsafe Installation

1)Download it from http://fresh.t-systems-sfr.com/linux/misc/libsafe-2.0-16.tgz
2)tar xvfz libsafe-2.0-16.tgz
3)cd libsafe-2.0-16
4)make
5)make install


OVERVIEW
------------

One of the more common types of attacks directed at Linux systems comes in the form of buffer overflows, which have accounted for more than 50 percent of CERT advisories. The attacks can be quite difficult to guard against since they usually involve software flaws. The vulnerabilities reside within programs themselves and are caused when a section of memory is overwritten.

Preventing these attacks has historically involved the modification of the source code and recompilation. However, Libsafe offers another way to deal with these dangerous flaws. Libsafe is a dynamically loadable library that intercepts calls to unsafe functions and processes them so that hackers can't hijack the process and run the code of their choice. The most valuable aspect of Libsafe is that it can help you guard your Linux systems against buffer overflow vulnerabilities that have yet to be discovered.

Understanding buffer overflows
The main purpose of an attack using buffer overflow techniques is to gain access to privileged user space on a target machine. Buffer overflows can also crash a program or even cause system instability due to vulnerabilities in the software itself.

In a buffer overflow, a section of memory corresponding to a variable used by a program is overwritten. Buffer overflows have been found in all sorts of system programs and daemons such as syslogd, Sendmail, Apache, WU-FTPD, and BIND, to name but a few. Since information security has become more and more of a concern in IT, methods for avoiding, diagnosing, and documenting these exploits have improved. Yet, despite security audits and careful programming, some bugs remain present in many software programs and are not discovered until later.

Let's consider an example of a buffer overflow. When a user connects to an FTP server, the daemon displays a prompt requesting a username. We'll assume that the program is expecting a string of no more than 256 characters and is not programmed to perform an argument check. The program will work fine—that is, until a malicious individual decides to test its weaknesses by passing it a 257-character string. Now, the allocated memory space doesn’t have enough room, and the next portion up gets written over. This may not sound bad at first, but its effects can be surprising. It all depends on what is in the memory space that has been overwritten, how much of it was overwritten, and what it was overwritten with. This can be impossible to determine beforehand and can cause strange things to happen.

Buffer overflows can also be used in what are called “stack-smashing” attacks, where someone can execute his or her own code on a target system. When a program is executed, it uses an area of memory called the stack. The stack stores function arguments and local variables, among other things. If a particular variable that resides in the stack is susceptible to a buffer overflow, a hacker can use this information to gain access to the system.

Similar to buffer overflows are “format string” exploits. These also attempt to access out-of-bounds memory space to gain access to a Linux system. One way to do this is to pass special formatting characters to a print command that doesn't do any format checking. In this manner, the special characters can actually reference memory space and cause program instability. Once again, this falls into the programmers' hands and can be avoided with good coding practices. The C function sprintf(string, “%s”); is an example of good practice, while sprintf(string); would be considered unsafe, as it does not provide formatting information.

It's important to remember that a hacker needs to compromise a program that is run as root to get a root shell (which is almost always the goal of the hacker). In recent years, there has been a migration from running programs as root to using a separate user account. Many programs will create a user specifically for running program tasks and will avoid using root as much as possible. In this fashion, even if a program is compromised, the user will not have total control of the system.

A closer look at Libsafe
Libsafe is a system library that intercepts calls to specific unsafe functions and handles them securely. This allows it to handle precompiled executables, meaning that manually editing the source and recompiling (or waiting for the maintainer to do this) is not necessary. Also, and possibly more important, it will work on bugs in software programs that have not been discovered yet. It can do this because it intercepts all calls to a particular function, performs the task, and sends back the information without the calling program's knowledge.

Even if a program has been written using bad techniques, Libsafe will stop it from possibly being exploited. It will do this systemwide and will be transparent to the programs themselves. The main idea is to set an upper limit on the size of the buffer that is used in a particular function. Although this can't be done at compilation time, it can be done when the function is actually called. Libsafe checks the current stack and sets a realistic limit so that the buffer can't be overwritten.

Libsafe currently handles these unsafe functions:
strcpy(char *dest, const char *src)
strpcpy(char *dest, const char *src)
wcscpy(wchar_t *dest, const wchar_t *src)
wcpcpy(wchar_t *dest, const wchar_t *src)
strcat(char *dest, const char *src)
wcscat(wchar_t *dest, const wchar_t *src)
getwd(char *buf)
gets(char *s)
scanf(const char *format, ...)
realpath(char *path, char resolved_path[])
sprintf(char *str, const char *format, ...)

These are the more common ones that are problematic in C and C++ programs in a Linux environment. Most programmers should already be aware of issues coming from buffer overflows. But mistakes can and will be made, which is understandable, especially with larger programs containing a thousand or more lines of code. Libsafe provides an excellent way to safeguard against unsafe programming practices and does so with very little process latency.