Friday, September 7, 2007

HTOP - interactive process viewer alternative

HTOP

This is HTOP, an interactive process viewer for Linux. It is a text-mode application (for console or X terminals) and requires ncurses. Tested with Linux 2.4 and 2.6. HTOP process viewer is not designed to replace the current well used linux 'top' command, but htop is an alternative with newly added and enhanced features that might be useful to other users too.

Htop operates interactively, using keyboard keys, arrows, and mouse driven operations. Htop also comes with its own progress meter that moves back and forth based on current values taken from CPU, memory and swap statistics. Htop process viewer views linux process and threads the same way like top command does, however, htop displays them in a faster way and much more interfactively compared to well known top command.

Since HTOP process viewer is text-based user-friendly interface. Tasks related to process killing, renicing can be done directly using keyboard arrow keys and mouse controls, as the PIDs can be selected by mouse or keyboard function keys and arrows without any further need for specifying PID numbers,

Cool HTOP, works nice and alternatively easy.


Comparison between HTOP and TOP:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

* In 'htop' you can scroll the list vertically and horizontally to see all processes and complete command lines.
* In 'top' you are subject to a delay for each unassigned key you press (especially annoying when multi-key escape sequences are triggered by accident).
* 'htop' starts faster ('top' seems to collect data for a while before displaying anything).
* In 'htop' you don't need to type the process number to kill a process, in 'top' you do.
* In 'htop' you don't need to type the process number or the priority value to renice a process, in 'top' you do.
* 'htop' supports mouse operation, 'top' doesn't
* 'top' is older, hence, more used and tested.



HTOP INSTALLATION
=================

HTOP process viewer can be installed in a flash, simply by issuing

# yum -y install htop


BINARY EXECUTION
================

# htop


HTOP INTERACTIVE COMMAND SHORTCUTS
==================================

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Space - Tag": mark a process. Commands that can operate on multiple processes, like "kill", will then apply over the list of tagged processes, instead of the currently highlighted one.

U "Untag" all processes (remove all tags added with the Space key).

s Trace process system calls: if strace(1) is installed, pressing this key will attach it to the currently selected process, presenting a live update of system calls issued by the process.

F1, h Help screen

F2, S Setup screen. There you can configure meters displayed on the top side of the screen, as well as set various display options,choose among color schemes and select the layout of the displayed columns.

F3, / Incremental process search: type in part of a process command line and the selection highlight will be moved to it. While insearch mode, pressing this key will cycle through matching occurrences.

F4, I Invert sort order: if sort order is increasing, switch to decreasing, and vice-versa.

F5, t Tree view: organize processes by parenthood, and layout the relations between them as a tree. Toggling the key will switch between tree and your previously selected sort view. Selecting a sort view will exit tree view.

F6, > Select field for sorting. The sort field is indicated by a highlight in the header.

F7, ], -
F8, [, + Decrease selected process priority (add to ’nice’ value)

F9, k "Kill" process: sends a signal which is selected in a menu, to one or a group of processes. If processes were tagged, sends the signal to all tagged processes. If none is tagged, sends to the currently selected process.

F10, q Quit

u Show only processes owned by a specified user.

M Sort by memory usage (top compatibility key).

P Sort by processor usage (top compatibility key).

T Sort by time (top compatibility key).

F "Follow" process: if the sort order causes the currently selected process to move in the list, make the selection bar follow it.
This is useful for monitoring a process: this way, you can keep a process always visible on screen. When a movement key is used, follow" loses effect.

K Hide kernel threads: prevent the threads belonging the kernel to be displayed in the process list. (This is a toggle key.)

H Hide user threads: on systems that represent them differently than ordinary processes (such as recent NPTL-based systems), this can hide threads from userspace processes in the process list. (This is a toggle key.)

Ctrl-L Refresh: redraw screen and recalculate values.

Numbers PID search: type in process ID and the selection highlight will be moved to it.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



HTOP web screenshot:

My HTOP screenshot in action:


HTOP FAQs can be seen here.

For more, man htop

HTH

Caching DNS server install howto

BIND DNS are nameservers responsible basically for resolving domain names or hostnames into their equivalent IP addresses. Websites or domain names have their own equivalent IP addresses that are usually managed and provided by the same website firms. If somebody is browsing a website from his browser, this website is being resolved, looked up and converted to its equivalent IP address by the DNS nameservers from your box or from your provider.

To achieve a faster resolving of domains, local dns cache or a caching nameserver can be created and installed right from your linux boxes. Once a domain has been cached, the next request for the same domain would be lookup and resolved locally and not from the provider anymore. Thus, this approach makes browsing more faster. resolves hostnames and websites relatively at a faster rate.

If you are using dialup connection from your linux box, or your desktop is a gateway from a number of hosts inside your area, or you just want to achieve a faster DNS resolving, you might as well consider creating a caching nameserver or caching DNS server locally from your box.

Here is an entry on how to create a Caching DNS server in Fedora.


The caching-nameserver package includes the configuration files which will make the ISC BIND named DNS name server act as a simple caching nameserver. A caching nameserver is a DNS Resolver, as defined in RFC 1035, section 7. ISC BIND named(8) provides a very efficient, flexible and robust resolver as well as a server of authoritative DNS data - many users use this package along with BIND to implement their primary system DNS resolver service. If you would like to set up a caching name server, you'll need to install bind, bind-libs, and bind-utils along with this package.



CACHING NAMESERVER INSTALLATION:
================================

The installation is quite easy. The DNS caching nameserver is available both from distro DVD or CD and from yum repo. To install caching nameserver from the internet using yum, you can simply issue the next command like so:

# yum -y install caching-nameserver

This command installs the caching only nameserver.


CACHING NAMESERVER SERVICE
==========================

To start your caching nameserver, simply issue

# service named start


# service named status



Caching nameserver uses default config file stored in /etc/named.caching-nameserver.conf by default. For chrooted caching nameserver, the config file is usually located in /var/named/chroot/etc/named.caching-nameserver.conf. Further configuration of this file is required to allow other host on using the caching DNS server.

Below is the default caching nameserver config file under F7
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
options {
listen-on port 53 { 127.0.0.1; };
directory "/var/named";
dump-file "/var/named/data/cache_dump.db";
statistics-file "/var/named/data/named_stats.txt";
memstatistics-file "/var/named/data/named_mem_stats.txt";
allow-query { localhost; 83.229.64.3; 192.168.200.1; 192.168.200.0/24; };
};
logging {
channel default_debug {
file "data/named.run";
severity dynamic;
};
};
view localhost_resolver {
match-clients { localhost; };
match-destinations { localhost; };
recursion yes;
include "/etc/named.rfc1912.zones";
};
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


You can alter this file if needed so.

Let us say, we want to grant DNS caching request to a host from your network with an IP 192.168.1.254, simply append it
from this line

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
allow-query { localhost; };
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

like so
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
allow-query { localhost; 192.168.1.254; };
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

You can specify multiple hosts or group of IP address like so

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
allow-query { localhost; 192.168.1.254; 192.168.1/26; 192.168.2/27; 192.168.3/24; };
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

that allows everybody from your network that starts with an IP address 192.168.1.X .


To bind caching nameserver on multiple ethernet interface or IP address
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
listen-on port 53 { 127.0.0.1; 192.168.1.1; 192.168.2.1; 192.168.3.1; 192.168.4.1; };
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Just make sure these IP adresses do exist from your caching nameserver host.


Group access list can also be created from caching nameserver. This makes use of caching nameserver word ACL as shown below

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
acl my-networks { localhost; 192.168.1.254; 192.168.1/26; 192.168.2/27; 192.168.3/24; };
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

and referring to them from the line

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
allow-query { my-networks; };
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

If you wish to disable IPv6 caching nameserver, simply comment the line like so

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// listen-on-v6 port 53 { ::1; };
// query-source-v6 port 53
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Additionally, from your caching nameserver, you may want to edit your /etc/resolv.conf and add your new caching nameserver IP address from there like so

# cat /etc/resolv.conf
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
nameserver 192.168.1.1
nameserver your-ISP-provider-DNS-IP
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Optionally, you are allowed to use more than two nameserver IP address. You can also add the LIVE or public IP address of your caching nameserver as well.


DEFAULT VALUES
~~~~~~~~~~~~~~

The default caching nameserver has several default arguments, as shown below
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
query-source address * port 53;
directory "/var/named";
statistics-file "named.stats";

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Legend:
* binds caching server on all current interface
port 53 binds caching server on port 53
directory define the default working folder
statistics-file define where all DNS statistics would be written to


CACHING NAMESERVER LOG FILE
~~~~~~~~~~~~~~~~~~~~~~~~~~~

To monitor DNS caching server, simply use tail

# tailf /var/log/messages


NAMESERVER SERVICE RESTART
~~~~~~~~~~~~~~~~~~~~~~~~~~

# service named restart

Remember to put them permanently, so caching nameserver starts up between reboot like so

# chkconfig --levels 35 named on


CACHING NAMESERVER TEST
~~~~~~~~~~~~~~~~~~~~~~~

To check if your caching nameserver is currently running

# service named status
# netstat -panut | grep named
# ss -l |
grep domain


From the caching nameserver, simply try to resolve a domain like so

# nslookup google.com localhost

should give your resolved hostnames of google.com using the local interface of your caching nameserver.


Alternatively, using another private IP address as shown with the above IP examples

# nslookup google.com 192.168.1.1


That is all for now.

BitTorrent - downloading large files made easy

Want to download Harry Potter The Order of the Phoenix the movie in Linux desktop?

Linux is free, Harry Potter The Order of the Phoenix movie is free as well?

Suffering from slow internet dialup connection on downloading large DVD movie or ISO files?

Movie files corrupted due to disconnection problems on internet connections?

Worry not, BitTorrent is here to the rescue!

BitTorrent, an extremely handy tool on downloading large torrent files regardless of internet speed rate you have with interruption between connection breakups.

There are linux desktop users who might have fast internet connections, but connection breakups happens in the middle of nowhere, most probable tendency is that the file being downloaded is now useless and corrupted. No time for redownloading restarts? Bittorrent makes downloading large files easier and without interruption headaches.

BitTorrent is a tool for distributing files. It's extremely easy to use - downloads are started by clicking on hyperlinks. Whenever more than one person is downloading at once they send pieces of the file(s) to each other, thus relieving the central server's bandwidth burden. Even with many simultaneous downloads, the upload burden on the central server remains quite small, since each new downloader introduces new upload capacity.

With the genuine BitTorrent client, you get:

* Dynamic bandwidth management -- download without disrupting other applications
* Detailed stats let you monitor the health of your downloads
* No hardware configuration - reduced hassle of fast downloads



BITTORRENT INSTALLATON
======================

With yum around, bittorrent makes RPM-based binary installation easy and seamlessly. Bittorrent can be installed by yum like so:

# yum -y install bittorrent-gui bittorrent

Alternatively, bittorrent RPM installer file can be downloaded from this site.


BINARY LAUNCH:
--------------

Ctrl+F2, bittorrent

Bittorrent has been around serving happily Linux desktop GUI users as well. I find this useful on Linux desktop clients sufferring from downloading large files on slow internet connections. The GUI interface is very simple even grandma is able to keep up with it. Any downloading interruptions are handled very well without affecting data CRC and file integrity during internet connection breakups.

If you are have more Bittorrent issues, a well written DOCS and FAQs is around for a nifty guide, which can be found here.


BitTorrent in action web screenshot:

Sample BitTorrent GUI interface:


So what are you waiting for?

Fire up your BitTorrent, and get Harry Potter The Order of the Phoenix Movie for free. Simply copy and paste the bittorrent file from here into your BitTorrent URL, and you're good to go!

Thursday, September 6, 2007

PHPAlbum - web photo album install howto

PHPAlbum is an easy to install and run photo album and gallery script. It doesn't require a database and features automatic installation on an FTP server with just a few clicks. It generates thumbnails and resized photos and supports password directory protection, access logs, short and longer description of directories and photos, and an admin section for creating new directories, uploading photos, and deleting them. HTML layout is separated from the functional code, and two themes are available.

PHPAlbum is ofcourse powered by PHP source codes. The current version installs smoothly manually or via live FTP installation as I have tested from one of my box around here.

These are the features which PHPAlbum offers you:

* Automatic generation of thumbnails and resized
* Commenting of pictures with antispam security code
* NEW! IPTC Support, import of keywords and picture description, showing other IPTC-tags
* NEW! E-Card - you can now send e-cards to your friends and family
* Screenshots for files to be downloaded, movie, audio, exe or whatever
* Password protection for your private galleries
* Admin section for creating new directories, uploading photos (works even with PHP safe_mode=on),Uploading ZIP Files preserving directory structure
* Short and long description of galleries/directories and photos
* Highly customizable layout, separated layout(HTML) from functional code, this allows easy creation of new themes
* Caching of all generated thumbnails and resized photos
* Transparent logo and icon processing with any background color, including IE6
* Access logging, with exclude strings
* And last but not least, you can help us with your suggestions to create usable, easy to install, php photo album script.

PHPALBUM INSTALLATION
==============

You can do the installation from web or locally from your box. If you wish to manually download the installation file here with phpAlbum_v0.4.1.14_fix01.zip as its current filename. But if you wish to install the file online, you can start by pointing your browser here.

PHPAlbum Manual Installation
----------------------------

Assuming you have downloaded the installation zip file phpAlbum_v0.4.1.14_fix01.zip , you start unzipping the files like so

# unzip phpAlbum_v0.4.1.14_fix01.zip

This would create a folder named phpAlbum_v0.4.1.14 and extract all PHPAlbum files into the said folder. If you wish to rename this folder, you may do so. Assuming we want to view the page from your http://domain.com/album, simply do so

# mv phpAlbum_v0.4.1.14 /var/www/html/album

Remember to start your apache service at this point.

# service httpd start

And point your browser on that page location. You will find the next instructions from there, it is so fairly easy.

EDITED as per request:
Simply,

Move the default PHPAlbum config file like so

# mv config_change_it.php config.php

And edit the file config.php, change the line from

$data_dir="data/";

to

$data_dir="data_something/";

and save. Follwed by creating the specified data folder from PHPAlbum root folder location like so

# mkdir /var/www/html/album/
# chmod 777 /var/www/html/album/


and browse PHPAlbum page. You may see a page like that you are not allowed to view the page.
Login and user the below default user credentials:

username: admin
password: admin

and you're in! Click on Setup link, and remember to change the default admin password. All the setup configurations are all there to manage.

After uploading images into your folder location, and you are still seeing some empty images from PHPAlbum site, you need to install a required PHP image library, which is available from Fedora repos like so

# yum -y install php-gd

and that's it, simple and easy web photo album and management.

Besides from easy installation, another good sides about the web photo album is you can create albums instantly, view images on three size (small, medium, large), auto-scans folders of images, allows access restrictions for particualar users and for several access privilege. All images are stored as flat files from folders. All frames, display of columns, comments moderation are all configurable from admin page.

Different image sizes are shown below:




If you wish to create a new album using admin user, simply create the folder and uploaded all files into that foler, phpalbum can scan the folder on schedules interval. This photo album also makes use of apache caching, so images loads faster than normal viewing rate.

Further FAQS and documentation can be read here and oh, install link from here.

Take a look at my screenshot:

Website screenshot:


Grab the PHPAlbum installer now, it's yummy free!

MRTG graph creation with Cisco routers

MRTG graph creation routers and devices
=======================================

From my recent blog entry of MRTG install howtos, which can be found here. Here is another entry to cover several steps on creating MRTG graph against Cisco router's ethernet and serial interfaces.

This blog entry assumes that your routers support SNMP or SNMP-enabled by configuration setup. The steps that will be taken here works perfectly with all the cisco routers currently scatterred around me. This blog entry hopes that the steps that would be covered here would also work with your non-cisco routers too. Assumming here also that this MRTG package is currently installed
from your box as well. If not, just follow the recent entry posted here.

Here is how to create and generate graph for Cisco interfaces.

Simply issue

# cfgmaker community@cisco-router-ip-address

# cfgmaker public@123.123.123.123 --output=cisco.cfg

The above command creates MRTG config file cisco.cfg and polls Cisco router's IP 123.123.123.123 for SNMP-enabled interface. The above command uses a default IPv4 polling with no special MRTG parameters and special output file format specified. Similarly, this MRTG command should work just fine with different distros.

Detail steps on enabling your router to support SNMP and configure them to have read-only community type would not be covered here. For security reasons, make sure your community name is a read-only community type.

Now an exact command that would do same function but with filters to remove all lines that starts with # character (commented lines) and all empty lines using grep would be like so

# cfgmaker public@123.123.123.123 | grep -v '#\|^$' > cisco.cfg

Similar output would be like so
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Target[123.123.123.123_1]: 1:public@123.123.123.123:
SetEnv[123.123.123.123_1]: MRTG_INT_IP="123.123.123.12393"
MRTG_INT_DESCR="FastEthernet0/0"
MaxBytes[123.123.123.123_1]: 12500000
Title[123.123.123.123_1]: Traffic Analysis for 1 -- core_link2
ifName:
Fa0/0
Max Speed:
12.5 MBytes/s
Ip:
123.123.123.12393 ()
Target[123.123.123.123_2]: 2:public@123.123.123.123:
SetEnv[123.123.123.123_2]: MRTG_INT_IP="123.123.123.123"
MRTG_INT_DESCR="FastEthernet0/1"
MaxBytes[123.123.123.123_2]: 12500000
Title[123.123.123.123_2]: Traffic Analysis for 2 -- core_link2
PageTop[123.123.123.123_2]: Traffic Analysis for 2 -- core_link2
...
snipped
...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The above command would simply display SNMP polling resulting lines from the polled cisco router. If ethernet and and serial interfaces exist from the SNMP-enabled cisco routers, MRTG should give the resulting MRTG config lines.

Now, the next thing to do is to create MRTG index.html page using MRTG indexmaker binary tool. If you have an existing MRTG index.html file, you can simply copy and paste the needed portion of this new index.html file our output the file on a different file name like so

# indexmaker cisco.cfg --output=device.html

The file device.html is the equivalent browseable MRTG page for cisco.cfg.

It is done. The command is also basic to other devices that needs to be polled.

Most opensourced and linux packages are simple and handy.

MRTG is so nice creating highly configurable MRTG usage graphs, that so far it also works great with these boxes, as I expected, with Cisco 16xx, 17xx, 26xx, 36xx, 50xx, AS53xx, MC38xx routers, Cisco 26xx/16xx switches, Cisco PIX 50X firewalls, Cisco Content Engine box, Cisco ATA boxes, SkyStream DVB 16xx/55xx routers, Huwei Quidway 16xx routers, Planet wireless boxes, Senao wireless boxes, DLink/LinkSys wireless routers/switches, IDirect modem routers, SysMaster boxes, NetEnforcer Allot AC-20X/40X boxes, Packeteer box, HP/Compaq/Dell Gigabit ethernet interfaces, VYYO wireless modems, IP Planets, and even Quintum PABX box too! Most probably, it should work out fine with other boxes too.

Do let me know if MRTG did not work properly with these boxes from your side. I hope MRTG works with these black rounded boxes around too.

All products and other commercial boxes mentioned here are all propriety trademarks and products managed by their own companies. They were mentioned here for my own personal MRTG reference alone and does not guarantee MRTG would work perfectly with the others. You may need to check their own site for proper and more detailed SNMP documentation of their own respective boxes.

See sample screenshots

Wednesday, September 5, 2007

Tree view of directories and file listings from command line

A detailed run down of one command mentioned from one linux tips link posted here, was the linux command tree.

Man says:
Tree is a recursive directory listing program that produces a depth indented listing of files. Color is supported ala dircolors if the LS_COLORS environment variable is set, output is to a tty, and the -C flag is used. With no arguments, tree lists the files in the current directory. When directory arguments are given, tree lists all the files and/or directories found in the given directories each in turn. Upon completion of listing all files/directories found, tree returns the total number of files and/or directories listed.


This is a handy little utility to display tree view of directories. An overview of how files and directories are expanded and traversed can be misleading and confusing when we are referring to thousand of files and folders. Tree comes as a handy tool to peruse those deep directory tree structures and files, especially when someone is trying to hide something from you.

With my fresh virtual Fedora 7 box, I have managed to count all directories and display them in tree view from it. By default installation, Fedora has more than 11,600 directory folders.

INSTALLATION
====================

In case, tree is not installed from your current Fedora box, here's a quick yum install howto

# yum -y install tree

TREE USAGE
====================

Here are more parameter sample using Tree
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

To display files and directories in a tree view mode

# tree

To display directories only would be like

# tree -d
Sample output:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|-- [apache apache ] ./LICENSE.txt
|-- [apache apache ] ./_install.php
|-- [apache apache ] ./_upgrade.php
|-- [apache apache ] ./admin
| |-- [apache apache ] ./admin/index.php
| |-- [apache apache ] ./admin/js
| | |-- [apache apache ] ./admin/js/AmiJS.js
| | |-- [apache apache ] ./admin/js/ajax_editing.js
| | |-- [apache apache ] ./admin/js/greybox.js
| | |-- [apache apache ] ./admin/js/lightbox.js
| | |-- [apache apache ] ./admin/js/plogger.js
| | `-- [apache apache ] ./admin/js/prototype.js
| |-- [apache apache ] ./admin/plog-admin-functions.php
| |-- [apache apache ] ./admin/plog-admin.php
| |-- [apache apache ] ./admin/plog-feedback.php
| |-- [apache apache ] ./admin/plog-import.php
| |-- [apache apache ] ./admin/plog-manage.php
| |-- [apache apache ] ./admin/plog-options.php
| |-- [apache apache ] ./admin/plog-rpc.php
| |-- [apache apache ] ./admin/plog-themes.php
| |-- [apache apache ] ./admin/plog-thumb.php
| |-- [apache apache ] ./admin/plog-thumbpopup.php
| `-- [apache apache ] ./admin/plog-upload.php
|-- [apache apache ] ./captcha.ttf
|-- [apache apache ] ./css
| |-- [apache apache ] ./css/admin.css
| |-- [apache apache ] ./css/gallery.css
| |-- [apache apache ] ./css/greybox.css
| |-- [apache apache ] ./css/lightbox.css
| `-- [apache apache ] ./css/tabs.css
|-- [apache apache ] ./dynamics.js


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

To view and display every file and folders including hidden ones in a tree mode display would be

# tree -a

To view files with UID, GUID, filesize, file location would be like so

# tree -ugfs

Sorted view of tree display is also possible by using tree parameters like

reversed sorting order
# tree -ugfsr

sorted by modification time
# tree -ugfst

To view and display all files and directories with UID and GID

# tree -gd

To use tree with enabled colorization would be

# tree -C

You can notice that using tree parameters, you can search files in a tree view mode of display using tree from command line terminal. Remember that these results can be combined further using other linux command.

Using linux command tree combined with grep would create another alternative way on grep'ing all files that has a modification time stamp of this month, September.

# tree -D | grep Sep

Alternatively, using tree to search or files and folder owned by a particular user or group ID like so

# tree -ugf | grep 'root\|user1'

Since tree traverses director folder, the depth of directory tree can also be specified like so

# tree -L 2

which traverses 2nd level down directories.

Another nice feature of tree linux command is that it can generate output in HTML file format with reference to base. This is done like so

# tree -H 'http://yourhost.domain.com' > index.html

Here's a sample of the generated tree view in web page file format:


Here's a sample screenshot of tree output from command line:


Enjoy.

MAC address packet filtering using IPTables

Wikipedia says:
Media Access Control address (MAC address) or Ethernet Hardware Address (EHA) or hardware address or adapter address is a quasi-unique identifier attached to most network adapters (NICs). It is a number that acts like a name for a particular network adapter, so, for example, the network cards (or built-in network adapters) in two different computers will have different names, or MAC addresses, as would an Ethernet adapter and a wireless adapter in the same computer, and as would multiple network cards in a router. However, it is possible to change the MAC address on most of today's hardware.

There are situations from our local network that requires control and management of packets going IN and OUT of your proxy interfaces coming and requested usually by internal hosts. Proxy servers are usually configurable linux gateway machines serving internal or client host as their front-end host from the web.

Implementing IP-based policies and access list restrictions from linux-based firewall is one of the many approaches to resolve and filter host based from MAC address. This situation can also be resolved by implememting a MAC address filters from the router level, or from firewall appliances, first hop bandwidth monitoring appliances, VLAN switches, other proxy software packages like Squid, other linux-based firewalls like IPCop and a lot of them from opensource list.

Considering the costly fees from acquiring these not so cheap appliances and routers, we can make use of iptables out of an existing proxy server or proxy gateway to filter out host based on their MAC address. In short, do MAC address packet filtering using iptables of an existing proxy linux box.

Iptables man says:
Iptables is used to set up, maintain, and inspect the tables of IP packet filter rules in the Linux kernel. Several different tables may be defined. Each table contains a number of built-in chains and may also contain user-defined chains.

Linux IPtables is currently the default firewall package that comes from RedHat, CentOS and Fedora, right after ipchains dominated them long time ago. Iptables supports different types of filters. To name a few, iptables can do filters and firewall rules by usernames, by group IDs and user profiles, by source and destination ports, by source host and destination hosts, by URLs, by IP addresses, by packet ID flags, by protocols, and a lot more including filtering by MAC address.

This entry assumes that an existing proxy server is currently in place inside your network and you want to filter linux/windows client machines behind the proxy server using MAC address packet filtering by iptables.

Here's an entry on how to filter out MAC address using Linux IPTable firewall.


IPTABLES INSTALLATION
=====================

# yum -y install iptables


IPTABLES FIREWALL PACKAGE VERIFICATION
======================================

# rpm -qa iptables


IPTABLES MAC ADDRESS FILTERING
==============================

Here's an iptables sample lines to filter out host based on MAC address using the currently in place proxy server or linux proxy gateway. Make sure you insert them from one of your existing iptables INPUT chains like so

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# iptables -A INPUT -m mac --mac-source 00:02:A5:EC:00:8B -j DROP

Alternatively,

# -A RH-Firewall-1-INPUT -m mac --mac-source 00:02:A5:EC:00:8B -j DROP

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The command above would block a host with MAC Address 00:02:A5:EC:00:8B regardless of current IP address and packet/port source and destinations.


Extending MAC Address Filters via Iptables
==========================================

If you want to allow port 80 for a host with MAC address 00:02:A5:EC:00:8B , simply insert this line to your existing /etc/sysconfig/iptables firewall rules right after your INPUT chain

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# iptables -A INPUT -p tcp --destination-port 80 -m mac --mac-source 00:02:A5:EC:00:8B -j ACCEPT

Alternatively,

# -A RH-Firewall-1-INPUT -p tcp --destination-port 80 -m mac --mac-source 00:02:A5:EC:00:8B -j ACCEPT

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Iptables is one powerful linux packet filtering firewall specially when properly tweaked and modified to fit your needs. If you wish to know more of iptables, read the man page. Further iptables reading can be found here.

May the iptables keeps your linux boxes protected as always.

HTH

Tuesday, September 4, 2007

GTK-based GNOME Linux Tools

GTK-based GNOME Linux Tools
===========================

As this blog entry aims to provide more linux information and tool sets specially to RedHat based distro like Fedora, CentOs, Fox, WhiteOs, with audience consideration from linux friendly newbies up to long time linux users, here's another set of simple linux tool.

UserMode-GTk package comprises of simle GTK-based GUI tool aimed to do certain user account tasks and disk function. Install usermode-gtk if you wish to have a GTK-based front tools on managing certain GNOME tasks. Usermode-Gtk is included from Fedora repositories, which means installation is smooth and easy using yum installer.

Usermode-Gtk is composed of several GTK-based binaries namely

a. userinfo - Userinfo allows users to change their finger information.


b. usermount - Usermount lets users mount, unmount, and format filesystem

c. userpasswd - Userpasswd allow
s users to change their passwords.


d. userformat - Userformat formats, mounts, and unmounts mounted partition and devices
UserFormat is a simple GUI based linux tool to mount and unmount partitions and mounted device. Userformat also formats detected mounted device as well.


All these binaries is easy to use, simple and user-friendly GTK-based tools with GUI interface.

INSTALLATION
============

# yum -y install usermode-gtk


BINARY EXECUTION
================

# userformat
# usermount
# userinfo
# userpasswd

Easy to remember binary names too!

Linux backups powered by RSnapShot

For more linux backups alternatives, which was covered here and here,.

RSnapShot, as mentioned to be a future entry, is now here as an alternative backup tools in linux.

RSnapShot is a linux filesystem snapshot backup utility. One of the nicest thing about rnsnapshot backup utility is that rsnapshot can do incremental snapshots of local and remote file systems for unlimited number of machines as long as the destination storage capacity can handle the backup snapshot output size. Rsnapshot utilizes rsync package to capture a snapshot of a filesystem. Rsync even saves more disk space by using linux hardlinks when creating snapshots.
Rsync becomes more powerful combined with large capacity media and network storage device. Rnapshot can create an exact duplicate of data from partition or folder locally or remotely.

Rsnapshot makes use of /etc/rsnapshot.conf conf file on creating filesystems snapshot backup.

RSNAPSHOT INSTALLATION:
=======================

# yum -y install rsnapshot rsync

This program should work on any reasonably modern UNIX compatible OS. It has been tested successfully on the following operating systems:
- Debian: 3.0 (woody), 3.1 (sarge), unstable (sid)
- Redhat: 7.x, 8.0, Enterprise Linux 3.0 ES
- Fedora Core 1, 3
- CentOS 3, 4
- WhiteBox Enterprise Linux 3.0
- Slackware 9.0
- SuSE: 9.0
- FreeBSD 4.9-STABLE
- OpenBSD 3.x
- Solaris 8 (SPARC and x86)
- Mac OS X
- IRIX 6.5


BINARY EXECUTION
================

Once rsnapshot has been installed, you will need to configure rsnapshot default config file. But first it is highly advisable to backup the original config file before doing any changes. Back it up as usual with the linux copy file command

# cp /etc/rsnapshot.conf /etc/rsnapshot.conf.bak


RSNAPSHOT PARAMETERS
====================

From command line, rsnaphot can be executed like so

# rsnapshot -v -t [interval] -c /var/backup/rsnapshot.conf [number]

Legend:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-t for time interval parameter
interval can be hourly, daily, weekly, monthly backup

Optional arguments:
-v enabled verbosity mode
-c custom config file
-V more verbosity
-q silent mode
-D full blown diagnostic verbose mode
number numerical interval identification number
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


RSNAPSHOT CONFIG FILE SETUP
===========================

Remember that variable and value inside rsnapshot.conf are separated by tab space. All folders are ended by / character.

By default, all snapshots would be stored under /.snapshots/ . For a different snapshot destination, you can edit the line that says

snapshot_root /.snapshots/

If you are backing up to a removable external media, it is advisable to enable this line

no_create_root 1

Now, for backup intervals
interval hourly 6
interval daily 7
interval weekly 4
interval monthly 12

From the above conf lines, hourly interval backups can have 6 snapshots before rotating the snapshot backup file. The daily interval has 7, this means that when rsnapshot is executed, rsnapshot would keep 7 daily snapshots before rotating the backup snapshot files.

For example

interval hourly 8

This means that every time "rsnapshot hourly" is run, it will make a new snapshot, rotate the old ones, and retain the most recent eight (hourly.0 - hourly.7) snapshots. This would be clearer when we combine rsnapshot with cron utility later on.

If you are specifying these intervals from command line, make sure you commented them out from rsnapshot.conf. However, global parameters are supposed to be on a centralized configuration file, that is why it is included from the rsnapshot.conf file as shown with the above sample.

For compatibility issues, leave this line uncommented

cmd_cp /bin/cp
cmd_rm /bin/rm
cmd_rsync /usr/bin/rsync
cmd_logger /usr/bin/logger
cmd_du /usr/bin/du
du_args -csh

If you have specific file glob patterns you can include them using this directive like so

include /home/ver/*.mp3

and excluding file blog patterns for example, like so

exclude /home/hisfolder/*.ISO

Here are the backup points that needs to be modified as an example

backup /home/ localhost/

/home/ is the snapshot destination folder under /.snapshot/ located from my current box. As you have noticed, folder locations are ended with / character and separated by tab key.

localhost would be the snapshot identification folder name that would be stored under the default snapshot destination folder, for this case is /.snapshot/ . For convenience of understanding, an hourly rsnapshot with the config sample shown above would be stored to

/.snapshots/hourly.0/localhost/home

Saving snapshot backup file to a remote host can also be specified from rsnapshot config file. This can be specifed as an example like so

backup user@backup-server2.com:/ backup-server2.com/

Passwordless and passphaseless ssh connection can be helpful here.

At this point, considering the setup above, rsync would create a local backup snapshot of /home and store the backup file to /.snapshots/ as its snapshot destination folder. Snapshots backup file includes /home/ver/*.mp3 files, /home/ partition folder and excluding /home/hisfolder/*.ISO files. Rsync would be run with default verbose logging dumped to /var/log/rsnapshot .

Here's a screenshot of rsnapshot in action considering the above configuration file together with rsnapshot log file:





Here's a rsnapshot disk usage of the above example.

# rsnapshot du localhost/home
~~~~~~~~~~~~~~~~~~
1.3G /.snapshots/hourly.0/localhost/home
1.3G total
~~~~~~~~~~~~~~~~~~

Now, compare it with using du (disk usage linux command) like so

# du -chs /home
~~~~~~~~~~~~~~~~~~
1.3G /home
1.3G total
~~~~~~~~~~~~~~~~~~


VERIFICATION OF RSNAPSHOT CONFIG FILE
======================================

For sanity checking of rsnapshot configuration file, this can be done from command line terminal like so

# rsnapshot configtest

If everything is fine, the below line should appear from executing the above command like so
~~~~~~~~~~~~~~~~
Syntax OK
~~~~~~~~


~~~~~~~~


RSNAPSHOT LOG MONITORING
~~~~~~~~~~~~~~~~~~~~~~~~

To monitor the latest rsnapshot log messages

# tailf /var/log/rsnapshot


RSNAPHOT ON CRONTAB UTILITY
===========================

Backup procedures are effective when done automatically without any user interactions.

Now, let us combine rsnapshot with crontab utility. Here's a sample crontab job with rsnapshot

00 00 * * * /usr/bin/rsnapshot daily
00 04 * * 6 /usr/bin/rsnapshot weekly
00 04 1 * * /usr/bin/rsnapshot monthly

This specifies a daily rsnapshot at midnight, a weekly snapshot on Saturdays at 4:00AM and a monthly rsnapshot at 4AM on the first day of each month.


Rsnapshot just created the first exact replica of /home . You are probably thinking that snapshots are actually exact data replica which just consumes your disk space. No, it is not.

Rsnapshot creates snapshots with differential and incremental algorithm in mind. Only changed contents of file and folder are saved into snapshots destination folders. Linux command du (disk usage) would report the same disk or folder size, which might confuse you later on.

Rsnapshot-diff to the rescue. Here is where rsnapshot-diff disk usage reporting tool comes in.

Try deleting some unimportant files or moving it to different folder location from the source backup location and compare the snapshot using rsnapshot-diff like so

# rsnapshot-diff /home /.snapshots/hourly.3/localhost/home/

which gives you a similar output
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Comparing /home to /.snapshots/hourly.3/localhost/home/
Between /home and /.snapshots/hourly.3/localhost/home/:
13081 were added, taking 1279034992 bytes;
13075 were removed, saving 1162911380 bytes;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

After moving some file, and did the rdiff comparison, you will see the difference from there.

For more FAQs.

Final Note:

Backing up data is critical that it needs critical and detailed attention. Any single byte differences can probably make the backup copy unusable. Implementing proper backup policy, backup documentation and procedures is one good attitude towards attaning an efficient and effective backup and recovery do's and dont's.

Goodluck then. Happy black boxes kicking and happy reading too!

Related Posts:

Linux Backup using Tar
Linux Backup using RDiff

Bandwidth-Effificent and Encrypted Linux Backup

MRTG tutorial, install and howtos

The Multi Router Traffic Grapher (MRTG) is a tool to monitor the traffic load on network-links. MRTG generates HTML pages containing PNG images which provide a LIVE visual representation of this traffic.


MRTG is basically used for generating graphs to a device, network host, IP-based appliances for monitoring usage, live data and statistics usage. This monitoring software package is not installed by default installation. MRTG is written in Perl and comes for free. MRTG supports several SNMP version and even 64 bit counters. All graphs produced by MRTG are highly configurable and customizable to fit one's needs. MRTG works on most Linux, Windows and UNIX platform. Check out more info from the site.


MRTG INSTALLATION
==================

Here's an entry how to install MRTG from Fedora using yum

# yum -y install mrtg


USAGE AND PROCESS
=================


Verify that MRTG is currently installed.

# rpm -qa mrtg


Here are several steps on how to configure MRTG and start a new graph for you devices, or network host.

By default installation, MRTG uses /etc/mrtg/mrtg.cfg as its default configuration file. It is adviseable to a backup copy of the said original config file for future preference like so

# cp /etc/mrtg/mrtg.cfg /etc/mrtg/mrtg.cfg.bak

On creating MRTG graph, the first step to take is to determine if the target host is SNMP enabled or supports SNMP. Additionally, the target polling host or device should be currently reachable or accessible by polling host via direct or network connectivity.

Polling host is where the MRTG is currently installed to. If the target host being polled does not support SNMP polling, the resulting data results may vary from systems to system depending upon the technique and approach used to retrieve variable values from the host being polled .

To cover a basic MRTG usage sample, this entry would cover using MRTG on linux to create and generate MRTG graph of ethernet interfaces from a windows machine. Windows machine is assumed to be located inside the broadcast network where linux host is currently residing. It is also assumed that the windows machine has SNMP enabled from its TCP/IP properties.


MRTG GRAPH CREATION
===================

Here's the basic foundation instructions on creating MRTG graph taking the above scenario.

MRTG config file can be manually created using one of MRTG tools that comes from installing MRTG package. Here, we are going to use cfgmaker which is responsible for automatic creation of config files readable by MRTG.

The basic cfgmaker parameters requires 2 arguments
a. hostname or IP address of the host being polled. This should be reachable by broadcast from the polling host.
b. community access name defined from the host being polled. This can be public, private or user-defined community host.

As an example using linux terminal, here's a basic sample that shows the above requirements

# cfgmaker public@windows-IP-address

The above command would display from your screen similar results shown below

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--base: Get Device Info on public@target-host-ip:
--base: Vendor Id:
--base: Populating confcache
--coca: populate confcache public@target-host-ip:
--coca: store in confcache public@target-host-ip_ Descr MS TCP Loopback interface --> 1
--coca: store in confcache public@target-host-ip_ Descr Realtek RTL8139 Family PCI Fast Ethernet NIC - Packet Scheduler Miniport --> 2
--coca: store in confcache public@target-host-ip_ Type 24 --> 1
--coca: store in confcache public@target-host-ip_ Type 6 --> 2
--coca: store in confcache public@target-host-ip_ Ip target-host-ip --> 2
--coca: store in confcache public@target-host-ip_ Ip 127.0.0.1 --> 1
--coca: store in confcache public@target-host-ip_ Ip target-host-ip2 --> 2
--coca: store in confcache public@target-host-ip_ Eth --> 1
--coca: store in confcache public@target-host-ip_ Eth 30-78-30-30-31-34-38-35-64-31-39-39-30-30 --> 2
--base: Get Interface Info
--base: Walking ifIndex
--base: Walking ifType
--base: Walking ifAdminStatus
--base: Walking ifOperStatus
--base: Walking ifMtu
--base: Walking ifSpeed

Target[target-host-IP-address]: 2:public@target-host-IP-address:
SetEnv[target-host-IP-address]: MRTG_INT_IP="target-host-IP-address" MRTG_INT_DESCR="Realtek-RTL8139-Family-PCI-Fast-Ethernet-NIC---Packet-Scheduler-Miniport"
MaxBytes[target-host-IP-address]: 12500000
Title[target-host-IP-address]: Traffic Analysis for 2 -- ORG NAME
PageTop[target-host-IP-address]: Traffic Analysis for 1 -- ORG NAME
..
snipped.
...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

As shown above, you can now copy and paste the line that starts with

Target[target-host-IP-address]: 2:public@target-host-IP-address:

and ends with [/div]

into your /etc/mrtg/mrtg.cfg file. All lines that starts with # character is found to be disabled from the host being polled and is not required to be included from /etc/mrtg/mrtg.cfg unless you further need them being uncommented.

There are several cfgmker arguments that is available from the command line. Here are a few argument alternatives:

# cfgmaker --enable-ipv6 --noreversedns --community=mycommunity --dns-domain target-IP-address

Legend:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--enable-ipv6 enables polling using IPv6
--noreversedns avoids doing reverse lookup for IP address found from device polling
--community defines custom community name to use with creating MRTG config file
--dns-domain appends custom domain name from the name of the device/host being polled

You can also overwrite the following variable directly from the command line
--ifdesc=nr interface description uses Interface Number (default)
--ifdesc=ip uses Ip Address
--ifdesc=eth uses Ethernet Number
--ifdesc=descr uses Interface Description
--ifdesc=name uses Interface Name
--ifdesc=catname uses CatOS Interface Name
--ifdesc=alias uses Interface Alias
--ifdesc=type uses Interface Type
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


After updating /etc/mrtg/mrtg.cfg, an index HTML file should be created. MRTG index file are the main index file where all the graphs can be viewed from the browser.


MRTG INDEX FILE CREATION
========================


MRTG comes with another binary tool called indexmaker. This indexmaker creates MRTG index files automatically using /etc/mrtg/mrtg.cfg as an index file basis for MRTG web site. This MRTG index file can be generated using indexmaker as shown below

# indexmaker /etc/mrtg/mrtg.cfg

With the above command, this would dump the actual index file from your screen. Using linux output redirection, the result from issuing the above command can be redirected to a file like so

# indexmaker /etc/mrtg/mrtg.cfg > index.html

Alternativety, using indexmaker parameters

# indexmaker /etc/mrtg/mrtg.cfg --output=index.html

MRTG index file is highly configurable using a variety of parameters available from indexmaker parameters. You can statically define MRTG title, number of columns, width, height, sections, MRTG log file, MRTG subtitle and headlevel number, MRTG leg


ends, sort display method, which interval graph to show, and more.

Now, you need to copy or move index.html file into a browseable location of your web server. As an example, you can create a folder directory and move it to /var/www/html/mrtg .


MRTG POLLING INTERVAL
=====================

With previous crontab entry here, you can now create an interval polilng schedule . Normally, advisable polling would be done every 5 minutes.

Here's a sample MRTG crontab sample that polls all defined variables and host from /etc/mrtg/mrtg.cfg with log output redirected to /var/log/mrtg.log done every 5 minutes time interval.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/5 * * * * env LANG=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg --logging /var/log/mrtg.log
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


MRTG LOG MONITORING
===================

MRTG log monitoring can be done basically like so

# tailf /var/log/mrtg.log

mrtg.log was defined from crontab utility shown above.

Make sure your web server is currently running and browseable. Simply fire up your browser and point it to your webserver default MRTG folder like http://MRTG-server-IP-address/mrtg/

And sample screenshot of one of my device using MRTG:



MRTG SECURITY
=============

Access to MRTG pages can be done from linux using apache security access list, user and password authentication, tcp wrapper and more using linux and apache. Unfortunately, this security issues and means would not be covered here as MRTG issues but would be done so sooner or later.

Kick the black box and thanks for reading!

FindSMB - view shared folders from network

Here's another tool to list out all shared folder from network neighborhood.

Findsmb is a perl script that prints out several pieces of information about machines on a subnet that respond to SMB name query requests or nmblookup.

findsmb can be handy when you need to mount shared folders or drives within your current subnet network or shared folder/drive from your network or machine near you.

If you want to list out all shared folders from your current network broadcast or subnet broadcast address from command line terminal, you can just simply issue findsmb without any parameter like so

# findsmb

Sample result:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
IP ADDR NETBIOS NAME WORKGROUP/OS/VERSION
---------------------------------------------------------------------
192.168.1.41 CC2 +[MSHOME] [Windows 5.1] [Windows 2000 LAN Manager]
192.168.1.200 HIPOLITE [HIPOLITE] [Windows 5.1] [Windows 2000 LAN Manager]
192.168.1.1 LINUXBOX *[MYGROUP] [Unix] [Samba 2.0.6]

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Findsmb Legend:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
first column - shows IP address that responds to SMB name queries or nmblookup request
second column - host name or computer name
third column - workgroup, netbiso name and OS information from responding client machines
or SMB server version
+ - indication of local master browser for that specific workgroup
* - indication of domain master browser for that specific workgroup


Alternatively, you can issue findsmb to probe for smblookup name queries from specific subnet broadcast like so

# findsmb 192.168.1.0

HTH

Squid - upgrade and install howto

If you are currently running a rpm-based squid binary, and you have just made a fresh fedora installation, here's an on how to upgrade and install your currently running Squid proxy web caching server.

By definition:
Squid is a high-performance proxy caching server for Web clients, supporting FTP, gopher, and HTTP data objects. Unlike traditional caching software, Squid handles all requests in a single, non-blocking, I/O-driven process. Squid keeps meta data and especially hot objects cached in RAM, caches DNS lookups, supports non-blocking DNS lookups, and implements negative caching of failed requests

PACKAGE VERIFICATION:
~~~~~~~~~~~~~~~~~~~~~

# rpm -qa squid


SQUID INSTALLATION
~~~~~~~~~~~~~~~~~~

# yum -y install squid


SQUID UPGRADE
~~~~~~~~~~~~~~

# yum -y update squid

Remember that doing yum downloads and installs squid binary with all default compile arguments. If you wish to have a customized compile arguments, you need to download the latest stable tar ball squid.

One of my next entries would discuss more of customizing squid configuration file.

HTH

prompt and press a key between script lines

Ever wonder how this simple mechanism goes where in an installation script prompts you a question and waits for you to press any key at a give time interval?

Here's a quick entry on how to prompt for a single key from a script with time interval.

Getkey is one linux command that waits until a keyboard key is pressed. This is useful on installation or even from a simple bash script. If your script is programmed to ask a user simple questions answerable by single keystroke, you might find this nice getkey tool script useful.

USAGE:
~~~~~~

Waits for user to press any key and display the pressed key
# getkey

Waits for a user to answer a question by Y or N within 5 seconds and display the pressed key
# getkey -c 5 -m "Press a kay within %d Continue the process Y or N?"

Waits for a user to answer a question by Y or N within 5 seconds and display the pressed key but ignores any special control keys except Ctrl+C and Ctrl+D
# getkey -i -c 5 -m "Press a kay within %d Continue the process Y or N?"

Another usage is for pausing between bash script lines like for 5 seconds instead of using sleep. But ignores any pressed key
# getkey -c 5

HTH

Monday, September 3, 2007

Devede - DVD/VCD video authoring and creation tool

Here's an entry to cover a linux tool on creating video DVDs and CDs, super VCDs, CVD, DIVX and MPEG-4 DVDs/CDs in Fedora 7 using a small linux tool called Devede.

DeVeDe is a program to create video DVDs and CDs (VCD, sVCD or CVD), suitable for home players, from any number of video files, in any of the formats supported by Mplayer. The big advantage over other utilities is that it only needs Mplayer, Mencoder, DVDAuthor, VCDImager and MKisofs (well, and Python 2.4, PyGTK and PyGlade), so its dependencies are really small.


INSTALLATION:
~~~~~~~~~~~~~

# yum -y install devede

BINARY LAUNCH
~~~~~~~~~~~~~

Ctrl+F2, devede

From its initial program launch, devede immediately prompts you to choose from the different media disk you wish to be created. From current devede version, you can choose from

a. Video DVD
b. Video CD
c. Super Video CD
d. CVD
e. DIVX / MPEG-4

as shown with the below image



Devede video creator also provides you with menu GUI interface for offering a variety of video authoring parameters shown below:


Here are the current features being supported by the linux video authoring tool:

a. titles, menu with titles, graphical images that comes with the title,
b. autoplayed subtitles
c. ISO/MPEG file output redirection
d. disk structure feature
e. several disk size to choose from
f. video output format (PAL/SECAM, NTSC)
g. video and audio rate, video images
i. video output size
j. trellis and deinterlacing feature
k. video encoding types
l. optional memcoder arguments
m. MBD mode or rate distortion
n. video quality options, aspect ratios, and scaling modes

and much more as seen with below screen shots


A sample video startup image:



There are more than more or less around 15,000 linux software and tools currently available from different linux distros, and this one is a must to install video authoring tool specially for those whose works involves video and audio media creations.

This devede is just starting and yet has already offered many benefits from its current version compared against having a commercially available non-free DVD authoring tools around.

Devede is neat, nice and most of all, free. You get a global wide community support from using GPL'd linux softwares.

display file and file system status

Display of file or file system status

Linux is totally comprised of different file types. Here's an entry on display more file info or file system info status using the linux command stat.

# stat /dev/sda1
# stat /dev/cdrom
# stat testfile.txt
# stat program.rpm
# stat test.iso

A sample output of issuing stat to test.iso
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
File: `test.iso'
Size: 360448 Blocks: 712 IO Block: 4096 regular file
Device: fd00h/64768d Inode: 4325435 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 500/ ver) Gid: ( 500/ ver)
Access: 2007-09-03 06:27:13.000000000 +0100
Modify: 2007-07-29 03:40:54.000000000 +0100
Change: 2007-09-02 12:14:12.000000000 +0100
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Determine status info of a partition
# stat /dev/sda1
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
File: "/dev/sda1"
ID: 0 Namelen: 255 Type: tmpfs
Block size: 4096 Fundamental block size: 4096
Blocks: Total: 63395 Free: 63386 Available: 63386
Inodes: Total: 63395 Free: 62934
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

From the given result, you can acquire more information on the queried object such as fundamental block size, file system type, Inodes, IO block types, file blocks covered, permissions and modes, user (UIDs) and group (GUIDs) ownerships and more.

determine file type

determine file type

An entry on how to determine file type.

This linux command file determine file types classification in three different ways namely filesystem tests, magic number tests, and language tests. The first test that succeeds causes the file type to be printed.

Determining file types are usually being used inside bash or perl script before any file read/write operation takes place. By doing so, any file validation algorithm can be performed first before any file or write access can be granted or continued.

Simple Usage
~~~~~~~~~~~~

# file /dev/sda1
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/dev/sda1: block special (8/1)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

# file F7.ISO
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
test.iso: ISO 9660 CD-ROM filesystem data UDF filesystem data (unknown version, id 'NSR0
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

# file textfile.txt
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
textfile.txt: ASCII English text
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

# file /dev/cdrom0
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/dev/cdrom: symbolic link to `scd0'
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

GNOME GUI task scheduler install howto

As per recent entry, here's another alternative on managing at and cron jobs utility from GNOME using a friendly GUI interface.

Gnome man:
Gnome-schedule is a grapichal user interface to 'crontab' and 'at', both used to schedule tasks. It supports periodical tasks and tasks that happens once in the future. It is written in python using pygtk.

Gnome-schedule supports both 'vixie-cron' and 'dcron', it has been developed and tested on a variety of distributions.

Gnome-schedule also supports titles and icons for your tasks so that they are more easily to keep track of. And you can create templates so that you won't have to create the same task again and again. So that if you want to schedule a virus check at 03:00 today, you can save it as a template and choose it from an dropdown box when you want. Or want to compile the kernel.. again.. at 00:00. This is saved in gconf and may easily be shipped with each distribution.

Major features
- If run as root you can edit any users 'crontab' and 'at' tasks.
- A parser that translates 'crontab' entries into human readable strings like 'Every hour' and not '0 * * * *' which might seem confusing to some.
- An applet where you from an dropdown menu can choose to add a task, manage tasks and get help.
- You can choose to use advanced mode which will display the tasks in a different way, where you can see the 'crontab' entries like you are used to.
- As mentioned you can set a title and an icon for tasks.
- Create templates like 'Virus check' or 'Compile kernel'.
- Predefined common expressions like: every minute, every week, tomorrow, next week.
- You may use an calendar to browse for the day you want a task executed.

GNOME-SCHEDULE INSTALLATION

# yum -y install gnome-schedule


BINARY LAUNCH: Ctrl+F2, gnome-schedule

This GUI based cron utility creates a chance for new comers with cron utility mechianism to achieve the same cron utility control done from command line by using a user friendly GUI interface via GNOME.

During program execution, gnome-scheduler scans for active cronjobs from cron spool utility and list them our from gnome-scheduler main pane. Toolbar and iconified menus are also available from Gnome-scheduler as shown with the below screenshots.

By creating a new job using gnome-schedule, you will be prompted by interactive wizard type of window prompts. Gnome-scheduler then prompts you for additional task requirements as listed below:

a. the name of the program or script to execute
b. interval time and/or number of program execution desired
c. descriptive comment for the desired cron job
d. output destination when executing the cron job
e. user account to be used for executing the cron job

See a newly created job for listing files from root folder location:


My screenshot in action:


Editing cron job using GNOME-scheduler in action:



All is done.

Saturday, September 1, 2007

Linux backups powered by Rsync

Backup like a PRO using one most popular linux backup tool alternatives called rsync.

RSync backups data and does it very clean and well. Rsync only transfers those data that have been modified and changed so that the destination host has an exact replica from the source host. Rysnc is a command line backup tool that handles data transfers in an effective and secure manner like any other known commercial backup softwares around. Rync blends in and integrates flawlessly with linux shell commands combined linux I/O redirections.

Here's an altenative approach based from recent entry on creating data backups from simple one to an enterprise backup data sets using rsync.

Man Rsync:

Rsync uses a reliable algorithm to bring remote and host files into sync very quickly. Rsync is fast because it just sends the differences in the files over the network instead of sending the complete files. Rsync is often used as a very powerful mirroring process or just as a more capable replacement for the rcp command. The rsync remote-update protocol allows rsync to transfer just the differences between two sets of files across the network connection, using an efficient checksum-search algorithm.


INSTALLATION:
~~~~~~~~~~~~~~~~

Rsync installation is installed by default System Tool group installation. If rsync is not available from command line and from rpm database, you can install from yum repo using yum like so

# yum -y install rsync

To verify that rsync has been installed successfully

# rpm -qa rsync

There are two different approach on establishing rsync communication between two hosts.

First is by using a remote-shell program such as ssh or rsh. If you want to use this approach, it is required that openssh server or an active ssh connection is present from both sending and receiving host. Openssh installation and configuration would not be covered from this entry. This entry would assume that ssh daemon service is currently configured and listening properly to assigned host port.

Secondly, is by using rsync listening INETD service directly.

This entry hope to cover both of them two worlds.

Rsync usage from command line terminal
======================================

Transfer and/or update files from local host into a remote host using rsync
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Basic rsync argument is to specify file glob, a source and a destination folder. Destination can be a local host or a remote host. A basic example to transfer from local to remote would be

# rsync -t *.mp3 remoteusername@remotehost:remote_destination_folder

The above would transfer, using rsync, all *.mp3 files from current local directory into remote_destination_folder of remotehost using remoteusername for authentication. A destination host can be locally or remote host and can be specified as hostname or IP address.

Legend:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-t preserve time of selected files
*.mp3 selected files to be transferred
remoteusername bash enabled user account from destination host
remotehost destination host where remoteusername is allowed to have access
remote_destination_folder destination folder from destination host owned and accessible
by remoteusername
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

For recursive traversing of directory folders for transferring data from current host to another host using rsync, this would be like so

# rsync -avrzt /var/www myuser@server1:/var/backup/
Legends:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-a archived mode enabled
-v verbosed mode enabled
-t preserve time stamp
-z compression transfer enabled
-r resursive mode enabled
/var/www selected folder or files glob source location
myuser user account from destination host
server1 destination host
/var/backup destination folder
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The above command would issues rsync with verbose mode enabled, compression enabled, arhived mode of rsync data transfer/update. Rsync transfers files and folders from /var/www (including the www folder) into /var/backup folder of server1 host using myuser as login credentials. The /var/backup from destination host is owned or writeable by myuser . All rsync files are created with file ownership and permission owned by myuser having 600 file mode. The transfer would be done preserving symbolic links, devices, attributes, permissions and ownerships of files.

# rsync -avz /var/www/ myuser@server1:/var/backup/www

Appending / from selected file glob like the above command issues the same rsync command with same argument. The only difference is that source folder is not created .

Transfer files from remote host to local host using rsync
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

# rsync -avrzt remoteusername@remotehost:remote_source_folder destination_folder
# rsync -avrz myuser@server1:/var/backup/www /var/www/

To transfer multiple files with different file extension from local host to remote host using rsync with file glob would be

# rsync -avrz file1.mp3 *.doc myuser@server1:/home/folder/location

To transfer multiple files from multiple directory sources using rsync would be

# rsync -avz `find /etc -name *.conf` user@remotehost:/user/folder

Linux command line tools when combined with each other creates another set of power tools. The above command searches all *.conf files from /etc folder and transfer them to /usr/folder of remotehost via rsync and using user the user login name. This can be handy if you like to backup specific pattern of files from your system or user accounts individual address books, files like that.

To transfer multiple files from multiple directory with some file excemptions using rsync and grep from local to remote would be like so:

# rsync -avz `find /etc -name *.conf | grep -v yum.conf` user@remotehost:/user/folder

Alternatively,

# rsync -avz $(find /etc -name *.conf | grep -v yum.conf) user@remotehost:/user/folder

and for multiple file rsync with multiple file from multiple source location with multiple file transfer exceptions would be like so

# rsync -avz `find /etc -name *.conf | grep -v 'yum.conf\|xorg.conf'` user@remotehost:/user/folder

To transfer of all your back up files ending in .tar file extension from any location would be like so

# rsync -avz `find / -name *.tar` user@remotehost:/user/folder

You will noticed that rsync can transfer data at high speed rate using rsync algorithm specially if those files and folders to be transferred are existing already from remote host.

To transfer multiple file(s) with multiple exclusions using rsync would be like so:

# rsync -avz * user@remotehost:/location --exclude=*.php --exclude=*.mp3

To transfer files in batch mode based from file lists using rsync would be

Assuming listing.txt is created with contents like below

# cat listing.txt
~~~~~~~~~~~~~~~~~~~~~
files0123.txt
files0124.txt
files6124.txt
files6126.txt
...
snipped
...
files32126.txt
~~~~~~~~~~~~~~~~~~~~~

and feeding the above file to rsync as batch mode input like so

# rsync -avzt --files-from=listing.txt user@remotehost

:/destination/

To rsync multiple folder source location using rsync would be like so

# rsync -avz --files-from=/home1 /home2 user@remotehost:/destination/

If both location contains abc.txt, the latest abc.txt would be transferred to remote host. If /home1/www exist and /home2/www exist, the files from both source kicatuib would be merged into /destination/www .

Fire up two new terminal windows, and from the first window, establish ssh connection from local to remote rsync destination. Then from the second windows try to issue these rsync command. You will notice that rsync never ask any password any more since there is an existing ssh connection with local host to remote host.

More rsync arguments
====================

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-W transfer the whole files without considering any update changes from existing destination file or folder
--progress show progress bar and/or percentage
-4 prefers IPv4
-6 prefers IPv6
--bwlimit=KBPS execute rsync with bandwidth limit rate in KBPS
-h display a more human readable screen output
--log-file=FILE dumps file activity into a file
--ignore-existing ignores already existing copy from destination host
--max-size tells rsync to avoid transferring files larger than specified size like
--max-size=10m avoid file transfer with 10MB in filesize
--port tells rsync to connect to rsync server with a different port, default is 873
--stats tells more file transfer info and rsync algorithm stats on the fly
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

At this point, be reminded to kick the black ninja box to refresh possible monitor related eye strains.





Using Rsync in Daemon Xinetd Mode
=================================

Edit /etc/xinetd.d/rsync and modify

disable = yes
to
disable = no

To run rsync in deamon mode via xinetd, make sure you have similar lines from your /etc/xinetd.d/rsync file like shown below:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
service rsync
{
disable = no
socket_type = stream
wait = no
user = root
server = /usr/bin/rsync
server_args = --daemon --config=/etc/rsync/rsyncd.conf -v
log_on_failure += USERID
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Create /etc/rsync/rsyncd.conf as a default conf file for rsync in daemon xinetd mode.

Sample rsyncd.conf file
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
uid = rsync-user
gid = rsync-user
use chroot = yes
read only = yes
pid file = /var/run/rsyncd.pid

# access list, edit the IP network block to suit your needs
hosts allow=192.168.0.0/255.255.0.0 192.168.1.0/255.255.255.0
# deny anything else
hosts deny=*

# limit connections
max connections = 5
#greeting file
motd file = /etc/rsync/rsyncd.motd
#log file
log file = /var/log/rsync.log

#rsync shared folder
[myrsync]
#make your UID/GUID above owns the below folder and files
#all files and folder would be seen by rsync client
path=/home/rsync-user/rsync-folder
comment = Linux Rsync Server
exclude = *.mp3

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Create rsync greeting MOTD file like so

# cat /etc/rsync/rsyncd.motd
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Welcome to my Rsync Server!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Restart xinetd service for the changes to take effect like so

# service xinetd restart

Verify that rsync is running as xinetd daemon service mode using one tool like ss

# ss -a | grep rsync
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
LISTEN 0 0 *:rsync *:*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Rsync uses port 873 as its default port for xinetd service. Make sure it is also open from your current firewall settings. A sample firewall rule for opeing rsync from your firewall would be like so

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 873 -j ACCEPT
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# service iptables restart

If you wish to have a passwordless rsync, you need to refer to passwordless/passphraseless ssh from one of last month's entry.

Rsync in daemon mode via command line
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

An alternative to run rsync in daemon mode is by specifying it from command line. Like so

# rsync --daemon --address host-IP-address --config=/etc/rsync/rsyncd.conf -v --port=873

Legend:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--daemon enables rsync to be run as daemon mode from terminal
--port specifies port number to use
--config specified rsync conf file
host-IP-address IP address where to bind rsync from
-v enables verbose mode
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Listing out files and folder from rsync server
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

To list out the files from rsync server, simply point your rsync client to the host running rsync in daemon mode or server mode. To test your rsync server from a client linux host would be like so

# rsync host-IP-address::

Alternatively,

# rsync rsync://host-IP-address/myrsync
# rsync rsync://host-IP-address/myrsync/folder1

From the above rsync command, you should be seeing files from /home/rsync-user/rsync-folder folder from rsync server you defined from /etc/rsync/rsyncd.conf.

Syncing File and Folders from Rsync Server
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

To sync and download files from rsync server.

# rsync rsync://host-IP-address/myrsync/folder1 .

The above command downloads files including the whole folder1 folder from rsync server and saves it to current directory

# rsync rsync://host-IP-address/myrsync/folder1/ .

The above command downloads only files from folder1 to current folder location

Rsync Log Monitoring
~~~~~~~~~~~~~~~~~~~~

Monitoring rsync server messages for any errors or system messages would be like so

# tail -f /var/log/rsync.log

Final Note:

Rsync can also be used for source code control and management for delivering a centralized and distributed sync source codes from rsync server to group of programmers or source developers among departments, more like a CVS approach.

Using rsync linux command provides many abilities and benefits. To name a few, mirror an entire harddisk or partitions, folders and files, entire domain websites, mail spools for replica servers, user's home folder, a mirror FTP site and much more.

Backup like the enterprise way, use RSync.

Have a nice day ahead!

Related Posts:

Linux Backup using RSnapShot
Linux Backup using Tar
Linux Backup using RDiff
Bandwidth-Effificent and Encrypted Linux Backup

KPackage - GUI package administration and management alternative

Linux administration of RPM packages from linux boxes is basically required for keeping up and maintaining your package database tight, neat, and clean linux boxes. This has been possible from command line terminal ever since RedHat become well know. The linux command RPM is a very powerful well known binary originally from RedHat, that makes a tedious job of application installation easier and straightforward dependency and compatibilities assessment, and smoother binary package installation as compared with early days with RedHat distro.

Package clean up is part of maintenance functions. This can be considered as post-install maintenance funcion. The clean up process does not only refer to package deletions, package updates and management, clearing downloaded cache and header files but also gives way to library package definitions and usage familiarity.

This document entry gives way for another alternative for package management, KPackage.

Kpackage is one GUI-based KDE administration tool for installing, viewing and uninstalling RPM packages for many distros. The formats supported includes RPM, Debian, Slackware and BSD package manager. KPackage is part of kdeadmin rpm package available from many distros, which was an entry recently from here.


INSTALLATION
~~~~~~~~~~~~~~~~

# yum -y install kdeadmin

This package manager makes use of GUI-enabled features that is easily viewed and managed interactively by simple clicks and search selection. Kpackage comes with a nice panel presentation making use of dropdown tree-like menus, toolbars, fast rpm search for package addition, deletion, updates using X in GNOME or KDE.

BINARY LAUNCH: Ctrl+F2, kpackage

See screenshot
About:

Main Panel:

Sign up for PayPal and start accepting credit card payments instantly.
ILoveTux - howtos and news | About | Contact | TOS | Policy