Month: June 2007

Single user mode – How to reset(bypass) root password without bootable CD

Single user mode – How to reset(bypass) root password without bootable CD

Introduction – In many systems, User has to enter root password to enter in to “single user mode“. On Ubuntu/Debian system, you have to enter root password while entering into single user mode.

What to do if you loss or forgot root password ?

method(1) Use bootable CD – This is the last options to reset root password on your system. Infact if you have set GRUB password and you have loss root as well as GRUB password then only you need to go for this method. Otherwise go with second method…

method(2) Single user mode and bypass root password – You can reset root password even if your system require root password to enter in to single user mode. GRUB will help you to bypass , and will not ask you for root password.

This is as simple editing the preferred boot line in your GRUB boot loader menu at boot time…

  • Reboot the system, and when you are at the selection prompt(GRUB menu), highlight the line for Linux and press ‘e’.
  • This will take you to another screen, where you should select the entry that begins with “kernel” and press “e” again….
  • Append "single" to the end of that line (without the quotes and give space)
  • If your system requires you to enter your root password to log into single-user mode, then append init=/bin/bash after “single“. Hit “Enter” to save the changes.
  • Press “b” to boot into Single User mode.
  • Once the system finishes booting, you will be logged in as root. Use passwd and choose a new password for root.
  • Type reboot to reboot the system, and you can login with the new password you just selected.

Original Line –

/vmlinuz-2.6.22-14-generic root=/dev/sda5 ro quiet splash

Modify as –

/vmlinuz-2.6.22-14-generic root=/dev/sda5 ro quiet splash single init=/bin/bash


Thank you,

Arun Bagul

PHP – Web 2.0 and the AJAX

PHP – Web 2.0 and the AJAX

Introduction –

Web 2.0 is a strange thing in that it doesn’t really exist. You can’t buy Web 2.0; you can’t buy a Web 2.0 programming language, and you can’t buy Web 2.0 hardware. In many ways, the phrase “Web 2.0” is a marketing phrase like “paradigm shift” or “the big picture“. The reason for this vagueness is that Web 2.0 doesn’t have a tightly defined definition. What the phrase Web 2.0 tries to express is, that modern websites are so much better than early websites that they’d better be given a different name. So it is down to marketing.

Web developers need to demonstrate that they may use the same Internet, the same web browsers and the same web servers as their competitors, yet their websites are in fact an order of magnitude better. Our competitors only do websites. We do Web 2.0 websites!

The client is, of course, hugely impressed that his new website will be a Web 2.0 website. But what should he expect to see for his money? What is the client’s view of what Web 2.0 should offer? Is it all smelling of roses or are there some thorny issues too?

I propose that there are in fact three facets to a Web 2.0 website:

1. AJAX

2. Social Networking (Building Communities)

3. Broadband

AJAX is technical and can only be performed by a technically skilled developer, social networking is vague, woolly and is based more on marketing models than web skills, and broadband has been popular for a long time. Even stranger is the fact that AJAX has been available to developers for at least 5 years, and social networking has been around even longer. It is simply the re-branding of these things that is causing the rise in the popularity of these old but current “buzzword” technologies.

AJAX is a mash up of technologies. We’ve had asynchronous JavaScript and XML for many years, but until somebody said “I name this mash up – AJAX it remained out of the mainstream. The same goes with social networking. Forums, blogs, and community-based websites have been around for many years, but giving it a title like “social networking” combined with the success of websites such as www.Youtube.com and www.Linkedin.com makes it mainstream and popular. And to cap it all, the new names invented to re-brand existing technologies are combined into the all encompassing name of Web 2.0(simply rebranding the rebranded).

In summary, we’ve had the ability to create Web 2.0 websites for years. It is not new technology; it is simply the renaming and repackaging of something we already have and enjoy. Marketing has made buzzwords of what we already knew and the public and developers are lapping it up.

The third facet of Web 2.0 was broadband, or as I prefer to call it, broadband abuse. Many developers believe that Web 2.0 is defined by how long it takes to download a website or the size of the broadband connection required to view the site comfortably. They believe that the bigger the connection required or the longer the website takes to download, the more Web 2.0ish the website must be. In my opinion, however, adding vast images, video footage, badly implemented rounded corners and streaming music does not make a Web 2.0 website. It simply makes a regular website that is bloated and annoying.

Presuming that you understand what makes a Web 2.0 website and you are keen to build one, there is an important area that you should consider before you start. And that is the area of Search Engine Optimization.

So what about search engines? Do Web 2.0 websites perform well on search engines? Do search engines need to change to keep pace with development? If we ignore the broadband abusers and look at the two key facets of Web 2.0, AJAX, and social networking we get two very different answers.

Working somewhat in reverse here, the conclusion is that AJAX is a search engine killer. Adding AJAX functionality to your website is like pulling the plug on your search engine strategy. Social networking sites on the other hand typically perform exceptionally well on search engines due to their vast amount of visitor provided content.

The reason AJAX is a search engine killer is pretty obvious once you know how the technology works, and at the risk of offending all the people who know this already, I’ll recap in a brief paragraph.

Simply put, AJAX removes the need to refresh a page in a browser. Say for example, you are on the product-finding page of a website, you can type in a search phrase for the product you want to find and press the submit button. Without refreshing the page, the asynchronous JavaScript runs off, grabs the results of the search, and inserts the details of the found products into the very same page as you sit and look at it.

For the website user this addition of AJAX to the website feels fantastic. No page reloads, no browser flicker, no click noise, but sheer joy. And so the rush for AJAX websites begins, because the visitors will love it.

But what about the search engines, what will they make of web pages that use AJAX to find content? Importantly, search engines don’t run JavaScript. Oh no, not ever, no way José. So the search engine will never run your AJAX. To the search engine, huge areas of your website content are now hidden, never to be spidered, indexed, or found. This really limits the usefulness of AJAX in many applications.

An ideal application of AJAX is Google Maps, where as you drag the map around the browser window, the newly exposed areas of the map are retrieved and shown on the page without a page refresh—smooth, seamless, and very impressive. Does Google care if the single map page gets found by searching? Certainly not!

A very poor application of AJAX is the product portfolio where you can find and view product details for hundreds of products without ever refreshing the page. Nice to use? Yes. Navigation friendly? No—try hitting the back button when the browser ignores your last 20 clicks because you have remained on the same page! Search engine friendly? Forget it. You are invisible.

So what is the solution to the AJAX invisibility cloak that Master Harry Potter himself would be proud of? There are 5 options –

  1. Build two websites, one using AJAX that is lovely for visitors and another using more traditional techniques for search engine spiders to find. If you can find a client to finance both, you have found a client with too much money!

  2. Drop AJAX. Let the visitors suffer the page refresh.

  3. Run with AJAX anyway and just put up with the fact that your perfectly formed website will receive no search engine visitors.

  4. Lobby the major search engines to rebuild their spidering algorithms to take into account AJAX pages and to run JavaScript on the pages they index. This option might take some time.

  5. Increase your Google Ad words payments and ramp up traditional advertising to counteract the missing website traffic from the search engines.

And so, a bleak picture of AJAX is painted and by implication of Web 2.0 as well. The good applications of AJAX and Web 2.0 are few and far between, but when you do find them they are fantastic. Do you remember that feeling when you fist used Google Maps? Do you find that all other mapping websites now feel old fashioned? I would go as far as to say that it was Google Maps that single-handedly bought the technology of AJAX to the masses.

The second most impressive application of AJAX is another Google idea, where when typing in the search field on the Google website, AJAX is used to find results even as you type the words—incredibly quick to use, fantastic for the website visitor, and really demonstrating the technology in a great light.

Isn’t it hugely ironic then that the one website that demonstrates so well the very technology that, if used on our own websites, will force us to spend more on Google Ad words, is in fact Google.

 

Thank you,

Santhosh T.

 

PHP – How to Filter/validate IP Address?

PHP – How to Filter/validate IP Address?

Introduction –

Many times, we need to validate an IP Address. Of course, and IP address may be of different formats for ipv4 and ipv6. An IP address may also need to be within a range of private or reserved ranges. The filter extension makes it possible to discern these differences and to validate an IP address to fit most needs. In its simplest form the validation of a URL will look like this….

// Valid IP address
$ip = “192.168.0.1”;

if(filter_var($ip, FILTER_VALIDATE_IP) === FALSE)
{
echo “$ip is not a valid IP”;
}
else
{
echo “$ip is valid”;
}
?>

As we have supplied the above with a valid IP address it validates and all is well. But now we may wish to validate an IPv6 address or an address with a private range. The IP Filter has several flag with which to validate an IP address with.

Flag are for IP Filter –

  • FILTER_FLAG_IPV4

  • FILTER_FLAG_IPV6

  • FILTER_FLAG_NO_PRIV_RANGE

  • FILTER_FLAG_NO_RES_RANGE

** Starting at the top we will check to see if an IP is a valid IPv4 address.

// Valid IP address
$ip = “192.168.0”;

// try to validate as IPV4 address
if(filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) === FALSE)
{
echo “$ip is not a valid IP”;
}
else
{
echo “$ip is valid”;
}
?>

In the above example the IP address has failed to validate as it is not a complete IPv4 address. It would need to be of the form of the example that preceded it, 192.168.0.1 to validate. This is fine, but growth of the net has seen us run out of IPv4 addresses and so we need to validate against IPv6 addresses also….

 

Thank you,

Santhosh Tirunahari

Script to check – Mail server IP addr is blacklisted or not?

Script to check – Mail server IP addr is blacklisted or not?

Introduction –

This shell script can be used to known whether the IP address of your mail server is black list or not…

Who can use this script ?

– System Admin, Mail Server admin or any one who want to find the IP address is black listed or not?

root@arunbagul:/home/arun/bash-prog# cat black_white_listing.sh
#!/bin/bash
echo “=========================================”
echo “Welcome to IndianGNU.org’s script to check the Blacklisting”

if [ $# -eq 0 ]; then
echo -n “Enter the IP Address of Mail Server: ”
#read the IP from cmd line
read IPAddr
else
IPAddr=$1
fi

#Reverse the IP…
ipaddr1=$(echo $IPAddr | awk -F. ‘{print $1}’)
ipaddr2=$(echo $IPAddr | awk -F. ‘{print $2}’)
ipaddr3=$(echo $IPAddr | awk -F. ‘{print $3}’)
ipaddr4=$(echo $IPAddr | awk -F. ‘{print $4}’)

##check the IP format here…

if [ “$ipaddr1” == “” ]; then
echo “Please enter the Valid IP address”
exit
elif [ “$ipaddr2” == “” ]; then
echo “Please enter the Valid IP address”
exit
elif [ “$ipaddr3” == “” ]; then
echo “Please enter the Valid IP address”
exit
elif [ “$ipaddr4” == “” ]; then
echo “Please enter the Valid IP address”
exit
fi

### create reverse IP
RevIP=”${ipaddr4}.${ipaddr3}.${ipaddr2}.${ipaddr1}”

echo “The IP (Reverse format):- ${RevIP}”

###################################
for check in {blocked.hilli.dk blacklist.sci.kun.nl,spamsources.dnsbl.info,map.spam-rbl.com \
mail-abuse.blacklist.jippg.org catchspam.com spam.blackhole.cantv.net blackholes.uceb.org dnsbl.solid.net}
do
#run cmd to check the IP black listed or not
dig ${RevIP}.$check >> /dev/null
if [ $? = 0 ]; then
echo “The ${IPAddr} IS White Listed”
else
echo “The ${IPAddr} IS Black Listed”
fi
done
#done
root@arunbagul:/home/arun/bash-prog#

How to use this script ?

root@arunbagul:/home/arun/bash-prog# ./black_white_listing.sh
=========================================
Welcome to IndianGNU.org’s script to check the Blacklisting
Enter the IP Address: 192.168.0.1
The IP (Reverse format):- 1.0.168.192
The 192.168.0.1 IS White Listed
The 192.168.0.1 IS White Listed
The 192.168.0.1 IS White Listed
The 192.168.0.1 IS White Listed
The 192.168.0.1 IS White Listed
The 192.168.0.1 IS White Listed
The 192.168.0.1 IS White Listed
The 192.168.0.1 IS White Listed
The 192.168.0.1 IS White Listed
root@arunbagul:/home/arun/bash-prog#

Thank you,

Arun Bagul