Sunday 17 June 2012

Elastic Fox for managing amazon aws instances

1. Install the elasticfox plugin from the below link

http://www.eaglegenomics.com/2011/05/elasticfox-aws-ec2-add-on-for-firefox-4-with-t1-micro-instance-support/

2. And go to tools in firefox and select "ElasticFox"

3. Give the credentials it ask for

4. Go to "Security Credentials" and download
 
   AWS access key :-
   AWS Secret Access Key :-

 and add those keys in elasticfox interface and click "Add" then "Close"

5. Restart the Firefox and take Elastic Fox

6. You can get your running instances details from elasticfox

7. Almost all options are available here almost same as ASW
   interface, but AWS interface get most updated version

8. We can start / stop instance



Saturday 16 June 2012

Linux File Sharing Using python

Using python for file sharing in linux

# cd /dir/want/to/share
 
# python -m SimpleHTTPServer

and in browser http://192.168.1.183:8000

Linux File Sharing Using Twistd

To share your directory with others on your network or even on the internet, you can use the twisted tool to share your folders.

Twisted is a python based tool, you need rpms like python-twisted-core, pyOpenSSL, python-zope-interface to install the too.

You can make use of the RPMforge rpm repo on yum to install the tool on your server or destop easily.

Sharing your folder on the web

# yum install python-twisted-core
 
# yum install python-twisted-web

$ twistd web --path /home/ -p 8081 &

Then go to browser and run
  http://192.168.1.183:8081/

To kill or end the twistd, use.

# killall -9 twistd

The above will start a web server on port 8081 sharing your /home directory. You can use http://<server-ip>:8081 to get the full list of /home directory on your web browser.

Sharing your folder on FTP

Similar to HTTP you can also use ftp protocol to start sharing. Just execute.

# twistd -n ftp -r /home/ &

This will start the ftp service on the default port 2121, you can use your ftp client on port 2121 to connect with your server.

yafc an ftp client for file transfer

Yet Another FTP Client is a console mode FTP client. It has support for Kerberos authentication and sftp. Other features include tab completion, directory cache, aliases and bookmarks with autologin, and recursive file commands.

$ sudo apt-get install yafc
 
$ yafc


File transfer using ncftp

NcFTP is a UNIX application program implementing the File Transfer Protocol (FTP).

$ sudo apt-get install ncftp
 
# ncftp

gftp download

GFTP is a free multithreaded ftp client for *NIX based machines running X11R6 or later.

  # sudo apt-get install gftp
 
 # gftp

Fast downloading using lftp

Multiple protocol support (FTP, HTTP, FISH, SFTP, HTTPS and FTPS protocols).
      Scheduling downloads from command prompt.
      Easy Mirroring.
      Uploading and downloading directories.
      Assigning separate slots for multiple ftp sites.
      Queues the process/downloads.
      Bookmarking the download pages.

# cd /usr/src
# wget http://ftp.yars.free.net/pub/source/lftp/lftp-4.1.3.tar.gz
# tar zxvf lftp-4.1.3.tar.gz
# cd lftp-4.1.3
# ./configure && make && make install

OR 
# rpm -ivh http://pkgs.repoforge.org/lftp/lftp-4.3.5-1.el6.rfx.i686.rpm

# lftp -u username,password ftp.yourdomainname.com

# lftp ftp.kernel.org

All the lsftp command history use to store in ~/.lftp/cwd_history just run ‘ history ‘ from the lftp shell to recall your command history.
  # lftp
  lftp :~> history

You can also schedule the downloads using the at command.

FTP and HTTP protocols support.
Job queueing.
Job execution at specified time.
Transfer status includes rate and ETA.
`mirror' can download several files in parallel (--parallel option).
`pget' to download a file using several connections.

# lftp -u username,password -e "cd htmldir" www.domainname.com

kget Download tool

KGET is a a download manager similar to GetRight or Go!zilla. It keeps all your downloads in one dialog and you can add and remove transfers. Transfers can be paused, resumed, queued or scheduled. Dialogs display info about status of transfers - progress, size, speed and remaining time. Program supports drag & drop from KDE applications and Netscape.

 # sudo aptitude install kget



Dowinload using aria2 / Aria

Aria2 is a command line download client with resuming and segmented downloading. Supported protocols are HTTP/HTTPS/FTP/BitTorrent and it also supports Metalink.
 
# sudo aptitude install aria2

# sudo aptitude install aria




Monday 11 June 2012

Downloading using prozilla - with GUI frontend

One of the drawback of axel is you can not specify ftp username and password. You can use prozilla program, which also makes multiple connections and downloads a file in multiple parts simultaneously thus enhancing the download speed and dwnloading the file faster than a download with a single connection.
 
 FTP passwords can be specified with the URL, or can be obtained automatically from ~/.netrc if it exists.

 # yum install prozilla

 $ sudo apt-get install prozilla

OR

# rpm -ivh prozilla-2.0.4-19.1.i386.rpm

# proz http://kernel.org/pub/linux/kernel/v2.6/linux-2.6.17.11.tar.bz2


Download using Axel from commandline

Axel is a command-line downloader for unix-like operating systems. Unlike wget, axel includes download acceleration, whicThis program tries to accelerate the downloading process by using multiple connections for one file.

# sudo apt-get install axel

# yum install axel

You can also specify a speed (bytes per sec) for axel so that it will not eat up all your bandwidth.

$ axel -s 5242880 http://download.com/my.iso

  Limit a number of connection
You can also specify number of connection you want to open. For example open 3 connections for downloading:

$ axel -n 3 -s 5242880 http://download.com/my.iso

# axel -n40 http://mirror.neu.edu.cn/centos/5.7/isos/i386/CentOS-5.7-i386-bin-1of8.iso


Packet Download using Aget

Aget is a multithreaded HTTP download accelerator which is very similar to the windows Flashget tool but only works over the HTTP protocol and does not works on FTP protocol. Tested proven that aget almost reduced the download time by 50% which comparing to the other standard tools like wget, ftp, lynx etc.

  #  wget http://www.enderunix.org/aget/aget-0.4.1.tar.gz
  # make  && make strip
  # make install
 
 $ aget -n10 http://www.enderunix.org/murat/barismanco-hibrahimsofrasi.mp3

OR

# rpm -ivh aget-0.4-sb1.i386.rpm

# aget -n10 http://mirrors.ispros.com.bd/downloadfile.iso

Downloading using gwget

Gwget offers a GNOME front-end to the popular wget application, with enhanced features, such as systray icon, multiple downloads and a powerful preferences manager.

$ sudo apt-get install gwget

# gwget -t -d /home/tech/Downloads/ http://205.196.120.227/zkewcba6n7ng/ew5rvyks171vax3/01+Appangalembadum+-+Usthad+Hotel.mp3


How to monitor active MySQL connections(ajaxmytop)

AjaxMyTop shows active MySQL connections. You get a data grid showing connections, each showing ID, user, duration, and so on. 

 AjaxMyTop currently requires PHP5 and it may not work properly with php 4.x versions. Get it to the exact web root directory which you want to run ajaxMyTop. In my case it is /var/www/html/

# cd /var/www/html

# wget http://downloads.sourceforge.net/project/ajaxmytop/ajaxmytop/ajaxMyTop-0.7.2/ajaxMyTop-0.7.2.tar.gz

 # tar zxvf ajaxMyTop-0.7.2.tar.gz

 # mv ajaxMyTop mytop# cd mytop

Configuring AjaxMyTop

You can configure ajaxMyTop by editing the config.php file. MySQL: It is highly recommended that you create a new user for ajaxMyTop with the SUPER and PROCESS privileges rather than configure ajaxMyTop with an admin user, or continue with the default details.

mysql> GRANT SUPER, PROCESS ON *.* to ‘ajaxmytop’@'localhost’ identified by ‘ajaxmytop’;

 mysql> GRANT SUPER, PROCESS ON *.* to ‘ajaxmytop’@'%’ identified by ‘ajaxmytop’;

Apparently you must also grant the SELECT privilege to the ajaxmytop user for all databases in which you may want to explain threads.

mysql> GRANT USAGE, SELECT ON test.* to ‘ajaxmytop’@'localhost’ identified by ‘ajaxmytop’;

mysql> GRANT USAGE, SELECT ON test.* to ‘ajaxmytop’@'%’ identified by ‘ajaxmytop’;

Edit the config.php and enter the user-name and password setting which you have setup. Access it via your server ip or domain based on your installation location.

http://192.168.1.67/mytop/
 
Make sure you have .htaccess folder permission enabled on the mytop folder or else everyone can access and view your mysql query usages etc.

Monitoring tcp connections using Tcptrack

Install Tcptrack to monitor TCP connections. Tcptrack is an excellent tool to monitor your server network connections and bandwidth quickly, installation is pretty easy and can be done either via rpm or source.

# cd /usr/src/

# wget http://packages.sw.be/tcptrack/tcptrack-1.1.5-1.2.el5.rf.i386.rpm

# rpm -ivh tcptrack-1.1.5-1.2.el5.rf.i386.rpm

 OR

 # tar zxvf tcptrack-1.3.0.tar.gz

 # cd tcptrack-1.3.0

 # ./configure ; make & make install

 tcptrack -h
 
 TCPtrack can monitor only one nic at once with only one parameter to run (if you have two nic ie.. eth0 & eth1 )

    # tcptrack -i eth0
   # tcptrack -i eth1

 
The following example will only show connections from host 68.36.45.78:

    # tcptrack -i eth0 src or dst 68.36.45.78

To monitor the specific ports (ie..port 80 and 22):

    # tcptrack -i eth0 port 80
   # tcptrack -i eth0 port 22



Network bandwidth monitoring bmon

bmon is a portable bandwidth monitor and rate estimator running on various operating systems.

# sudo apt-get install bmon

# bmon


Bandwidth monitoring using bwm-ng

small and simple console-based bandwidth monitor.Bandwidth Monitor NG is a small and simple console-based live bandwidth monitor. 

# sudo apt-get install bwm-ng

# bwm-ng

OR

# cd /usr/src      

# wget http://www.gropp.org/bwm-ng/bwm-ng-0.6.tar.gz

# tar zxvf bwm-ng-0.6.tar.gz

# cd bwm-ng-0.6

# ./configure && make && make install

Type bwm-ng -h and make sure you are able to see the command help menu.
* Network Monitoring using bwm-ng....
  # bwm-ng -u bits -d
  # bwm-ng -u bytes -d 

Options to see all the NIC status in bits and bytes and -d is for dynamic output which displays in the KB/s and MB/s dynamically.
 
 * Disk I/O monitoring using bwn-ng
    Monitoring disk I/O is pretty simple with bwn-ng

  # bwm-ng -u bytes  -i disk

Monitoring bandwidth using iftop

iftop does for network usage what top does for CPU usage. It listens to network traffic on a named interface and displays a table of current bandwidth usage by pairs of hosts.

# iftop

Bandwidth Monitoring using cbm

the Color Bandwidth Meter — displays the current traffic on all network devices.

# sudo apt-get install cbm

$ cbm

Network monitoring using tcptrack

tcptrack is a sniffer which displays information about TCP connections it sees on a network interface. It passively watches for connections on the network interface, keeps track of their state and displays a list of connections in a manner similar to the unix ‘top’ command. It displays source and destination addresses and ports, connection state, idle time, and bandwidth usage.

# sudo apt-get install tcptrack

# tcptrack -i eth0

# tcptrack -i eth0 port 80


How to add a new user in ubuntu


# sudo useradd -d /home/scott -m scott

Changing default shell in ubuntu

2. Use chsh command
a) type chsh

    $ chsh

b) You will be asked for password. Enter your password
c) This screen will appear

    Enter the new value, or press ENTER for the default
    Login Shell [/bin/sh]:

d) Put /bin/bash at the menu and press Enter.