Best Web Hosting


COUPON CODE:  techpulpdeal



and get $9.94 off on all hosting plans

Search


There are hundreds of cool tips and tricks. Just search the site below.


Browse articles of 2010 | 2009 | 2008



How to bind a service under xinetd to a specific ip address

September 03, 2010 By: Neo Category: Server

As an administrator,  you wouldn’t want external users to access a new service while you are setting it up. In such cases, you might want to bind the service to loop-back address (127.0.0.1) until you are sure that service is functional and not vulnerable. As a Desktop user, to increase security of the system, you can turn off unused services and change the bind address to loop-back for the servers that are not expected to be accessed from outside.

Coming to the actual topic of changing bind address of a service under xinetd, you need to add a line similar to the following in the corresponding service file present in /etc/xinetd.d directory.

For example, I have VMWare server installed in my system and it starts vmware-authd service under xinetd. This service automatically binds to “any” address leaving the port open to external users. If I don’t want any external access to my service, I can change the bind address to loopback address.

[root@techpulp ~] cat /etc/xinetd.d/vmware-authd
# default: on
# description: The VMware remote access authentification daemon
service vmware-authd
{
disable         = no
port            = 908
socket_type     = stream
protocol        = tcp
wait            = no
user            = root
server          = /usr/sbin/vmware-authd
type            = unlisted
bind            = 127.0.0.1
}
[root@techpulp ~]#

How to read Microsoft Windows .chm help files in Linux

September 02, 2010 By: Neo Category: Desktop

It is sometimes required to read Microsoft Windows help files (.chm) in Linux. Once such case could be for cross developing applications using MinGW for Windows in Linux. Another case could be reading documentation of a generic stuff like JavaScript programming etc.

Linux supports a command called “xchm” that can be used to view .chm files. You can install it using “yum” command in Fedora/RHEL Linux as shown below.

[root@techpulp ~]# yum -y install xchm

After successful installation you should see a new command xchm available.

To open a .chm help file, use following command.

[neo@techpulp ~]# xchm jquery.chm

There’s a KDE version of CHM file viewer called “kchm“. I never used it. But you can explore it for yourself and post your views on it as a comment here.

How to create passwordless account in Linux system

September 01, 2010 By: Mark Category: Administration

First of all, you should know that creating a password-less account is a very bad idea. You should be knowing what you are doing before doing so. However this may be of use in certain scenarios like doing SSH or Telnet to a virtual machines created using Virtualization software like VMWare, KVM, Microsoft Virtual PC etc. In such scenarios you should have a dedicated network adapter for each virtual machine that is accessible to the host machine only. Of course any such management service like SSH, Telnet or FTP should be running only on the adapter accessible to Host system only. Configuring services to listen on specific adapters is out of the scope here.

You must be logged in as “root” user to do this. Okay. Now you know what you are doing.

To create a password-less account in Linux, First you can create the account as usual. In this example, I am trying to create a new user account “mark“.

[root@techpulp ~]# adduser mark

Now set blank password for user “mark”.

[root@techpulp ~]# passwd -d mark

This allows user “mark” to login without a password.

How to install screen command in FreeBSD

September 01, 2010 By: Neo Category: FreeBSD

To install screen command in FreeBSD, run the following commands after logging in as super user (root). Note that you should have valid Internet connection.

[root@techpulp ~]# cd /usr/ports/sysutils/screen

[root@techpulp ~]# make install

The above command should download screen command from FreeBSD repository and install it in your system.

How to unzip files with .7z extension in Fedora Linux

August 31, 2010 By: Neo Category: Desktop, Fedora

There is an open source tool names 7zip  which creates compressed files with .7z extension. Fedora Linux provides a package in its repository to install the application if required. First of all, you need to install “p7zip” package in the system as shown below. You need to login as root and the system should have an active Internet connection so that “yum” tool can download from Fedora repository to install 7zip in your system.

[root@techpulp ~]# yum -y install p7zip

If installation is successful, you should see a command with name “7za“.

You can the command 7za to uncompress a file with .7z extension as shown below:

[neo@techpulp ~]# 7za  e jquery-1.4.chm.7z

7-Zip (A) 4.61 beta  Copyright (c) 1999-2008 Igor Pavlov  2008-11-23
p7zip Version 4.61 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,2 CPUs)

Processing archive: jquery-1.4.chm.7z

Extracting  jquery-1.4.chm

Everything is Ok

Size:       1815572
Compressed: 1804888
[neo@techpulp ~]#

Must Read:

Learn more about 7Zip tool

Count number of characters (strlen) in a bash variable

August 30, 2010 By: Neo Category: Bash

The following example shows the functionality of strlen in a bash script.

[neo@techpulp ~]# echo $HOME
/home/neo
[neo@techpulp ~]# echo ${#HOME}
9
bash#

The following defines an utility function that can be used in a bash script.

#!/bin/bash

function strlen() { echo -n ${#1}; }

len=`strlen $HOME`

echo $len

How to use logical OR and logical AND in a bash script

August 29, 2010 By: Neo Category: Bash

The operators used in bash scripting for logical OR and logical AND are “||” and “&&” respectively.

The following snippet shows example usage of logical OR operator.

if [ "$a" -eq 30 ] || [ "$b" -eq 40 ]; then
    echo The logical OR condition met
else
    echo The logical OR condition not met
fi

The following snippet shows example usage of logical AND operator.

if [ "$a" -eq 24 ] && [ "$b" -eq 47 ]; then
    echo The logical AND condition met
else
    echo The logical AND condition not met
fi

How to show desktop pop-up notification in Linux using notify-send command

August 27, 2010 By: Mark Category: Command Line, Desktop

It is very useful when you are about to start a bulk job and want to get notified asynchronously after its completion. That helps you continue with other work without having to check for its completion periodically. Of course if you don’t have any other work, you can at least play few games without bothering about the job completion.

There is a command in Linux called “notify-send” that can be used to generate a desktop notification from command line or a script. However where exactly this notification message appears depends entirely on the desktop you are using. For example, if you are using GNOME, you will see the message at rightmost-top or rightmost-bottom based on your panel placement.

How to install
First of al, you should check if you have notify-send command installed in your system. if not, you can install it as follows:

On Fedora/RHEL

yum -y install libnotify

On Ubuntu

sudo apt-get install libnotify-bin

Basic usage

You can see the basic usage using “notify-send –help” command:

[mark@techpulp ~]$ notify-send --help
Usage:
notify-send [OPTION...] <SUMMARY> [BODY] - create a notification

Help Options:
-?, --help                        Show help options

Application Options:
-u, --urgency=LEVEL               Specifies the urgency level (low, normal, critical).
-t, --expire-time=TIME            Specifies the timeout in milliseconds at which to expire the notification.
-i, --icon=ICON[,ICON...]         Specifies an icon filename or stock icon to display.
-c, --category=TYPE[,TYPE...]     Specifies the notification category.
-h, --hint=TYPE:NAME:VALUE        Specifies basic extra data to pass. Valid types are int, double, string and byte.
-v, --version                     Version of the package.

[mark@techpulp ~]$

Let us run the command to show a desktop notification message

[mark@techpulp ~]$ notify-send "Hey Mark, You compilation of Linux Kernel is Successful"

This would show a message like the following.

Notification of notify-send command

Notification of notify-send command

When you want to show rather a larger message, it is better to have a caption. Let us try following command that shows a caption and a message.

[mark@techpulp ~]$ notify-send "Data Backup Task" "Hey, All files are backed up along with database files. However you should manually verify once."

The above command displays notification as follows.

Caption and Message using notify-send command

Caption and Message using notify-send command

You can add an icon to the message to make it appear more sensible. In this case, I am using a stock icon.

[mark@techpulp ~]# notify-send -i face-tired "Meeting" "Oh! not again. That all hands meeting starting in 10 minutes."

This shows a notification message as follows:

Notification with Stock Icon

Notification with Stock Icon

You can find possible stock icons as follows (of course gnome specific):

[mark@techpulp ~]# ls /usr/share/icons/gnome/32x32/emotes/
face-angel.png        face-sick.png        stock_smiley-15.png
face-angry.png        face-smile-big.png   stock_smiley-18.png
face-cool.png         face-smile.png       stock_smiley-1.png
face-crying.png       face-smirk.png       stock_smiley-22.png
face-devilish.png     face-surprise.png    stock_smiley-2.png
face-embarrassed.png  face-tired.png       stock_smiley-3.png
face-kiss.png         face-uncertain.png   stock_smiley-4.png
face-laugh.png        face-wink.png        stock_smiley-5.png
face-monkey.png       face-worried.png     stock_smiley-6.png
face-plain.png        stock_smiley-10.png  stock_smiley-7.png
face-raspberry.png    stock_smiley-11.png  stock_smiley-8.png
face-sad.png          stock_smiley-13.png
[mark@techpulp ~]#

You can use your own icon by specifying its full path “-i” option.

[mark@techpulp ~]# notify-send -i /usr/share/icons/gnome/32x32/emotes/face-sad.png "Meeting" "Oh! not again. That all hands meeting starting in 10 minutes."

Generally the notification displayed using notify-send disappears after few seconds. You can control the time for which the notification should be visible using “-t” option. Note that the value passed to -t option is in milli-seconds. If you want the message to be there forever until the user closes it, you need to pass “0” as time out value.

Display notification for 10 seconds:

[mark@techpulp ~]# notify-send -t 10000 -i face-sad "Meeting" "Oh! not again. That all hands meeting starting in 10 minutes."

Display notification without auto disappearance.

[mark@techpulp ~]# notify-send -t 0 -i face-sad "Meeting" "Oh! not again. That all hands meeting starting in 10 minutes."

How to configure a network interface in Linux

August 27, 2010 By: Neo Category: Linux

Linux provides “ifconfig” command to configure network interfaces.

To display list of available interfaces:

[root@techpulp ~]# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:65:23:5E:D4:3C
inet addr:192.168.191.1  Bcast:192.168.191.255  Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
RX packets:261958 errors:0 dropped:0 overruns:0 frame:0
TX packets:201967 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:322195982 (307.2 MiB)  TX bytes:18627969 (17.7 MiB)
Interrupt:21 Base address:0x2000

lo        Link encap:Local Loopback
inet addr:127.0.0.1  Mask:255.0.0.0
UP LOOPBACK RUNNING  MTU:16436  Metric:1
RX packets:4 errors:0 dropped:0 overruns:0 frame:0
TX packets:4 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:240 (240.0 b)  TX bytes:240 (240.0 b)

[root@techpulp ~]#

To bring down an interface “eth0″:

[root@techpulp ~]# ifconfig eth0 down

To bring up an interface “eth0″:

[root@techpulp ~]# ifconfig eth0 up

To configure an interface with an IP address:

[root@techpulp ~]# ifconfig eth0 192.168.191.1 netmask 255.255.255.0 up

(or)

[root@techpulp ~]# ifconfig eth0 192.168.191.1/24 up

Why KVM doesn’t work in my PC

August 26, 2010 By: Neo Category: Emulation/Virtualization

KVM requires your processor to support x86 virtualization extensions (Intel VT or AMD-V).

Intel VT and AMD-V are instruction set extensions that provide hardware assistance to virtual machine monitors. They enable full virtualization.

To quickly check if your processor can be used with KVM, try the following commands. You should see something if Intel VT or AMD-V extensions are enabled in your processor.

On Intel Processor:

cat /proc/cpuinfo | grep ^flags | grep vmx

On AMD Processor:

cat /proc/cpuinfo | grep ^flags | grep svm

If you are unsure, which processor is present in your system, you can try both the commands and you should see at least one command showing some information.

  • Best Ever Deal on Earth