Tuesday, November 3, 2009

IIS for WinXP Home

Windows XP Home Edition is not come with IIS service. So for those who need IIS to run on some application, there need go for Windows XP Pro Edition. It’s that great that windows xp home edition is come with IIS service? We still can install the IIS service on Windows XP Home edition as the step below.

1. We need the installation CD of Windows 2000 Professional or Server
2. Copy the directory i386 from the WinXP Home to your hard disk (If you don’t have 2 CD-ROM)
3. In this directory (i386) there is a file called IMS.CAB with WinRar (or something similar) unpack the content to a temporary folder (you will need them at the end of the installation)
4. Search for and find the file: c:\WINDOWS\INF\SYSOC.INF
5. In the section [COMPONENTS] you will find this line: iis=iis.dll,OcEntry,iis.inf,hide,7
6. Change it to this: iis=iis2.dll,OcEntry,iis2.inf,,7 (remember to change the name in iis2.dll and iis2.inf and to eliminate the word hide. In this way you bypass the protection of XP home)
7. From the Win2000 cd (Pro or Server) take the files: iis.dl_ and iis.in_ that are in the i386 folder and copy them on your desktop, open a dos windows and with the prompt pointing at your desktop edit the following commands:
EXPAND IIS.DL_ IIS2.DLL
EXPAND IIS.IN_ IIS2.INF
this will generate two new files named iis2.dll and iis2.inf
copy and paste IIS2:DLL to c:\WINDOWS\SYSTEM32\SETUP\
and IIS.INF to c:\WINDOWS\INF\
8. Go to control panel/application/windows components (I don’t have an English version of Windows so I don’t know exactly the name) and start windows installer. You will see “Internet Information server” is now available as a checkable option.
9. Select it (I suggest that if you are looking only for PWS to select only that because the more components you install the more files you have to search for)
10. It will need about 10/15 minutes and during that time the system is going to ask you for a lot of files: some are in XP Home CD other in Win2000 CD. At a certain point the system will ask you for the EXCH_adsiisex.dll file: it is the file you have extracted at the point 3 of this guide, select it and you should go on without trouble.
11. At the end restart you computer.
12. Test if it is working: open Internet Explorer and type in the address line: http://localhost
13. If it will not work, try the following:
open a DOS window and type: iisreset /RESTART
go to web proprieties in “directory protection” (I don’t know if this is the exact name on an English version) click on “modify” (or edit, as said before I don’t have an English version …) “browse” and finally”find”. You will see all user in your PC. Select the one you are working with and click OK. In the text-box you will see PcName\UserName. Click OK to close the window. Remember to uncheck “password Control) and click OK three times. Close and restart the web server and retry point 12. If all is correct you will see the default presentation page of IIS 5 and the online help

Tuesday, October 6, 2009

Disable USB Removable Mass Storage Device Drive Access in Windows

  1. Run Registry Editor (regedit).
  2. Navigate to the following registery key

    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\UsbStor

  3. In the right pane, double click on the Start value name.
  4. Change the value data to 4 to disable the removable USB mass storage device drive access.
  5. To revert and re-enable the drive access for removable USB mass storage device driver, change back the value data for Start to its original default of 3.

How to Hide and Loch Hardisk Drive In windows

  1. Click on the "Start" button. Go to "Run", type "gpedit.msc" and press enter.
  2. Wait for the "Group Policy" window to appear. Click on the "+" button behind "Administrative Templates". Then click the "+" button behind "Windows Components" and then "Windows Explorer".
  3. Search for "Hide these specified drives in My Computer" in the options that appear in the right column of the window. Double click it, enable it and choose the drive(s) you want to hide.
  4. Search for "Prevent access to drives from My Computer". Double click it and repeat the previous step if you want to stop accessing any drive by "command" (e.g, by typing "C:" in the address bar or "Run").
  5. Close the group policy window.
  6. Restart your computer for changes to take effect.

To Remove Drive Open with option

first go to run then write " regedit" that is registry
then find " ctrl+f"
in this box write "mountpoints2" and delete it ......
then again press "ctrl+f" again find mountpoints2 until all these files are not deleted
then u will see ur problems is solved................

Saturday, October 3, 2009

How to install + Yum in Red Hat Enterprise Linux 4

Setting up the yum package manager is not required by everyone who downloads and installs Red Hat Enterprise Linux 4. If you will be using your Linux system on the U of S wireless network or other services that use the yum package manager, you need to complete this step. Red Hat Enterprise Linux 5 will use the yum package manager as the standard package manager.
############################################################


  1. Download the following rpms from http://dag.wieers.com/packages/
  1. Install the rpms as root from the command line.
  2. # rpm -Uvh python* sqlite* yum* rpmforge-release*

  3. Add the ATrpms repository to your /etc/yum.conf by adding the following lines
    [atrpms]
    name=Red Hat Enterprise Linux $releasever - $basearch - ATrpms
    baseurl=http://dl.atrpms.net/el4-$basearch/atrpms/stable
    gpgkey=http://ATrpms.net/RPM-GPG-KEY.atrpms
    gpgcheck=1
  4. Update the yum database.
yum update
Search the packages available from RHN.
yum search wine
Install packages
yum install wine

What does myisamchk do?

  1. How do you start and stop MySQL on Windows? - net start MySQL, net stop MySQL
  2. How do you start MySQL on Linux? - /etc/init.d/mysql start
  3. Explain the difference between mysql and mysqli interfaces in PHP? - mysqli is the object-oriented version of mysql library functions.
  4. What’s the default port for MySQL Server? - 3306
  5. What does tee command do in MySQL? - tee followed by a filename turns on MySQL logging to a specified file. It can be stopped by command notee.
  6. Can you save your connection settings to a conf file? - Yes, and name it ~/.my.conf. You might want to change the permissions on the file to 600, so that it’s not readable by others.
  7. How do you change a password for an existing user via mysqladmin? - mysqladmin -u root -p password "newpassword"
  8. Use mysqldump to create a copy of the database? - mysqldump -h mysqlhost -u username -p mydatabasename > dbdump.sql
  9. Have you ever used MySQL Administrator and MySQL Query Browser? Describe the tasks you accomplished with these tools.
  10. What are some good ideas regarding user security in MySQL? - There is no user without a password. There is no user without a user name. There is no user whose Host column contains % (which here indicates that the user can log in from anywhere in the network or the Internet). There are as few users as possible (in the ideal case only root) who have unrestricted access.
  11. Explain the difference between MyISAM Static and MyISAM Dynamic. - In MyISAM static all the fields have fixed width. The Dynamic MyISAM table would include fields such as TEXT, BLOB, etc. to accommodate the data types with various lengths. MyISAM Static would be easier to restore in case of corruption, since even though you might lose some data, you know exactly where to look for the beginning of the next record.
  12. What does myisamchk do? - It compressed the MyISAM tables, which reduces their disk usage.
  13. Explain advantages of InnoDB over MyISAM? - Row-level locking, transactions, foreign key constraints and crash recovery.
  14. Explain advantages of MyISAM over InnoDB? - Much more conservative approach to disk space management - each MyISAM table is stored in a separate file, which could be compressed then with myisamchk if needed. With InnoDB the tables are stored in tablespace, and not much further optimization is possible. All data except for TEXT and BLOB can occupy 8,000 bytes at most. No full text indexing is available for InnoDB. TRhe COUNT(*)s execute slower than in MyISAM due to tablespace complexity.
  15. What are HEAP tables in MySQL? - HEAP tables are in-memory. They are usually used for high-speed temporary storage. No TEXT or BLOB fields are allowed within HEAP tables. You can only use the comparison operators = and <=>. HEAP tables do not support AUTO_INCREMENT. Indexes must be NOT NULL.
  16. How do you control the max size of a HEAP table? - MySQL config variable max_heap_table_size.
  17. What are CSV tables? - Those are the special tables, data for which is saved into comma-separated values files. They cannot be indexed.
  18. Explain federated tables. - Introduced in MySQL 5.0, federated tables allow access to the tables located on other databases on other servers.
  19. What is SERIAL data type in MySQL? - BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT
  20. What happens when the column is set to AUTO INCREMENT and you reach the maximum value for that table? - It stops incrementing. It does not overflow to 0 to prevent data losses, but further inserts are going to produce an error, since the key has been used already.
  21. Explain the difference between BOOL, TINYINT and BIT. - Prior to MySQL 5.0.3: those are all synonyms. After MySQL 5.0.3: BIT data type can store 8 bytes of data and should be used for binary data.
  22. Explain the difference between FLOAT, DOUBLE and REAL. - FLOATs store floating point numbers with 8 place accuracy and take up 4 bytes. DOUBLEs store floating point numbers with 16 place accuracy and take up 8 bytes. REAL is a synonym of FLOAT for now.
  23. If you specify the data type as DECIMAL (5,2), what’s the range of values that can go in this table? - 999.99 to -99.99. Note that with the negative number the minus sign is considered one of the digits.
  24. What happens if a table has one column defined as TIMESTAMP? - That field gets the current timestamp whenever the row gets altered.
  25. But what if you really want to store the timestamp data, such as the publication date of the article? - Create two columns of type TIMESTAMP and use the second one for your real data.
  26. Explain data type TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP - The column exhibits the same behavior as a single timestamp column in a table with no other timestamp columns.
  27. What does TIMESTAMP ON UPDATE CURRENT_TIMESTAMP data type do? - On initialization places a zero in that column, on future updates puts the current value of the timestamp in.
  28. Explain TIMESTAMP DEFAULT ‘2006:09:02 17:38:44′ ON UPDATE CURRENT_TIMESTAMP. - A default value is used on initialization, a current timestamp is inserted on update of the row.
  29. If I created a column with data type VARCHAR(3), what would I expect to see in MySQL table? - CHAR(3), since MySQL automatically adjusted the data type.

Wednesday, September 23, 2009

SHELL SCRIPT

# How do you find out what’s your shell? - echo $SHELL
# What’s the command to find out today’s date? - date
# What’s the command to find out users on the system? - who
# How do you find out the current directory you’re in? - pwd
# How do you remove a file? - rm
# How do you remove a Directory ? rm -rf
# How do you find out your own username? - whoami
# How do you count words, lines and characters in a file? - wc
# How do you search for a string inside a given file? - grep string filename
# How do you search for a string inside a directory? - grep string *
# How do you search for a string in a directory with the subdirectories recursed? -grep -r string *
# How do you do Boolean logic operators in shell scripting? - ! tests for logical not, -a tests for logical and, and -o tests for logical or.
# How do you find out the number of arguments passed to the shell script? - $#
# What’s a way to do multilevel if-else’s in shell scripting? - if {condition} then {statement} elif {condition} {statement} fi
# How do you write a for loop in shell? - for {variable name} in {list} do {statement} done
# How do you write a while loop in shell? - while {condition} do {statement} done
# How does a case statement look in shell scripts? - case {variable} in {possible-value-1}) {statement};; {possible-value-2}) {statement};; esac
# How do you read keyboard input in shell scripts? - read {variable-name}
# How do you define a function in a shell script? - function-name() { #some code here return }

Check Whether a Directory is Empty or Not
#!/bin/bash
FILE=""
DIR=""
# init
# look for empty dir
if [ "$(ls -A $DIR)" ]; then
echo "$DIR is not Empty"
else
echo "$DIR is Empty"
fi
# rest of the logic
###############################################################
following find command will only print file name from /tmp. If there is no output, directory is empty.
$ find "/tmp" -type f -exec echo Found file {} \;
##################################################################

To search through a directory and find files containing text string mytest and then copy that file with that text string to another directory



#!/bin/bash
files="$(find /Test | xargs grep mytest | cut -d ":" -f1 | uniq)"
echo $files
for X in $files
do
cp $X /test1
done
####################################################################

Copy a file with password threw a shell script

read -p "Enter a password" pass
if test "$pass" == "nikhil"
then
cp -dpR /etc/resolv.conf /etc/resolv.conf.nikhil
echo "Password verified."
else
echo "Access denied."
fi
####################################################################

Friday, July 31, 2009

Telnet +POP and SMTP Commands for send and retrieving mails

Telnet - POP Commands

To access your mailbox you need 4 things:

  • An active internet connection
  • The address of your pop mail server
  • Your username
  • Your password

The first thing to do is to open a connection from your computer to your mail server.
telnet pop.yourdomain.com 110 (default port is 110)
You should receive a reply like:
Trying ???.???.???.???...
Connected to pop.yourdomain.com
Escape character is '^]'.
+OK ready

Then log in:
USER username (yousrusername eg: username@yourdomain.com)

This should give you:
+OK Password required for userName.

Now give your password:
PASS passW0rd
+OK logged in.

To see a list of your emails awaiting collection use the
LIST command, this will also show you the id number of your messages (e.g. 1 or 2 etc.)
To view the contents of an email type
RETR + the id number of the message (e.g RETR 1).
To delete a message use
DELE + the id number of the message (e.g DELE 1).
To leave your mailbox and close the connection use
QUIT

Telnet - SMTP Commands

To access your mailbox you will need 3 things.

  • An active internet connection
  • The address of a mail server capable of relaying for you - usually provided by your dialup provider
  • A valid email address

The first thing to do is to open a connection from your computer to your mail server.
telnet smtp.yourdomain.com 25
You should receive a reply like:
Trying ???.???.???.???...
Connected to smtp.yourdomain.com.
Escape character is '^]'.

You will then need to delcare where you are sending the email from:
HELO smtp.yourdomain.com - dont worry too much about your local domain name although you really should use your exact fully qualified domain name as seen by the outside world the mail server has no choice but to take your word for it as of RFC822-RFC1123.
This should give you:
250 mail.domain.ext Hello smtp.yourdomain.com [loc.al.i.p], pleased to meet you

Now give your email address:
MAIL FROM: username@smtp.yourdomain.com
Should yeild:
250 2.1.0 smtp.yourdomain.com... Sender ok

Now give the recipients address:
RCPT TO: username@smtp.yourdomain.com
Should yeild:
250 2.1.0 user@smtp.yourdomain.com... Recipient ok


To start composing the message issue the command DATA

If you want a subject for your email type Subject:-type subject here- then press enter twice (these are needed to conform to RFC 882)

You may now proceed to type the body of your message (e.g. hello username@ smtp.yourdomain.com from username@smtp.yourdomain.com)

To tell the mail server that you have completed the message enter a single "." on a line on it's own.
The mail server should reply with: 250 2.0.0 ???????? Message accepted for delivery

You can close the connection by issuing the QUIT command.
The mailserver should reply with something like:221 2.0.0 smtp.yourdomain.com closing connection
Connection closed by foreign host.



Thursday, July 23, 2009

HOW TO INSTALL AND CONFIGURE TRAC WITH APACHE AND SVN

# rpm -ivh http://apt.sw.be/packages/rpmforge-release/rpmforge-release-0.3.6-1.el4.rf.i386.rpm
# yum install httpd subversion mod_python mod_dav_svn
# yum --enablerepo=rpmforge install trac
Instantiating svn:

# mkdir /var/www/svn
# svnadmin create /var/www/svn/project
Initial svn import:

# mkdir -p /tmp/newsvn/{trunk,tags,branches}
# svn import /tmp/newsvn file:///var/www/svn/project -m "Initial import"
# chown -R apache /var/www/svn/project
# chmod -R go-rwx /var/www/svn/project
Instantiating trac:

# mkdir /var/www/trac
# trac-admin /var/www/trac/project initenv
# mkdir /var/www/{.python-eggs,passwd}
# htpasswd -c /var/www/passwd/.htpasswd
# touch /var/www/passwd/svnauthz
# chgrp -R apache /var/www/trac/project
# chown -R apache /var/www/trac/project/{attachments,db,log,plugins}
# chown -R apache /var/www/{.python-eggs,passwd}
# chmod -R o-rwx /var/www/{trac/project,.python-eggs,passwd}
# chmod g+w /var/www/trac/project/conf/trac.ini
Install trac plugins:

# wget http://peak.telecommunity.com/dist/ez_setup.py
# python ez_setup.py
# easy_install http://svn.edgewall.com/repos/trac/sandbox/webadmin/
# easy_install http://trac-hacks.org/svn/accountmanagerplugin/0.10
# easy_install http://trac-hacks.org/svn/svnauthzadminplugin/0.10
trac.ini conf setup:

[trac]
default_charset=UTF-8
authz_file = /var/www/passwd/svnauthz

[components]
acct_mgr.admin.accountmanageradminpage = enabled
acct_mgr.api.accountmanager = enabled
acct_mgr.htfile.htpasswdstore = enabled
acct_mgr.web_ui.accountmodule = enabled
acct_mgr.web_ui.loginmodule = enabled
trac.web.auth.loginmodule = disabled
webadmin.* = enabled
svnauthz.* = enabled

[account-manager]
password_file = /var/www/passwd/.htpasswd
password_store = HtPasswdStore
Apache trac conf setup:

Alias /trac /var/www/trac

SetHandler mod_python
PythonInterpreter main_interpreter
PythonHandler trac.web.modpython_frontend
PythonOption TracEnvParentDir /var/www/trac
PythonOption TracUriRoot /trac
SetEnv PYTHON_EGG_CACHE /var/www/.python-eggs

#
# AuthType Basic
# AuthName 'Trac Server'
# AuthUserFile /var/www/passwd/.htpasswd
# Require valid-user
#

Apache subversion conf setup:


DAV svn
SVNParentPath /var/www/svn

# Limit write permission to list of valid users.
#
# Require SSL connection for password protection.
# SSLRequireSSL

AuthType Basic
AuthName 'Authorization Realm'
# Trac .htpasswd file used so users will be the same for both
AuthUserFile /var/www/passwd/.htpasswd
Require valid-user
AuthzSVNAccessFile /var/www/passwd/svnauthz
#


Trac privileges:

# trac-admin /var/www/trac/project permission add admins TRAC_ADMIN
# trac-admin /var/www/trac/project permission add admins
# trac-admin /var/www/trac/projectname permission remove anonymous TICKET_CREATE TICKET_MODIFY etc...
# track-admin /var/www/trac/project permission add devs BROWSER_VIEW CHANGESET_VIEW FILE_VIEW LOG_VIEW \
MILESTONE_CREATE MILESTONE_VIEW REPORT_CREATE REPORT_MODIFY REPORT_SQL_VIEW REPORT_VIEW \
ROADMAP_VIEW SEARCH_VIEW TICKET_APPEND TICKET_CHGPROP TICKET_CREATE TICKET_MODIFY \
TICKET_VIEW TIMELINE_VIEW WIKI_CREATE WIKI_MODIFY WIKI_VIEW

Monday, July 6, 2009

Make Your Internet Connection Pay for Itself | Daily Cup of Tech

Make Your Internet Connection Pay for Itself | Daily Cup of Tech

Sunday, July 5, 2009

The Software-RAID HOWTO: RAID setup

The Software-RAID HOWTO: RAID setup

Software Raid | Raid Arrays | mdadm on Linux

Software Raid | Raid Arrays | mdadm on Linux

Quick HOWTO : Ch26 : Linux Software RAID - Linux Home Networking

Quick HOWTO : Ch26 : Linux Software RAID - Linux Home Networking

Setting up RAID - Linux StepByStep

Setting up RAID - Linux StepByStep: "Setting up software RAID"

Saturday, July 4, 2009

Howto Backup PostgreSQL Databases Server With pg_dump command

Howto Backup PostgreSQL Databases Server With pg_dump command

Howto Backup PostgreSQL Databases Server With pg_dump command
by LinuxTitli

Generally, I like to work with MySQL but some time my work force me to work with PostgreSQL database server.
Recently I had received a request to backup PostgreSQL databases as one of our client want to format and reinstall RHEL server.
PostgreSQL is a one of the robust, open source database server. Like MySQL database server, it provides utilities for creating a backup.
Step # 1: Login as a pgsql user
Type the following command:
$ su - pgsql
Get list of database(s) to backup:
$ psql -l
Step # 2: Make a backup using pg_dump
Backup database using pg_dump command. pg_dump is a utility for backing up a PostgreSQL database. It dumps only one database at a time. General syntax:
pg_dump databasename > outputfile
Task: dump a payroll database
Type the following command
$ pg_dump payroll > payroll.dump.outTo restore a payroll database:
$ psql -d payroll -f payroll.dump.outOR$ createdb payroll
$ psql payroll However, in real life you need to compress database:$ pg_dump payroll | gzip -c > payroll.dump.out.gzTo restore database use the following command:$ gunzip payroll.dump.out.gz
$ psql -d payroll -f payroll.dump.outHere is a shell script for same task:
#!/bin/bash
DIR=/backup/psql
[ ! $DIR ] && mkdir -p $DIR || :
LIST=$(psql -l | awk '{ print $1}' | grep -vE '^-|^List|^Name|template[0|1]')
for d in $LIST
do
pg_dump $d | gzip -c > $DIR/$d.out.gz
done
Another option is use to pg_dumpall command. As a name suggest it dumps (backs up) each database, and preserves cluster-wide data such as users and groups. You can use it as follows:$ pg_dumpall > all.dbs.outOR$ pg_dumpall | gzip -c > all.dbs.out.gzTo restore backup use the following command:
$ psql -f all.dbs.out postgresReferences:
• PostgreSQL documentation : Backup and Restore chapter