Monday, February 13, 2012

How to open a range of ports in windows


You have to run the following command from the command prompt.

To open TCP ports 7000 to 7777 naming each rule as 7000-7777-tcp-Port_num, run the following command
FOR /L %I IN (7000,1,7777) DO netsh firewall add portopening TCP %I "7000-7777-tcp"%I

To open UDP ports 7000 to 7777 naming each rule as 7000-7777-udp-Port_num, run the following command
FOR /L %I IN (7000,1,7777) DO netsh firewall add portopening UDP %I "7000-7777-udp"%I

Sunday, February 12, 2012

Extracting rar files in linux

In most Windows systems, there won't be any softwares to make .tar files. So you will be forced to create rar files using winrar or similar softwares. Still you can upload those file to linux machine and unpack them using unrar command. We will see how. We have to install a package named unrar in the linux system. Then it will provide the rar and unrar commands so that you can rar and unrar files.

For Debian or Ubuntu systems. :
# apt-get install unrar

For fedora Centos Redat systems :
# yum install unrar

For OpenBSD systems :
# pkg_add -v -r unrar

Or you can install it from source :

Download the package,
http://www.rarlab.com/rar/rarlinux-4.1.0.tar.gz
tar xvzf rarlinux-4.1.0.tar.gz
$ cd rar
$ ./unrar and ./rar

If you want you can copy these commands to /bin for easy access.
# cp rar unrar /bin

Usage:
#unrar e file_name.rar

Setting firewall using ufw

UFW is a firewall in Debian/Ubuntu Operating systems.

Enabling the firewall
root@suede:/# ufw enable

Firewall is active and enabled on system startup

Allowing ssh port :

root@suede:/# ufw allow 22/tcp
Rule added
root@suede:/# ufw allow 22/udp
Rule added

Listing the status :
root@suede:/# ufw status
Status: active
To                         Action      From
--                         ------      ----
22/tcp                     ALLOW       Anywhere
22/udp                     ALLOW       Anywhere
root@suede:/#

You can delete the rules as

root@suede:/# ufw delete allow 22
Rule deleted

You can also allow ports using name.

$ sudo ufw allow ssh
$ sudo ufw allow www
$ sudo ufw allow webmin