Is your firewall blocking connection from a host and still you want to unblock the IP address of the remote host? Here is one way of doing it:

1. Do a listing of firewall rules and grep the IP (eg. 1.2.3.4)
$ /sbin/iptables -L INPUT -n –line-numbers | grep 1.2.3.4

-write down the line number.
-If the chain name is different or user defined, replace “INPUT” by the relevant chain name such as OUTPUT.

2. Delete the line number (eg. for line number 99 and chain INPUT)

$/sbin/iptables -D INPUT 99

@credit to: http://www.cyberciti.biz/faq/iptables-delete-ip-address-subnet-from-linux-firewall/

It seems that the controversy surrounding the Google and Verizon proposal on managing Internet traffic has re-ignited the debate on Net Neutrality. The proposal claims to be in favor of open Internet, but with some exceptions like wireless services! It makes you wonder, isn’t wireless the future of the Internet? “GoRizon” have also suggested some on line services to be excluded from Net Neutrality principles, like health care monitoring, “advanced educational services, or new entertainment and gaming options.” With so much uncertainty as to which form of Internet traffic regulation would benefit society at large, it might help to brain storm on certain scenarios which could happen if we go ahead with one or other form of regulation.Sarah Kessler has compiled 7 such scenarios“Net Neutrality: 7 Worst Case Scenarios”.

Normally if you want to block all requests to and from an IP address, iptables is an ideal solution. A rule similar to this one would be handy

/sbin/iptables -A INPUT -s 1.2.3.4 -j DROP

What if you want to block that IP without using iptables, route command would do the job

 /sbin/route add -host 1.2.3.4 reject

-List files opened by a program listening on a certain port (lsof -i:port)
# lsof -i:3306

-Benchmark the performance of a webserver
#ab -n 100 -c 5 http://www.sample-mysite.com/test.php
Send 100 request with 5 concurrent connections.

-Search for a string/pattern in all subdirectories of the given path
# find /my/path -exec grep “hairy” {} /dev/null \;

Tips on changing file permissions in bulk.

First command – changes all files under the current directory to 700 file mode.

find . -type d -exec chmod 0700 {} \;

Second command – changes all directories under the current directory to 600 mode.

find . -type f -exec chmod 0600 {} \;

The ‘history’ commands does not display the exact date and time of the commands executed. It just shows a numeric id followed by  the command executed by the current user. Here is one way of putting a time stamp –

# export HISTTIMEFORMAT=’%F %T >> ‘

To make sure that it works every time you login or restart your machine, put it in $HOME/.bash_profile

Some times you might be able to execute very complex commands and write pages of shell scripts and yet find your-self in a clueless situation, like the seemingly mundane task of setting the data/time in your Linux box from the command line. Here are a couple of ways that might help –

1. Using /etc/localtime and /usr/share/zoneinfo

Create a link to the file in /usr/share/zoneinfo which contains the time zone you want to set your clock to.

#ln -s /usr/share/zoneinfo/America/New_York /etc/localtime

2. Edit /etc/sysconfig/clock

#vi /etc/sysconfig/clock

-set the “ZONE” variable to your region – like “US/Central”

3.  Export command

#Export TZ=America/New_York

4. Simply the date command

format-> #date MMDDhhmmYYYY

#date 070913312010

5. Hardware clock

#hwclock –set –date=”07/09/2010 13:19:55″

One of the things which makes Linux more appealing is the capability to send email from command line, without logging to a webmail account or configuring your mail client like Outlook express. While working on the command line, you can send an attachment too, but the problem with this is file attachments like pdf or jpg appear as garbled text to the receiver. The solution? Another cool opensource software: uuencode. Download uuencode from this site for ubuntu: http://packages.ubuntu.com/dapper/i386/sharutils/download.

Usage: Suppose you want to send a pdf file(‘climatechange.pdf’) to a recipient address mrxyz@hisdomain.com. Then type the following command:

$uuencode climatechange.pdf climatechange.pdf | mails -s “climate change document” mrxyz@hisdomain.com

The pdf document wil appear as an attachment on the recipients side. Read More

Net Neutrality wars…”If cable and the Bells can’t negotiate special deals, neither can Google.” opponents of Net neutrality.

Are all  packets created equal? It is more like asking is the Internet neutral by design? The answer is no. It seems to favor text than voice, for instance. The more you hear this debate on Net neutrality, it is easy to realize that it is a battle between two giants – Cable companies(especially AT&T, Comcast) and Content providers (particularly Google). After the Federal Courts decided unanimously that the FCC doesn’t have the authority to tell Comcast on how to manage its network, the FCC has been trying hard to find a legal loophole which gives it the authority to regulate the Internet. Many proponents suggested the FCC reclassify the broadband Internet into the telecommunications services rather than the previous Information services, which is outside FCC’s regulatory authority. But the FCC seems to have decided to take a ‘third way’ without reclassifying broadband Internet. Time will decide whether this new path will be challenged in courts too.

What makes Net neutrality interesting is it is a partisan issue, the Democrats are pushing the FCC to take whatever means available to it legally to preserve the openness of the Internet, while the Republicans, on the other hand are threatening it with ‘see you in court’ remarks. But here is an addition to the debate, a claim made by a Republican representative – if the Cable companies are not allowed to make deals with their clients for a preferential treatment of their traffic based on price, then the Content providers(read as Google) should not be allowed to discriminate among content…like Google’s ranking of search results (that is not neutral ;)).  Read more.